Build CMSIS Pack #3
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
| # Copyright 2026 Arm Limited and/or its affiliates. | |
| # | |
| # This source code is licensed under the BSD-style license found in the | |
| # LICENSE file in the root directory of this source tree. | |
| name: Build CMSIS Pack | |
| on: | |
| schedule: | |
| # Nightly at 03:00 UTC, staggered after nightly.yml (02:00) so the | |
| # shared runner pool isn't hit by both at the same minute. | |
| - cron: 0 3 * * * | |
| release: | |
| # Build (and, for non-prerelease, publish) the pack when a GitHub | |
| # Release is created. The tag the release points at drives the pack | |
| # version via GITHUB_REF below. | |
| types: [published] | |
| push: | |
| branches: | |
| - main | |
| - release/* | |
| paths: | |
| - .github/workflows/build-cmsis-pack.yml | |
| - backends/arm/cmsis_pack/** | |
| - backends/arm/cmsis_pack/scripts/** | |
| - backends/arm/runtime/** | |
| - backends/cortex_m/** | |
| - kernels/portable/** | |
| - kernels/quantized/** | |
| - runtime/** | |
| - schema/** | |
| pull_request: | |
| paths: | |
| - .github/workflows/build-cmsis-pack.yml | |
| - backends/arm/cmsis_pack/** | |
| - backends/arm/cmsis_pack/scripts/** | |
| workflow_dispatch: | |
| inputs: | |
| version_override: | |
| description: 'Override pack version (e.g., 1.2.0). Leave empty to derive from version.txt' | |
| required: false | |
| type: string | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-cmsis-pack: | |
| name: build-cmsis-pack | |
| uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main | |
| permissions: | |
| id-token: write | |
| contents: read | |
| with: | |
| runner: linux.2xlarge | |
| docker-image: ci-image:executorch-ubuntu-22.04-arm-sdk | |
| submodules: 'recursive' | |
| ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} | |
| timeout: 60 | |
| upload-artifact: cmsis-pack-artifact | |
| script: | | |
| set -eux | |
| echo "::group::Setup environment" | |
| # The generic Linux job chooses to use base env, not the one setup by the image | |
| CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]") | |
| conda activate "${CONDA_ENV}" | |
| source .ci/scripts/utils.sh | |
| install_executorch "--use-pt-pinned-commit" | |
| echo "::endgroup::" | |
| echo "::group::Install ARM toolchain" | |
| .ci/scripts/setup-arm-baremetal-tools.sh | |
| source examples/arm/arm-scratch/setup_path.sh | |
| echo "::endgroup::" | |
| echo "::group::Cross-compile ExecuTorch for Cortex-M" | |
| # Stage 1: Build core ExecuTorch with arm-none-eabi-gcc | |
| # This generates required headers (flatbuffers, schema) | |
| backends/arm/scripts/build_executorch.sh | |
| CMAKE_BUILD_DIR="$(pwd)/cmake-out-arm" | |
| echo "::endgroup::" | |
| echo "::group::Determine pack version" | |
| # Derive version from tag, input override, schedule (nightly), or version.txt | |
| BASE_VER="$(cat version.txt | sed 's/a0$//')" | |
| if [[ -n "${{ inputs.version_override || '' }}" ]]; then | |
| PACK_VERSION="${{ inputs.version_override }}" | |
| elif [[ "${GITHUB_REF}" == refs/tags/v* ]]; then | |
| # Strip leading 'v' and any -rc suffix for release tags | |
| PACK_VERSION="${GITHUB_REF#refs/tags/v}" | |
| elif [[ "${{ github.event_name }}" == "schedule" ]]; then | |
| PACK_VERSION="${BASE_VER}-nightly-$(date -u +%Y%m%d)" | |
| else | |
| PACK_VERSION="${BASE_VER}-dev" | |
| fi | |
| echo "Pack version: ${PACK_VERSION}" | |
| echo "::endgroup::" | |
| echo "::group::Build CMSIS Pack" | |
| backends/arm/cmsis_pack/scripts/build_pack.sh \ | |
| --executorch-root "$(pwd)" \ | |
| --build-dir "${CMAKE_BUILD_DIR}" \ | |
| --version "${PACK_VERSION}" \ | |
| --output-dir "$(pwd)/artifacts-to-be-uploaded" | |
| echo "::endgroup::" | |
| # Structural validation and consumer-build smoke are intentionally | |
| # not run in CI yet. See: | |
| # backends/arm/cmsis_pack/test/validate_pack.py (structural) | |
| # backends/arm/cmsis_pack/test/smoke/run.sh (cbuild via | |
| # AVH-MLOps) | |
| # for the local test drivers. | |
| # Attach the pack to the GitHub Release when a non-prerelease release is | |
| # published. Prereleases still build + validate via the release trigger | |
| # but are not published. | |
| publish-cmsis-pack: | |
| if: github.event_name == 'release' && !github.event.release.prerelease | |
| needs: build-cmsis-pack | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download pack artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: cmsis-pack-artifact | |
| path: pack-output | |
| - name: Upload to GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: pack-output/*.pack | |
| tag_name: ${{ github.ref_name }} |