forked from pytorch/executorch
-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (124 loc) · 4.85 KB
/
Copy pathbuild-cmsis-pack.yml
File metadata and controls
137 lines (124 loc) · 4.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# 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 }}