ci(component): Enable ESP32-C5 for component testing #154
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: Arduino as ESP-IDF Component | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| idf_ver: | |
| description: "IDF Versions" | |
| default: "release-v5.3,release-v5.4,release-v5.5" | |
| type: "string" | |
| required: true | |
| idf_targets: | |
| description: "IDF Targets" | |
| default: "esp32,esp32s2,esp32s3,esp32c2,esp32c3,esp32c6,esp32h2,esp32p4" | |
| type: "string" | |
| required: false | |
| push: | |
| branches: | |
| - master | |
| - release/* | |
| pull_request: | |
| paths: | |
| - "cores/**" | |
| - "libraries/**/*.cpp" | |
| - "libraries/**/*.c" | |
| - "libraries/**/*.h" | |
| - "libraries/**/*.ino" | |
| - "libraries/**/ci.json" | |
| - "idf_component_examples/**" | |
| - "idf_component.yml" | |
| - "Kconfig.projbuild" | |
| - "CMakeLists.txt" | |
| - ".github/workflows/build_component.yml" | |
| - ".github/scripts/check-cmakelists.sh" | |
| - ".github/scripts/on-push-idf.sh" | |
| - ".github/scripts/sketch_utils.sh" | |
| - "variants/esp32/**" | |
| - "variants/esp32c2/**" | |
| - "variants/esp32c3/**" | |
| - "variants/esp32c6/**" | |
| - "variants/esp32h2/**" | |
| - "variants/esp32p4/**" | |
| - "variants/esp32s2/**" | |
| - "variants/esp32s3/**" | |
| - "!*.md" | |
| - "!*.txt" | |
| - "!*.properties" | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: build-component-${{github.event.pull_request.number || github.ref}} | |
| cancel-in-progress: true | |
| jobs: | |
| cmake-check: | |
| name: Check CMakeLists | |
| runs-on: ubuntu-latest | |
| if: ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'release/')) }} | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - run: bash ./.github/scripts/check-cmakelists.sh | |
| set-matrix: | |
| name: Set Matrix | |
| runs-on: ubuntu-latest | |
| if: ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'release/')) }} | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| steps: | |
| - name: Get Matrix Combinations | |
| id: set-matrix | |
| run: | | |
| # Define version-specific target configurations | |
| get_targets_for_version() { | |
| case "$1" in | |
| "release-v5.3") | |
| echo "esp32,esp32s2,esp32s3,esp32c2,esp32c3,esp32c6,esp32h2,esp32p4" | |
| ;; | |
| "release-v5.4") | |
| echo "esp32,esp32s2,esp32s3,esp32c2,esp32c3,esp32c6,esp32h2,esp32p4" | |
| ;; | |
| "release-v5.5") | |
| echo "esp32,esp32s2,esp32s3,esp32c2,esp32c3,esp32c5,esp32c6,esp32h2,esp32p4" | |
| ;; | |
| *) | |
| echo "" | |
| ;; | |
| esac | |
| } | |
| # Default versions if not provided via inputs | |
| DEFAULT_VERSIONS="release-v5.3,release-v5.4,release-v5.5" | |
| # Use inputs if provided, otherwise use defaults | |
| if [[ -n "${{ inputs.idf_ver }}" ]]; then | |
| VERSIONS="${{ inputs.idf_ver }}" | |
| else | |
| VERSIONS="$DEFAULT_VERSIONS" | |
| fi | |
| # Generate matrix combinations | |
| echo '{"include": [' > matrix.json | |
| first=true | |
| IFS=',' read -ra VERSION_ARRAY <<< "$VERSIONS" | |
| for version in "${VERSION_ARRAY[@]}"; do | |
| # Trim whitespace | |
| version=$(echo "$version" | xargs) | |
| # Get targets for this version | |
| if [[ -n "${{ inputs.idf_targets }}" ]]; then | |
| # Use provided targets for all versions | |
| targets="${{ inputs.idf_targets }}" | |
| else | |
| # Use version-specific targets | |
| targets=$(get_targets_for_version "$version") | |
| fi | |
| if [[ -n "$targets" ]]; then | |
| IFS=',' read -ra TARGET_ARRAY <<< "$targets" | |
| for target in "${TARGET_ARRAY[@]}"; do | |
| # Trim whitespace | |
| target=$(echo "$target" | xargs) | |
| if [ "$first" = true ]; then | |
| first=false | |
| else | |
| echo ',' >> matrix.json | |
| fi | |
| echo "{\"idf_ver\": \"$version\", \"idf_target\": \"$target\"}" >> matrix.json | |
| done | |
| fi | |
| done | |
| echo ']}' >> matrix.json | |
| # Debug: Print the matrix for verification | |
| echo "Debug - Generated matrix:" | |
| cat matrix.json | jq . | |
| # Set output | |
| printf "matrix=%s\n" "$(cat matrix.json | jq -c .)" >> $GITHUB_OUTPUT | |
| build-esp-idf-component: | |
| name: Build IDF ${{ matrix.idf_ver }} for ${{ matrix.idf_target }} | |
| runs-on: ubuntu-latest | |
| needs: set-matrix | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJson(needs.set-matrix.outputs.matrix) }} | |
| container: espressif/idf:${{ matrix.idf_ver }} | |
| steps: | |
| - name: Check out arduino-esp32 as a component | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| submodules: recursive | |
| path: components/arduino-esp32 | |
| # Need to install jq in the container to be able to use it in the script | |
| - name: Setup jq | |
| uses: dcarbone/install-jq-action@e397bd87438d72198f81efd21f876461183d383a # v3.0.1 | |
| - name: Build | |
| env: | |
| IDF_TARGET: ${{ matrix.idf_target }} | |
| shell: bash | |
| run: | | |
| chmod a+x ./components/arduino-esp32/.github/scripts/* | |
| ./components/arduino-esp32/.github/scripts/on-push-idf.sh | |
| - name: Upload generated sdkconfig files for debugging | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| if: always() | |
| with: | |
| name: sdkconfig-${{ matrix.idf_ver }}-${{ matrix.idf_target }} | |
| path: ./components/arduino-esp32/idf_component_examples/**/sdkconfig |