From 030daa420718a04ec24db09453897cc8d7226ddc Mon Sep 17 00:00:00 2001 From: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> Date: Thu, 6 Jun 2024 12:24:39 -0300 Subject: [PATCH 1/9] ci(fix): Fix new workflows --- .github/workflows/hw.yml | 13 +++++++------ .github/workflows/tests.yml | 7 ++++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/hw.yml b/.github/workflows/hw.yml index 4be0abe6669..c55ec9b764d 100644 --- a/.github/workflows/hw.yml +++ b/.github/workflows/hw.yml @@ -55,12 +55,13 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha || github.sha }} - - uses: actions/setup-python@v5 - if: steps.check-tests.outputs.enabled == 'true' - with: - cache-dependency-path: tests/requirements.txt - cache: 'pip' - python-version: '3.10.1' + # setup-python currently only works on ubuntu images + # - uses: actions/setup-python@v5 + # if: steps.check-tests.outputs.enabled == 'true' + # with: + # cache-dependency-path: tests/requirements.txt + # cache: 'pip' + # python-version: '3.10.1' - name: Install dependencies if: ${{ steps.check-tests.outputs.enabled == 'true' }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 25243cf9440..d853da671be 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -167,7 +167,7 @@ jobs: clean: name: Clean objects needs: unit-test-results - if: always() && ${{ github.event_name }} == 'pull_request_target' && ${{ github.event.action }} != 'closed' + if: always() permissions: actions: write runs-on: ubuntu-latest @@ -179,6 +179,11 @@ jobs: const ref = '${{ github.event.pull_request.number || github.ref }}'; const key_prefix = 'tests-' + ref + '-'; + if ('${{ github.event_name }}' == 'pull_request_target' && '${{ github.event.action }}' != 'closed') { + console.log('Skipping cache cleanup for open PR'); + return; + } + await github.paginate(github.rest.actions.getActionsCacheList, { owner: context.repo.owner, repo: context.repo.repo, From e3452ea6e10bc4a0f85f2cc0dc91c6605d74e0d2 Mon Sep 17 00:00:00 2001 From: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> Date: Thu, 6 Jun 2024 12:25:33 -0300 Subject: [PATCH 2/9] ci(pre-commit): Properly cache python modules --- .github/workflows/pre-commit.yml | 8 ++++---- tools/pre-commit/requirements.txt | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 tools/pre-commit/requirements.txt diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 56393d46202..c4ae017c229 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -28,6 +28,8 @@ jobs: - name: Set up Python 3 uses: actions/setup-python@v5 with: + cache-dependency-path: tools/pre-commit/requirements.txt + cache: 'pip' python-version: "3.x" - name: Get Python version hash @@ -41,11 +43,10 @@ jobs: with: path: | ~/.cache/pre-commit - ~/.cache/pip - key: pre-commit|${{ env.PY_HASH }}|${{ hashFiles('.pre-commit-config.yaml', '.github/workflows/pre-commit.yml') }} + key: pre-commit-${{ env.PY_HASH }}-${{ hashFiles('.pre-commit-config.yaml', '.github/workflows/pre-commit.yml', 'tools/pre-commit/requirements.txt') }} - name: Install python dependencies - run: python -m pip install pre-commit docutils + run: python -m pip install -r tools/pre-commit/requirements.txt - name: Get changed files id: changed-files @@ -61,7 +62,6 @@ jobs: with: path: | ~/.cache/pre-commit - ~/.cache/pip key: ${{ steps.restore-cache.outputs.cache-primary-key }} - name: Push changes using pre-commit-ci-lite diff --git a/tools/pre-commit/requirements.txt b/tools/pre-commit/requirements.txt new file mode 100644 index 00000000000..10db94a1393 --- /dev/null +++ b/tools/pre-commit/requirements.txt @@ -0,0 +1,2 @@ +pre-commit==3.7.1 +docutils==0.21.2 From cc40edb40766ea8a013c0d76326bc57314418bff Mon Sep 17 00:00:00 2001 From: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> Date: Thu, 6 Jun 2024 12:26:14 -0300 Subject: [PATCH 3/9] fix(get.py): Verify files after extraction and make it more readable --- tools/get.py | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/tools/get.py b/tools/get.py index 68b92e05da7..baf31ebd876 100755 --- a/tools/get.py +++ b/tools/get.py @@ -107,12 +107,14 @@ def verify_files(filename, destination, rename_to): for i, zipped_file in enumerate(archive.namelist(), 1): local_path = os.path.join(extracted_dir_path, zipped_file.replace(first_dir, rename_to, 1)) if not os.path.exists(local_path): - print(f"\nMissing {zipped_file} on location: {extracted_dir_path}") - print(f"Verification failed; aborted in {format_time(time.time() - t1)}") + if verbose: + print(f"\nMissing {zipped_file} on location: {extracted_dir_path}") + print(f"Verification failed; aborted in {format_time(time.time() - t1)}") return False print_verification_progress(total_files, i, t1) except zipfile.BadZipFile: - print(f"Verification failed; aborted in {format_time(time.time() - t1)}") + if verbose: + print(f"Verification failed; aborted in {format_time(time.time() - t1)}") return False elif filename.endswith(".tar.gz"): try: @@ -122,12 +124,14 @@ def verify_files(filename, destination, rename_to): for i, zipped_file in enumerate(archive.getnames(), 1): local_path = os.path.join(extracted_dir_path, zipped_file.replace(first_dir, rename_to, 1)) if not os.path.exists(local_path): - print(f"\nMissing {zipped_file} on location: {extracted_dir_path}") - print(f"Verification failed; aborted in {format_time(time.time() - t1)}") + if verbose: + print(f"\nMissing {zipped_file} on location: {extracted_dir_path}") + print(f"Verification failed; aborted in {format_time(time.time() - t1)}") return False print_verification_progress(total_files, i, t1) except tarfile.ReadError: - print(f"Verification failed; aborted in {format_time(time.time() - t1)}") + if verbose: + print(f"Verification failed; aborted in {format_time(time.time() - t1)}") return False elif filename.endswith(".tar.xz"): try: @@ -137,12 +141,14 @@ def verify_files(filename, destination, rename_to): for i, zipped_file in enumerate(archive.getnames(), 1): local_path = os.path.join(extracted_dir_path, zipped_file.replace(first_dir, rename_to, 1)) if not os.path.exists(local_path): - print(f"\nMissing {zipped_file} on location: {extracted_dir_path}") - print(f"Verification failed; aborted in {format_time(time.time() - t1)}") + if verbose: + print(f"\nMissing {zipped_file} on location: {extracted_dir_path}") + print(f"Verification failed; aborted in {format_time(time.time() - t1)}") return False print_verification_progress(total_files, i, t1) except tarfile.ReadError: - print(f"Verification failed; aborted in {format_time(time.time() - t1)}") + if verbose: + print(f"Verification failed; aborted in {format_time(time.time() - t1)}") return False else: raise NotImplementedError("Unsupported archive type") @@ -231,7 +237,12 @@ def unpack(filename, destination, force_extract): # noqa: C901 shutil.rmtree(rename_to) shutil.move(dirname, rename_to) - return True + if verify_files(filename, destination, rename_to): + print(" Files extracted successfully.") + return True + else: + print(" Failed to extract files.") + return False def download_file_with_progress(url, filename, start_time): @@ -291,6 +302,7 @@ def get_tool(tool, force_download, force_extract): local_path = dist_dir + archive_name url = tool["url"] start_time = time.time() + print("") if not os.path.isfile(local_path) or force_download: if verbose: print("Downloading '" + archive_name + "' to '" + local_path + "'") @@ -421,6 +433,9 @@ def identify_platform(): current_dir + "/../package/package_esp32_index.template.json", identified_platform ) mkdir_p(dist_dir) + + print("\nDownloading and extracting tools...") + for tool in tools_to_download: if is_test: print("Would install: {0}".format(tool["archiveFileName"])) @@ -432,4 +447,4 @@ def identify_platform(): print(f"Tool {tool['archiveFileName']} was corrupted, but re-downloading did not help!\n") sys.exit(1) - print("Platform Tools Installed") + print("\nPlatform Tools Installed") From 0f4b14322cf0ccfe156de0188d2d396a9dc2e6f5 Mon Sep 17 00:00:00 2001 From: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> Date: Thu, 6 Jun 2024 18:13:47 -0300 Subject: [PATCH 4/9] ci(idf): Compile as component when libs change --- .github/workflows/push.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index ca3f2de55cf..bf45b6fbe4c 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -48,6 +48,7 @@ jobs: runs-on: ubuntu-latest outputs: build_all: ${{ steps.set-chunks.outputs.build_all }} + build_libraries: ${{ steps.set-chunks.outputs.build_libraries }} build_static_sketches: ${{ steps.set-chunks.outputs.build_static_sketches }} build_idf: ${{ steps.set-chunks.outputs.build_idf }} build_platformio: ${{ steps.set-chunks.outputs.build_platformio }} @@ -103,6 +104,7 @@ jobs: build_platformio=${{ steps.changed-files.outputs.platformio_any_changed == 'true' }} build_idf=${{ steps.changed-files.outputs.idf_any_changed == 'true' }} + build_libraries=${{ steps.changed-files.outputs.libraries_any_changed == 'true' }} build_static_sketches=${{ steps.changed-files.outputs.static_sketeches_any_changed == 'true' }} core_changed=${{ steps.changed-files.outputs.core_any_changed == 'true' }} @@ -164,6 +166,7 @@ jobs: chunks+="]" echo "build_all=$build_all" >> $GITHUB_OUTPUT + echo "build_libraries=$build_libraries" >> $GITHUB_OUTPUT echo "build_static_sketches=$build_static_sketches" >> $GITHUB_OUTPUT echo "build_idf=$build_idf" >> $GITHUB_OUTPUT echo "build_platformio=$build_platformio" >> $GITHUB_OUTPUT @@ -274,7 +277,10 @@ jobs: build-esp-idf-component: name: Build with ESP-IDF ${{ matrix.idf_ver }} for ${{ matrix.idf_target }} needs: gen-chunks - if: ${{ needs.gen-chunks.outputs.build_all == 'true' || needs.gen-chunks.outputs.build_idf == 'true' }} + if: | + needs.gen-chunks.outputs.build_all == 'true' || + needs.gen-chunks.outputs.build_libraries == 'true' || + needs.gen-chunks.outputs.build_idf == 'true' runs-on: ubuntu-20.04 strategy: fail-fast: false From 34f6b330302b5073c7df1ceb0e4caed2b30bd477 Mon Sep 17 00:00:00 2001 From: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> Date: Thu, 6 Jun 2024 18:14:51 -0300 Subject: [PATCH 5/9] ci(wokwi): Re-enable cache for wokwi tests --- .github/workflows/wokwi.yml | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/.github/workflows/wokwi.yml b/.github/workflows/wokwi.yml index ae68daff9e0..02f3437896b 100644 --- a/.github/workflows/wokwi.yml +++ b/.github/workflows/wokwi.yml @@ -30,16 +30,15 @@ jobs: id: ${{ github.event.pull_request.number || github.ref }}-${{ github.event.pull_request.head.sha || github.sha }}-${{ inputs.chip }}-${{ inputs.type }} runs-on: ubuntu-latest steps: - # Disabled as Wokwi infrastrucutre is not stable (so we can re-trigger the tests manually) - # - name: Check if already run - # if: ${{ github.event.pull_request.number != null }} - # id: get-cache-results - # uses: actions/cache/restore@v4 - # with: - # key: tests-${{ env.id }}-results-wokwi - # path: | - # tests/**/*.xml - # tests/**/result_*.json + - name: Check if already run + if: ${{ github.event.pull_request.number != null }} + id: get-cache-results + uses: actions/cache/restore@v4 + with: + key: tests-${{ env.id }}-results-wokwi + path: | + tests/**/*.xml + tests/**/result_*.json - name: Evaluate if tests should be run id: check-tests @@ -100,15 +99,14 @@ jobs: run: | bash .github/scripts/tests_run.sh -c -type ${{ inputs.type }} -t ${{inputs.chip}} -i 0 -m 1 -W ${{env.WOKWI_TIMEOUT}} - # Disabled as Wokwi infrastrucutre is not stable (so we can re-trigger the tests manually) - # - name: Upload ${{ inputs.chip }} ${{ inputs.type }} Wokwi results as cache - # uses: actions/cache/save@v4 - # if: ${{ always() && steps.check-tests.outputs.enabled == 'true' }} - # with: - # key: tests-${{ env.id }}-results-wokwi - # path: | - # tests/**/*.xml - # tests/**/result_*.json + - name: Upload ${{ inputs.chip }} ${{ inputs.type }} Wokwi results as cache + uses: actions/cache/save@v4 + if: ${{ always() && steps.check-tests.outputs.enabled == 'true' }} + with: + key: tests-${{ env.id }}-results-wokwi + path: | + tests/**/*.xml + tests/**/result_*.json - name: Upload ${{ inputs.chip }} ${{ inputs.type }} Wokwi results as artifacts uses: actions/upload-artifact@v4 From fbf94b2357967c8414304102369d26faa12ccdd1 Mon Sep 17 00:00:00 2001 From: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> Date: Thu, 6 Jun 2024 21:29:22 -0300 Subject: [PATCH 6/9] ci(tests): Run scripts only from master --- .github/workflows/build_tests.yml | 17 ++++++++++++++-- .github/workflows/hw.yml | 17 ++++++++++++++-- .github/workflows/qemu.yml | 33 +++++++++++++++++++++---------- .github/workflows/tests.yml | 8 -------- .github/workflows/wokwi.yml | 29 +++++++++++++++++++-------- 5 files changed, 74 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build_tests.yml b/.github/workflows/build_tests.yml index a142342748a..17cd3b0a1bc 100644 --- a/.github/workflows/build_tests.yml +++ b/.github/workflows/build_tests.yml @@ -47,11 +47,24 @@ jobs: echo "enabled=$enabled" >> $GITHUB_OUTPUT - - name: Checkout Repository - uses: actions/checkout@v4 + - name: Checkout user repository if: ${{ steps.check-build.outputs.enabled == 'true' }} + uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha || github.sha }} + persist-credentials: false + sparse-checkout-cone-mode: false + sparse-checkout: | + /* + !.github + + # To avoid giving unknown scripts elevated permissions, download them from the master branch + - name: Get CI scripts from master + if: ${{ steps.check-build.outputs.enabled == 'true' }} + run: | + mkdir -p .github + cd .github + curl https://codeload.github.com/${{ github.repository }}/tar.gz/master | tar -xz --strip=2 arduino-esp32-master/.github - name: Get libs cache uses: actions/cache@v4 diff --git a/.github/workflows/hw.yml b/.github/workflows/hw.yml index c55ec9b764d..376c38a6530 100644 --- a/.github/workflows/hw.yml +++ b/.github/workflows/hw.yml @@ -49,15 +49,28 @@ jobs: echo "enabled=$enabled" >> $GITHUB_OUTPUT - - name: Checkout repository + - name: Checkout user repository if: ${{ steps.check-tests.outputs.enabled == 'true' }} uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha || github.sha }} + persist-credentials: false + sparse-checkout-cone-mode: false + sparse-checkout: | + /* + !.github + + # To avoid giving unknown scripts elevated permissions, download them from the master branch + - name: Get CI scripts from master + if: ${{ steps.check-tests.outputs.enabled == 'true' }} + run: | + mkdir -p .github + cd .github + curl https://codeload.github.com/${{ github.repository }}/tar.gz/master | tar -xz --strip=2 arduino-esp32-master/.github # setup-python currently only works on ubuntu images # - uses: actions/setup-python@v5 - # if: steps.check-tests.outputs.enabled == 'true' + # if: ${{ steps.check-tests.outputs.enabled == 'true' }} # with: # cache-dependency-path: tests/requirements.txt # cache: 'pip' diff --git a/.github/workflows/qemu.yml b/.github/workflows/qemu.yml index 629df904126..1b8d4538901 100644 --- a/.github/workflows/qemu.yml +++ b/.github/workflows/qemu.yml @@ -45,35 +45,48 @@ jobs: echo "enabled=$enabled" >> $GITHUB_OUTPUT - - name: Checkout repository + - name: Checkout user repository + if: ${{ steps.check-tests.outputs.enabled == 'true' }} uses: actions/checkout@v4 - if: steps.check-tests.outputs.enabled == 'true' with: ref: ${{ github.event.pull_request.head.sha || github.sha }} + persist-credentials: false + sparse-checkout-cone-mode: false + sparse-checkout: | + /* + !.github + + # To avoid giving unknown scripts elevated permissions, download them from the master branch + - name: Get CI scripts from master + if: ${{ steps.check-tests.outputs.enabled == 'true' }} + run: | + mkdir -p .github + cd .github + curl https://codeload.github.com/${{ github.repository }}/tar.gz/master | tar -xz --strip=2 arduino-esp32-master/.github - uses: actions/setup-python@v5 - if: steps.check-tests.outputs.enabled == 'true' + if: ${{ steps.check-tests.outputs.enabled == 'true' }} with: cache-dependency-path: tests/requirements.txt cache: 'pip' python-version: '3.x' - name: Install Python dependencies - if: steps.check-tests.outputs.enabled == 'true' + if: ${{ steps.check-tests.outputs.enabled == 'true' }} run: | pip install -U pip pip install -r tests/requirements.txt --extra-index-url https://dl.espressif.com/pypi - name: Install APT dependencies uses: awalsh128/cache-apt-pkgs-action@v1.4.2 - if: steps.check-tests.outputs.enabled == 'true' + if: ${{ steps.check-tests.outputs.enabled == 'true' }} with: packages: libpixman-1-0 libnuma1 libglib2.0-0 libslirp0 libsdl2-2.0-0 version: 1.0 - name: Get QEMU version uses: pozetroninc/github-action-get-latest-release@v0.7.0 - if: steps.check-tests.outputs.enabled == 'true' + if: ${{ steps.check-tests.outputs.enabled == 'true' }} id: get-qemu-version with: token: ${{secrets.GITHUB_TOKEN}} @@ -84,14 +97,14 @@ jobs: - name: Cache QEMU id: cache-qemu uses: actions/cache@v4 - if: steps.check-tests.outputs.enabled == 'true' + if: ${{ steps.check-tests.outputs.enabled == 'true' }} with: path: | ~/qemu key: qemu-${{ steps.get-qemu-version.outputs.release }}-${{ hashFiles('.github/workflows/qemu.yml') }} - name: Download QEMU - if: steps.cache-qemu.outputs.cache-hit != 'true' && steps.check-tests.outputs.enabled == 'true' + if: ${{ steps.cache-qemu.outputs.cache-hit != 'true' && steps.check-tests.outputs.enabled == 'true' }} run: | cd ${{ env.QEMU_INSTALL_PATH }} underscore_release=$(echo ${{ steps.get-qemu-version.outputs.release }} | sed 's/\-/_/g') @@ -103,7 +116,7 @@ jobs: echo "QEMU_PATH=${{ env.QEMU_INSTALL_PATH }}/qemu" >> $GITHUB_ENV - name: Get binaries - if: steps.check-tests.outputs.enabled == 'true' + if: ${{ steps.check-tests.outputs.enabled == 'true' }} id: cache-build-binaries uses: actions/cache/restore@v4 with: @@ -115,7 +128,7 @@ jobs: ~/.arduino/tests/**/build*.tmp/*.json - name: Run Tests - if: steps.check-tests.outputs.enabled == 'true' + if: ${{ steps.check-tests.outputs.enabled == 'true' }} run: QEMU_PATH="${{ env.QEMU_INSTALL_PATH }}" bash .github/scripts/tests_run.sh -c -type ${{inputs.type}} -t ${{inputs.chip}} -i 0 -m 1 -Q - name: Upload ${{ inputs.chip }} ${{ inputs.type }} QEMU results as cache diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d853da671be..d5a8e267c5f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,14 +12,6 @@ on: - '!libraries/**.txt' - '!libraries/**.properties' - 'package/**' - - '.github/workflows/tests.yml' - - '.github/workflows/build_tests.yml' - - '.github/workflows/hw.yml' - - '.github/workflows/wokwi.yml' - - '.github/workflows/qemu.yml' - - '.github/scripts/install-*.sh' - - '.github/scripts/tests_*.sh' - - '.github/scripts/sketch_utils.sh' schedule: - cron: '0 2 * * *' diff --git a/.github/workflows/wokwi.yml b/.github/workflows/wokwi.yml index 02f3437896b..8462f47eb12 100644 --- a/.github/workflows/wokwi.yml +++ b/.github/workflows/wokwi.yml @@ -53,35 +53,48 @@ jobs: echo "enabled=$enabled" >> $GITHUB_OUTPUT - - name: Checkout Repository + - name: Checkout user repository + if: ${{ steps.check-tests.outputs.enabled == 'true' }} uses: actions/checkout@v4 - if: steps.check-tests.outputs.enabled == 'true' with: ref: ${{ github.event.pull_request.head.sha || github.sha }} + persist-credentials: false + sparse-checkout-cone-mode: false + sparse-checkout: | + /* + !.github + + # To avoid giving unknown scripts elevated permissions, download them from the master branch + - name: Get CI scripts from master + if: ${{ steps.check-tests.outputs.enabled == 'true' }} + run: | + mkdir -p .github + cd .github + curl https://codeload.github.com/${{ github.repository }}/tar.gz/master | tar -xz --strip=2 arduino-esp32-master/.github - uses: actions/setup-python@v5 - if: steps.check-tests.outputs.enabled == 'true' + if: ${{ steps.check-tests.outputs.enabled == 'true' }} with: cache-dependency-path: tests/requirements.txt cache: 'pip' python-version: '3.x' - name: Install dependencies - if: steps.check-tests.outputs.enabled == 'true' + if: ${{ steps.check-tests.outputs.enabled == 'true' }} run: | pip install -U pip pip install -r tests/requirements.txt --extra-index-url https://dl.espressif.com/pypi - name: Install Wokwi CLI - if: steps.check-tests.outputs.enabled == 'true' + if: ${{ steps.check-tests.outputs.enabled == 'true' }} run: curl -L https://wokwi.com/ci/install.sh | sh - name: Wokwi CI Server - if: steps.check-tests.outputs.enabled == 'true' + if: ${{ steps.check-tests.outputs.enabled == 'true' }} uses: wokwi/wokwi-ci-server-action@v1 - name: Get binaries - if: steps.check-tests.outputs.enabled == 'true' + if: ${{ steps.check-tests.outputs.enabled == 'true' }} id: cache-build-binaries uses: actions/cache/restore@v4 with: @@ -93,7 +106,7 @@ jobs: ~/.arduino/tests/**/build*.tmp/*.json - name: Run Tests - if: steps.check-tests.outputs.enabled == 'true' + if: ${{ steps.check-tests.outputs.enabled == 'true' }} env: WOKWI_CLI_TOKEN: ${{ secrets.WOKWI_CLI_TOKEN }} run: | From 5b1a3a3986bcd2758b2217d5fb313241c4298a1c Mon Sep 17 00:00:00 2001 From: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> Date: Fri, 7 Jun 2024 02:21:01 -0300 Subject: [PATCH 7/9] Revert "fix(get.py): Verify files after extraction and make it more readable" This reverts commit cc40edb40766ea8a013c0d76326bc57314418bff. --- tools/get.py | 37 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/tools/get.py b/tools/get.py index baf31ebd876..68b92e05da7 100755 --- a/tools/get.py +++ b/tools/get.py @@ -107,14 +107,12 @@ def verify_files(filename, destination, rename_to): for i, zipped_file in enumerate(archive.namelist(), 1): local_path = os.path.join(extracted_dir_path, zipped_file.replace(first_dir, rename_to, 1)) if not os.path.exists(local_path): - if verbose: - print(f"\nMissing {zipped_file} on location: {extracted_dir_path}") - print(f"Verification failed; aborted in {format_time(time.time() - t1)}") + print(f"\nMissing {zipped_file} on location: {extracted_dir_path}") + print(f"Verification failed; aborted in {format_time(time.time() - t1)}") return False print_verification_progress(total_files, i, t1) except zipfile.BadZipFile: - if verbose: - print(f"Verification failed; aborted in {format_time(time.time() - t1)}") + print(f"Verification failed; aborted in {format_time(time.time() - t1)}") return False elif filename.endswith(".tar.gz"): try: @@ -124,14 +122,12 @@ def verify_files(filename, destination, rename_to): for i, zipped_file in enumerate(archive.getnames(), 1): local_path = os.path.join(extracted_dir_path, zipped_file.replace(first_dir, rename_to, 1)) if not os.path.exists(local_path): - if verbose: - print(f"\nMissing {zipped_file} on location: {extracted_dir_path}") - print(f"Verification failed; aborted in {format_time(time.time() - t1)}") + print(f"\nMissing {zipped_file} on location: {extracted_dir_path}") + print(f"Verification failed; aborted in {format_time(time.time() - t1)}") return False print_verification_progress(total_files, i, t1) except tarfile.ReadError: - if verbose: - print(f"Verification failed; aborted in {format_time(time.time() - t1)}") + print(f"Verification failed; aborted in {format_time(time.time() - t1)}") return False elif filename.endswith(".tar.xz"): try: @@ -141,14 +137,12 @@ def verify_files(filename, destination, rename_to): for i, zipped_file in enumerate(archive.getnames(), 1): local_path = os.path.join(extracted_dir_path, zipped_file.replace(first_dir, rename_to, 1)) if not os.path.exists(local_path): - if verbose: - print(f"\nMissing {zipped_file} on location: {extracted_dir_path}") - print(f"Verification failed; aborted in {format_time(time.time() - t1)}") + print(f"\nMissing {zipped_file} on location: {extracted_dir_path}") + print(f"Verification failed; aborted in {format_time(time.time() - t1)}") return False print_verification_progress(total_files, i, t1) except tarfile.ReadError: - if verbose: - print(f"Verification failed; aborted in {format_time(time.time() - t1)}") + print(f"Verification failed; aborted in {format_time(time.time() - t1)}") return False else: raise NotImplementedError("Unsupported archive type") @@ -237,12 +231,7 @@ def unpack(filename, destination, force_extract): # noqa: C901 shutil.rmtree(rename_to) shutil.move(dirname, rename_to) - if verify_files(filename, destination, rename_to): - print(" Files extracted successfully.") - return True - else: - print(" Failed to extract files.") - return False + return True def download_file_with_progress(url, filename, start_time): @@ -302,7 +291,6 @@ def get_tool(tool, force_download, force_extract): local_path = dist_dir + archive_name url = tool["url"] start_time = time.time() - print("") if not os.path.isfile(local_path) or force_download: if verbose: print("Downloading '" + archive_name + "' to '" + local_path + "'") @@ -433,9 +421,6 @@ def identify_platform(): current_dir + "/../package/package_esp32_index.template.json", identified_platform ) mkdir_p(dist_dir) - - print("\nDownloading and extracting tools...") - for tool in tools_to_download: if is_test: print("Would install: {0}".format(tool["archiveFileName"])) @@ -447,4 +432,4 @@ def identify_platform(): print(f"Tool {tool['archiveFileName']} was corrupted, but re-downloading did not help!\n") sys.exit(1) - print("\nPlatform Tools Installed") + print("Platform Tools Installed") From 7734f18a586a569e5eb041bc99d11eda6ea5265a Mon Sep 17 00:00:00 2001 From: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> Date: Fri, 7 Jun 2024 11:14:54 -0300 Subject: [PATCH 8/9] ci(compilation): Fix changed files check --- .github/workflows/push.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index bf45b6fbe4c..05fd1a8a2b8 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -138,9 +138,6 @@ jobs: fi echo "" done - else - echo "Unhandled change triggered the build. This should not happen." - exit 1 fi if [[ -n $sketches ]]; then @@ -185,6 +182,7 @@ jobs: # Ubuntu build-arduino-linux: name: Arduino ${{ matrix.chunk }} on ubuntu-latest + if: ${{ needs.gen-chunks.outputs.build_all == 'true' || needs.gen-chunks.outputs.build_libraries == 'true' }} needs: gen-chunks runs-on: ubuntu-latest strategy: From af14982a65f41ff163d7c1fc982188484b40dd54 Mon Sep 17 00:00:00 2001 From: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> Date: Fri, 7 Jun 2024 11:41:06 -0300 Subject: [PATCH 9/9] ci(wokwi): Disable tests that use scenarios --- .github/scripts/tests_run.sh | 3 ++- tests/validation/gpio/ci.json | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/scripts/tests_run.sh b/.github/scripts/tests_run.sh index 43ac41e2d4d..bb90373b56c 100755 --- a/.github/scripts/tests_run.sh +++ b/.github/scripts/tests_run.sh @@ -101,7 +101,7 @@ function run_test() { fi fi done - printf "\n" + printf "Test return code: $error\n" return $error } @@ -250,6 +250,7 @@ else exit_code=0 run_test $target $sketch $options $erase || exit_code=$? + echo "Sketch $sketch exit code: $exit_code" if [ $exit_code -ne 0 ]; then error=$exit_code fi diff --git a/tests/validation/gpio/ci.json b/tests/validation/gpio/ci.json index 8e24ae58e5a..13a4b8c1a31 100644 --- a/tests/validation/gpio/ci.json +++ b/tests/validation/gpio/ci.json @@ -1,6 +1,7 @@ { "platforms": { "qemu": false, - "hardware": false + "hardware": false, + "wokwi": false } }