|
1 | 1 | name: Publish ESP-IDF component |
2 | 2 |
|
3 | 3 | # Publishes pytorch/executorch to the ESP Component Registry: RC tags to the |
4 | | -# staging registry, release tags to staging and then production. The archive |
| 4 | +# staging registry, release tags to staging and then production, and on demand |
| 5 | +# a dev version of a nightly branch commit for early adopters. The archive |
5 | 6 | # is built and tested on the ESP-IDF releases the component supports before |
6 | 7 | # any upload, and each upload is followed by a consumer build that resolves |
7 | 8 | # the version from that registry. See the release runbook in |
|
14 | 15 | workflow_dispatch: |
15 | 16 | inputs: |
16 | 17 | version_suffix: |
17 | | - description: 'Version suffix: empty at a release tag, -rc.N at an RC tag, ~N for a packaging respin on release/X.Y' |
| 18 | + description: 'Version suffix: empty at a release tag, -rc.N at an RC tag, ~N for a packaging respin on release/X.Y, -dev for the dev version of the nightly branch' |
18 | 19 | type: string |
19 | 20 | default: '' |
20 | 21 | registry: |
|
33 | 34 | - .github/workflows/publish-esp-idf.yml |
34 | 35 | - .ci/scripts/upload_espressif_idf_component.sh |
35 | 36 | - .ci/scripts/espressif_idf_upload_requirements.txt |
| 37 | + - .ci/scripts/test_espressif_idf_nightly.sh |
36 | 38 |
|
37 | 39 | # Runs for one tag or branch go one at a time; runs for different ones, such as |
38 | 40 | # an RC awaiting approval and its release, do not hold each other up. |
|
59 | 61 | shell: bash |
60 | 62 | env: |
61 | 63 | EVENT: ${{ github.event_name }} |
| 64 | + REF: ${{ github.ref }} |
62 | 65 | REF_NAME: ${{ github.ref_name }} |
63 | 66 | VERSION_SUFFIX: ${{ inputs.version_suffix }} |
64 | 67 | REGISTRY: ${{ inputs.registry }} |
|
79 | 82 | fi |
80 | 83 | ;; |
81 | 84 | workflow_dispatch) |
82 | | - if [[ ! "${VERSION_SUFFIX}" =~ ^(-rc\.[1-9][0-9]*|~[1-9][0-9]*)?$ ]]; then |
83 | | - echo "::error::version_suffix must be empty, -rc.N or ~N, not '${VERSION_SUFFIX}'." |
| 85 | + if [[ ! "${VERSION_SUFFIX}" =~ ^(-rc\.[1-9][0-9]*|~[1-9][0-9]*|-dev)?$ ]]; then |
| 86 | + echo "::error::version_suffix must be empty, -rc.N, ~N or -dev, not '${VERSION_SUFFIX}'." |
| 87 | + exit 1 |
| 88 | + fi |
| 89 | + # A dev version's users install the nightly wheel of its commit. |
| 90 | + if [[ "${VERSION_SUFFIX}" == -dev && "${REF}" != refs/heads/nightly ]]; then |
| 91 | + echo "::error::a dev version is published from the nightly branch, not ${REF}." |
84 | 92 | exit 1 |
85 | 93 | fi |
86 | 94 | if [[ "${VERSION_SUFFIX}" == -rc.* && "${REGISTRY}" == production ]]; then |
@@ -133,22 +141,45 @@ jobs: |
133 | 141 | set -euo pipefail |
134 | 142 | CONDA_ENV=$(conda env list --json | jq -r '.envs | .[-1]') |
135 | 143 | conda activate "${CONDA_ENV}" |
| 144 | + nightly=.ci/scripts/test_espressif_idf_nightly.sh |
| 145 | + suffix="${{ needs.plan.outputs.suffix }}" |
| 146 | + # A tag names its version; a dispatch appends its suffix to version.txt. |
| 147 | + expected="${{ needs.plan.outputs.version }}" |
| 148 | + expected="${expected:-$(cat version.txt)${suffix}}" |
| 149 | + # Before the build: a dev version's users install the nightly wheels of |
| 150 | + # its commit. |
| 151 | + if [[ "${suffix}" == -dev ]]; then |
| 152 | + expected=$(bash examples/espressif/build_idf_component.sh --version --version-suffix -dev) |
| 153 | + bash "${nightly}" wheel "${RUNNER_ARTIFACT_DIR}" "${expected}" "$(git rev-parse HEAD)" |
| 154 | + fi |
| 155 | + if [[ "${{ needs.plan.outputs.rehearsal }}" == true ]]; then |
| 156 | + # A pull request rehearses the dev wheel check on the last finished |
| 157 | + # days' nightlies, one of which must pass, since a day's wheels can |
| 158 | + # fail to build. |
| 159 | + checked=false |
| 160 | + for commit in $(git rev-list --first-parent --max-count=4 origin/nightly); do |
| 161 | + day=$(TZ=UTC git log -1 --format=%cd --date=format-local:%Y%m%d "${commit}") |
| 162 | + if [[ "${day}" != "$(date -u +%Y%m%d)" ]] && bash "${nightly}" wheel \ |
| 163 | + "${RUNNER_ARTIFACT_DIR}" "$(git show "${commit}:version.txt")-dev.${day}" "${commit}"; then |
| 164 | + checked=true |
| 165 | + break |
| 166 | + fi |
| 167 | + done |
| 168 | + [[ "${checked}" == true ]] |
| 169 | + fi |
136 | 170 | source .ci/scripts/utils.sh |
137 | 171 | install_executorch --use-pt-pinned-commit --minimal |
138 | 172 | if [[ "${{ needs.plan.outputs.rehearsal }}" == true ]]; then |
139 | 173 | # A pull request rehearses the release stamp at a throwaway local tag. |
140 | 174 | git tag -f "v$(cat version.txt)" |
141 | 175 | fi |
142 | | - # A tag names its version; a dispatch appends its suffix to version.txt. |
143 | | - expected="${{ needs.plan.outputs.version }}" |
144 | | - expected="${expected:-$(cat version.txt)${{ needs.plan.outputs.suffix }}}" |
145 | | - bash .ci/scripts/test_espressif_idf_nightly.sh prepare "${RUNNER_ARTIFACT_DIR}" \ |
146 | | - --version-suffix "${{ needs.plan.outputs.suffix }}" |
| 176 | + bash "${nightly}" prepare "${RUNNER_ARTIFACT_DIR}" --version-suffix "${suffix}" |
147 | 177 | version=$(cat "${RUNNER_ARTIFACT_DIR}/version") |
148 | 178 | if [[ "${version}" != "${expected}" ]]; then |
149 | 179 | echo "FAIL: generated version ${version}, expected ${expected}" >&2 |
150 | 180 | exit 1 |
151 | 181 | fi |
| 182 | + bash "${nightly}" torch "${RUNNER_ARTIFACT_DIR}" |
152 | 183 | echo "Packed pytorch/executorch ${version}" |
153 | 184 | # Nothing downstream reads the unpacked component. |
154 | 185 | rm -r "${RUNNER_ARTIFACT_DIR}/component" |
|
0 commit comments