move it to main for testing #12922
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Compilation Tests | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| log_level: | |
| description: "Log level" | |
| default: "none" | |
| type: "choice" | |
| required: true | |
| options: | |
| - "none" | |
| - "error" | |
| - "warn" | |
| - "info" | |
| - "debug" | |
| - "verbose" | |
| schedule: | |
| # Every Sunday at 2:00 UTC run a build with verbose log level | |
| - cron: "0 2 * * SUN" | |
| push: | |
| branches: | |
| - master | |
| - release/* | |
| - wokwi-embed-launchpad | |
| pull_request: | |
| paths: | |
| - "cores/**" | |
| - "libraries/**/*.cpp" | |
| - "libraries/**/*.c" | |
| - "libraries/**/*.h" | |
| - "libraries/**/*.ino" | |
| - "libraries/**/ci.json" | |
| - "package/**" | |
| - "tools/get.*" | |
| - "platform.txt" | |
| - "programmers.txt" | |
| - "package.json" | |
| - ".github/workflows/push.yml" | |
| - ".github/scripts/install-*" | |
| - ".github/scripts/on-push.sh" | |
| - ".github/scripts/sketch_utils.sh" | |
| - ".github/scripts/get_affected.py" | |
| - "variants/esp32/**" | |
| - "variants/esp32c3/**" | |
| - "variants/esp32c5/**" | |
| - "variants/esp32c6/**" | |
| - "variants/esp32h2/**" | |
| - "variants/esp32p4/**" | |
| - "variants/esp32s2/**" | |
| - "variants/esp32s3/**" | |
| - "!*.md" | |
| - "!*.txt" | |
| - "!*.properties" | |
| concurrency: | |
| group: build-${{github.event.pull_request.number || github.ref}} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| pull-requests: read | |
| pages: write | |
| env: | |
| MAX_CHUNKS: 15 | |
| jobs: | |
| gen-chunks: | |
| name: Generate chunks | |
| runs-on: ubuntu-latest | |
| if: ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'release/')) }} | |
| outputs: | |
| should_build: ${{ steps.set-chunks.outputs.should_build }} | |
| recompile_preset: ${{ steps.set-chunks.outputs.recompile_preset }} | |
| chunk_count: ${{ steps.set-chunks.outputs.chunk_count }} | |
| chunks: ${{ steps.set-chunks.outputs.chunks }} | |
| steps: | |
| - name: Install universal-ctags | |
| uses: awalsh128/cache-apt-pkgs-action@2c09a5e66da6c8016428a2172bd76e5e4f14bb17 # v1.5.3 | |
| with: | |
| packages: libicu74 libjansson4 libxml2 libyaml-0-2 universal-ctags | |
| version: 1 | |
| execute_install_scripts: true | |
| - name: Checkout repository | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 2 | |
| - name: Get changed files | |
| id: changed-files | |
| uses: tj-actions/changed-files@2f7c5bfce28377bc069a65ba478de0a74aa0ca32 # v46.0.1 | |
| - name: Set chunks | |
| id: set-chunks | |
| env: | |
| IS_PR: ${{ github.event_name == 'pull_request' }} | |
| MAX_CHUNKS: ${{ env.MAX_CHUNKS }} | |
| run: | | |
| (which ctags-universal || which ctags) || (echo "Error: Neither ctags-universal nor ctags found in PATH" && exit 1) | |
| python3 ./.github/scripts/get_affected.py --debug ${{ steps.changed-files.outputs.all_changed_files }} > affected_sketches.txt | |
| - name: Upload affected sketches | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: affected_sketches | |
| path: affected_sketches.txt | |
| if-no-files-found: error | |
| - name: Upload debug artifacts | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: get_affected_debug | |
| path: | | |
| ctags_defs_by_qname.json | |
| ctags_header_to_qnames.json | |
| ctags_tags.jsonl | |
| dependencies.json | |
| dependencies_reverse.json | |
| if-no-files-found: warn | |
| # Ubuntu | |
| build-arduino-linux: | |
| name: Arduino ${{ matrix.chunk }} on ubuntu-latest | |
| if: ${{ needs.gen-chunks.outputs.should_build == '1' }} | |
| needs: gen-chunks | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| chunk: ${{ fromJson(needs.gen-chunks.outputs.chunks) }} | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.0.4 | |
| with: | |
| python-version: "3.x" | |
| - name: Get libs cache | |
| uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 | |
| with: | |
| key: libs-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package/package_esp32_index.template.json', 'tools/get.py') }} | |
| path: | | |
| ./tools/dist | |
| ./tools/esp32-arduino-libs | |
| ./tools/esptool | |
| ./tools/mk* | |
| ./tools/openocd-esp32 | |
| ./tools/riscv32-* | |
| ./tools/xtensa-* | |
| - name: Set Log Level | |
| run: | | |
| if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
| echo "LOG_LEVEL=${{ github.event.inputs.log_level }}" >> $GITHUB_ENV | |
| elif [ "${{ github.event_name }}" == "schedule" ]; then | |
| echo "LOG_LEVEL=verbose" >> $GITHUB_ENV | |
| else | |
| echo "LOG_LEVEL=none" >> $GITHUB_ENV | |
| fi | |
| - name: Download affected sketches | |
| uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1 | |
| with: | |
| name: affected_sketches | |
| - name: Build selected sketches | |
| run: bash ./.github/scripts/on-push.sh ${{ matrix.chunk }} ${{ needs.gen-chunks.outputs.chunk_count }} 1 ${{ env.LOG_LEVEL }} affected_sketches.txt | |
| - name: Collect compiled binaries | |
| run: | | |
| mkdir -p compiled_binaries | |
| # Find and copy all compiled binaries (*.bin, *.elf files) | |
| find . -name "*.bin" -o -name "*.elf" | grep -E "(build|target)" | while read file; do | |
| # Create relative path structure in compiled_binaries | |
| rel_path=$(echo "$file" | sed 's|^\./||') | |
| target_dir="compiled_binaries/$(dirname "$rel_path")" | |
| mkdir -p "$target_dir" | |
| cp "$file" "$target_dir/" | |
| done | |
| - name: Upload compiled binaries as artifact | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: compiled-binaries-${{ matrix.chunk }} | |
| path: compiled_binaries | |
| retention-days: 1 | |
| #Upload cli compile json as artifact | |
| - name: Upload cli compile json | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: pr_cli_compile_${{ matrix.chunk }} | |
| path: cli_compile_${{ matrix.chunk }}.json | |
| overwrite: true | |
| # Consolidate compiled binaries from all chunks | |
| consolidate-binaries: | |
| name: Consolidate compiled binaries | |
| needs: [gen-chunks, build-arduino-linux] | |
| if: ${{ needs.gen-chunks.outputs.should_build == '1' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download all binary artifacts | |
| uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1 | |
| with: | |
| pattern: compiled-binaries-* | |
| merge-multiple: true | |
| path: all_binaries | |
| - name: List consolidated binaries | |
| run: | | |
| echo "Consolidating binaries from all chunks..." | |
| echo "Downloaded artifacts:" | |
| find all_binaries -type f -name "*.bin" -o -name "*.elf" | head -20 || echo "No binaries found in artifacts" | |
| echo "Total binary files: $(find all_binaries -type f \( -name "*.bin" -o -name "*.elf" \) | wc -l)" | |
| - name: Create consolidated binary cache | |
| uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 | |
| with: | |
| key: compiled-binaries-consolidated-${{ github.sha }} | |
| path: all_binaries | |
| - name: Upload consolidated binaries | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: compiled-binaries-consolidated | |
| path: all_binaries | |
| retention-days: 7 | |
| # Windows and MacOS | |
| build-arduino-win-mac: | |
| name: Arduino on ${{ matrix.os }} | |
| needs: gen-chunks | |
| if: ${{ needs.gen-chunks.outputs.recompile_preset == '1' }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [windows-latest, macOS-latest] | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.0.4 | |
| with: | |
| python-version: "3.x" | |
| - name: Build Sketches | |
| run: bash ./.github/scripts/on-push.sh | |
| # Save artifacts to gh-pages | |
| save-master-artifacts: | |
| name: Save master artifacts | |
| needs: build-arduino-linux | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Check out repository | |
| - name: Checkout repository | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| token: ${{secrets.GITHUB_TOKEN}} | |
| fetch-depth: "0" | |
| - name: Switch branch | |
| run: git checkout remotes/origin/gh-pages | |
| - name: Download sketches reports artifact | |
| uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1 | |
| with: | |
| pattern: pr_cli_compile_* | |
| merge-multiple: true | |
| path: master_cli_compile | |
| - name: List files in the directory | |
| run: ls -R | |
| - name: Commit json files to gh-pages if on master | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| continue-on-error: true | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add --all | |
| git commit -m "Updated cli compile json files" | |
| git push origin HEAD:gh-pages | |
| #Upload PR number as artifact | |
| upload-pr-number: | |
| name: Upload PR number | |
| if: ${{ github.event_name == 'pull_request' && !startsWith(github.head_ref, 'release/') }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Save the PR number in an artifact | |
| shell: bash | |
| env: | |
| PR_NUM: ${{ github.event.number }} | |
| run: echo $PR_NUM > pr_num.txt | |
| - name: Upload PR number | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: pr_number | |
| path: ./pr_num.txt | |
| overwrite: true |