|
1 | | -# This file defines our primary CI workflow that runs on pull requests |
2 | | -# and also on pushes to special branches (auto, try). |
3 | | -# |
4 | | -# The actual definition of the executed jobs is calculated by a Python |
5 | | -# script located at src/ci/github-actions/calculate-job-matrix.py, which |
6 | | -# uses job definition data from src/ci/github-actions/jobs.yml. |
7 | | -# You should primarily modify the `jobs.yml` file if you want to modify |
8 | | -# what jobs are executed in CI. |
9 | | - |
10 | 1 | name: CI |
11 | | -on: |
12 | | - push: |
13 | | - branches: |
14 | | - - auto |
15 | | - - try |
16 | | - - try-perf |
17 | | - - automation/bors/try |
18 | | - pull_request: |
19 | | - branches: |
20 | | - - "**" |
21 | | - |
22 | | -permissions: |
23 | | - contents: read |
24 | | - packages: write |
25 | 2 |
|
26 | | -defaults: |
27 | | - run: |
28 | | - # On Linux, macOS, and Windows, use the system-provided bash as the default |
29 | | - # shell. (This should only make a difference on Windows, where the default |
30 | | - # shell is PowerShell.) |
31 | | - shell: bash |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + workflow_dispatch: |
32 | 6 |
|
33 | | -concurrency: |
34 | | - # For a given workflow, if we push to the same branch, cancel all previous builds on that branch. |
35 | | - # We add an exception for try builds (try branch) and unrolled rollup builds (try-perf), which |
36 | | - # are all triggered on the same branch, but which should be able to run concurrently. |
37 | | - group: ${{ github.workflow }}-${{ ((github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.sha) || github.ref }} |
38 | | - cancel-in-progress: true |
39 | | -env: |
40 | | - TOOLSTATE_REPO: "https://github.com/rust-lang-nursery/rust-toolstate" |
41 | | - # This will be empty in PR jobs. |
42 | | - TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }} |
43 | 7 | jobs: |
44 | | - # The job matrix for `calculate_matrix` is defined in src/ci/github-actions/jobs.yml. |
45 | | - # It calculates which jobs should be executed, based on the data of the ${{ github }} context. |
46 | | - # If you want to modify CI jobs, take a look at src/ci/github-actions/jobs.yml. |
47 | | - calculate_matrix: |
48 | | - name: Calculate job matrix |
49 | | - runs-on: ubuntu-24.04 |
50 | | - outputs: |
51 | | - jobs: ${{ steps.jobs.outputs.jobs }} |
52 | | - run_type: ${{ steps.jobs.outputs.run_type }} |
53 | | - steps: |
54 | | - - name: Checkout the source code |
55 | | - uses: actions/checkout@v4 |
56 | | - - name: Calculate the CI job matrix |
57 | | - env: |
58 | | - COMMIT_MESSAGE: ${{ github.event.head_commit.message }} |
59 | | - run: python3 src/ci/github-actions/calculate-job-matrix.py >> $GITHUB_OUTPUT |
60 | | - id: jobs |
61 | | - job: |
62 | | - name: ${{ matrix.name }} |
63 | | - needs: [ calculate_matrix ] |
64 | | - runs-on: "${{ matrix.os }}" |
65 | | - defaults: |
66 | | - run: |
67 | | - shell: ${{ contains(matrix.os, 'windows') && 'msys2 {0}' || 'bash' }} |
68 | | - timeout-minutes: 360 |
69 | | - env: |
70 | | - CI_JOB_NAME: ${{ matrix.image }} |
71 | | - CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse |
72 | | - # commit of PR sha or commit sha. `GITHUB_SHA` is not accurate for PRs. |
73 | | - HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }} |
74 | | - DOCKER_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
75 | | - SCCACHE_BUCKET: rust-lang-ci-sccache2 |
76 | | - CACHE_DOMAIN: ci-caches.rust-lang.org |
77 | | - continue-on-error: ${{ matrix.continue_on_error || false }} |
| 8 | + build-buildjet: |
78 | 9 | strategy: |
| 10 | + fail-fast: false |
79 | 11 | matrix: |
80 | | - # Check the `calculate_matrix` job to see how is the matrix defined. |
81 | | - include: ${{ fromJSON(needs.calculate_matrix.outputs.jobs) }} |
| 12 | + include: |
| 13 | + - os: macos-14 |
| 14 | + triple: aarch64-apple-darwin |
| 15 | + - os: macos-13 |
| 16 | + triple: x86_64-apple-darwin |
| 17 | + - os: buildjet-32vcpu-ubuntu-2004 |
| 18 | + triple: x86_64-unknown-linux-gnu |
| 19 | + runs-on: ${{ matrix.os }} |
82 | 20 | steps: |
83 | | - - if: contains(matrix.os, 'windows') |
84 | | - |
| 21 | + - name: Install Rust |
| 22 | + uses: actions-rs/toolchain@v1 |
85 | 23 | with: |
86 | | - # i686 jobs use mingw32. x86_64 and cross-compile jobs use mingw64. |
87 | | - msystem: ${{ contains(matrix.name, 'i686') && 'mingw32' || 'mingw64' }} |
88 | | - # don't try to download updates for already installed packages |
89 | | - update: false |
90 | | - # don't try to use the msys that comes built-in to the github runner, |
91 | | - # so we can control what is installed (i.e. not python) |
92 | | - release: true |
93 | | - # Inherit the full path from the Windows environment, with MSYS2's */bin/ |
94 | | - # dirs placed in front. This lets us run Windows-native Python etc. |
95 | | - path-type: inherit |
96 | | - install: > |
97 | | - make |
| 24 | + toolchain: stable |
| 25 | + |
98 | 26 |
|
99 | | - - name: disable git crlf conversion |
100 | | - run: git config --global core.autocrlf false |
101 | | - |
102 | | - - name: checkout the source code |
103 | | - uses: actions/checkout@v4 |
| 27 | + - name: Install Go |
| 28 | + uses: actions/setup-go@v4 |
104 | 29 | with: |
105 | | - fetch-depth: 2 |
106 | | - |
107 | | - # Free up disk space on Linux by removing preinstalled components that |
108 | | - # we do not need. We do this to enable some of the less resource |
109 | | - # intensive jobs to run on free runners, which however also have |
110 | | - # less disk space. |
111 | | - - name: free up disk space |
112 | | - uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be |
113 | | - if: matrix.free_disk |
114 | | - |
115 | | - # Rust Log Analyzer can't currently detect the PR number of a GitHub |
116 | | - # Actions build on its own, so a hint in the log message is needed to |
117 | | - # point it in the right direction. |
118 | | - - name: configure the PR in which the error message will be posted |
119 | | - run: echo "[CI_PR_NUMBER=$num]" |
120 | | - env: |
121 | | - num: ${{ github.event.number }} |
122 | | - if: needs.calculate_matrix.outputs.run_type == 'pr' |
123 | | - |
124 | | - - name: add extra environment variables |
125 | | - run: src/ci/scripts/setup-environment.sh |
126 | | - env: |
127 | | - # Since it's not possible to merge `${{ matrix.env }}` with the other |
128 | | - # variables in `job.<name>.env`, the variables defined in the matrix |
129 | | - # are passed to the `setup-environment.sh` script encoded in JSON, |
130 | | - # which then uses log commands to actually set them. |
131 | | - EXTRA_VARIABLES: ${{ toJson(matrix.env) }} |
132 | | - |
133 | | - - name: ensure the channel matches the target branch |
134 | | - run: src/ci/scripts/verify-channel.sh |
135 | | - |
136 | | - - name: collect CPU statistics |
137 | | - run: src/ci/scripts/collect-cpu-stats.sh |
138 | | - |
139 | | - - name: show the current environment |
140 | | - run: src/ci/scripts/dump-environment.sh |
141 | | - |
142 | | - - name: install awscli |
143 | | - run: src/ci/scripts/install-awscli.sh |
144 | | - |
145 | | - - name: install sccache |
146 | | - run: src/ci/scripts/install-sccache.sh |
147 | | - |
148 | | - - name: select Xcode |
149 | | - run: src/ci/scripts/select-xcode.sh |
150 | | - |
151 | | - - name: install clang |
152 | | - run: src/ci/scripts/install-clang.sh |
153 | | - |
154 | | - - name: install tidy |
155 | | - run: src/ci/scripts/install-tidy.sh |
| 30 | + go-version: 1.21.4 |
| 31 | + check-latest: true |
156 | 32 |
|
157 | | - - name: install WIX |
158 | | - run: src/ci/scripts/install-wix.sh |
159 | | - |
160 | | - - name: disable git crlf conversion |
161 | | - run: src/ci/scripts/disable-git-crlf-conversion.sh |
162 | | - |
163 | | - - name: checkout submodules |
164 | | - run: src/ci/scripts/checkout-submodules.sh |
165 | | - |
166 | | - - name: install MinGW |
167 | | - run: src/ci/scripts/install-mingw.sh |
168 | | - |
169 | | - - name: install ninja |
170 | | - run: src/ci/scripts/install-ninja.sh |
171 | | - |
172 | | - - name: enable ipv6 on Docker |
173 | | - run: src/ci/scripts/enable-docker-ipv6.sh |
| 33 | + - name: Show rust version |
| 34 | + run: | |
| 35 | + cargo version |
| 36 | + rustup toolchain list |
174 | 37 |
|
175 | | - # Disable automatic line ending conversion (again). On Windows, when we're |
176 | | - # installing dependencies, something switches the git configuration directory or |
177 | | - # re-enables autocrlf. We've not tracked down the exact cause -- and there may |
178 | | - # be multiple -- but this should ensure submodules are checked out with the |
179 | | - # appropriate line endings. |
180 | | - - name: disable git crlf conversion |
181 | | - run: src/ci/scripts/disable-git-crlf-conversion.sh |
| 38 | + - name: Check out succinctlabs/rust |
| 39 | + uses: actions/checkout@v3 |
| 40 | + with: |
| 41 | + submodules: "recursive" |
| 42 | + path: rust |
| 43 | + fetch-depth: 0 |
| 44 | + ref: ${{ github.ref }} |
182 | 45 |
|
183 | | - - name: ensure line endings are correct |
184 | | - run: src/ci/scripts/verify-line-endings.sh |
| 46 | + - name: Check out succinctlabs/sp1 |
| 47 | + uses: actions/checkout@v3 |
| 48 | + with: |
| 49 | + repository: succinctlabs/sp1 |
| 50 | + ref: dev |
| 51 | + path: sp1 |
185 | 52 |
|
186 | | - - name: ensure backported commits are in upstream branches |
187 | | - run: src/ci/scripts/verify-backported-commits.sh |
| 53 | + - name: Build |
| 54 | + run: | |
| 55 | + cd sp1/crates/cli |
| 56 | + GITHUB_ACTIONS=false SP1_BUILD_DIR=$GITHUB_WORKSPACE cargo run --bin cargo-prove -- prove build-toolchain |
188 | 57 |
|
189 | | - - name: ensure the stable version number is correct |
190 | | - run: src/ci/scripts/verify-stable-version-number.sh |
| 58 | + - name: Archive build output |
| 59 | + uses: actions/upload-artifact@v3 |
| 60 | + with: |
| 61 | + name: rust-toolchain-${{ matrix.triple }} |
| 62 | + path: sp1/crates/cli/rust-toolchain-${{ matrix.triple }}.tar.gz |
191 | 63 |
|
192 | | - - name: run the build |
193 | | - # Redirect stderr to stdout to avoid reordering the two streams in the GHA logs. |
194 | | - run: src/ci/scripts/run-build-from-ci.sh 2>&1 |
195 | | - env: |
196 | | - AWS_ACCESS_KEY_ID: ${{ env.CACHES_AWS_ACCESS_KEY_ID }} |
197 | | - AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }} |
| 64 | + build-runs-on: |
| 65 | + strategy: |
| 66 | + fail-fast: false |
| 67 | + runs-on: [runs-on, runner=32cpu-linux-arm64, image=ubuntu22-full-arm64, "run-id=${{ github.run_id }}"] |
| 68 | + steps: |
| 69 | + - name: Install Rust |
| 70 | + uses: actions-rs/toolchain@v1 |
| 71 | + with: |
| 72 | + toolchain: stable |
| 73 | + |
198 | 74 |
|
199 | | - - name: create github artifacts |
200 | | - run: src/ci/scripts/create-doc-artifacts.sh |
| 75 | + - name: Install Go |
| 76 | + uses: actions/setup-go@v4 |
| 77 | + with: |
| 78 | + go-version: 1.21.4 |
| 79 | + check-latest: true |
201 | 80 |
|
202 | | - - name: print disk usage |
| 81 | + - name: Show rust version |
203 | 82 | run: | |
204 | | - echo "disk usage:" |
205 | | - df -h |
| 83 | + cargo version |
| 84 | + rustup toolchain list |
206 | 85 |
|
207 | | - - name: upload artifacts to github |
208 | | - uses: actions/upload-artifact@v4 |
| 86 | + - name: Check out succinctlabs/rust |
| 87 | + uses: actions/checkout@v3 |
209 | 88 | with: |
210 | | - # name is set in previous step |
211 | | - name: ${{ env.DOC_ARTIFACT_NAME }} |
212 | | - path: obj/artifacts/doc |
213 | | - if-no-files-found: ignore |
214 | | - retention-days: 5 |
| 89 | + submodules: "recursive" |
| 90 | + path: rust |
| 91 | + fetch-depth: 0 |
| 92 | + ref: ${{ github.ref }} |
215 | 93 |
|
216 | | - - name: upload artifacts to S3 |
217 | | - run: src/ci/scripts/upload-artifacts.sh |
218 | | - env: |
219 | | - AWS_ACCESS_KEY_ID: ${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }} |
220 | | - AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }} |
221 | | - # Adding a condition on DEPLOY=1 or DEPLOY_ALT=1 is not needed as all deploy |
222 | | - # builders *should* have the AWS credentials available. Still, explicitly |
223 | | - # adding the condition is helpful as this way CI will not silently skip |
224 | | - # deploying artifacts from a dist builder if the variables are misconfigured, |
225 | | - # erroring about invalid credentials instead. |
226 | | - if: github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1' |
| 94 | + - name: Check out succinctlabs/sp1 |
| 95 | + uses: actions/checkout@v3 |
| 96 | + with: |
| 97 | + repository: succinctlabs/sp1 |
| 98 | + ref: dev |
| 99 | + path: sp1 |
227 | 100 |
|
228 | | - - name: upload job metrics to DataDog |
229 | | - if: needs.calculate_matrix.outputs.run_type != 'pr' |
230 | | - env: |
231 | | - DATADOG_SITE: datadoghq.com |
232 | | - DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }} |
233 | | - DD_GITHUB_JOB_NAME: ${{ matrix.name }} |
| 101 | + - name: Build |
234 | 102 | run: | |
235 | | - cd src/ci |
236 | | - npm ci |
237 | | - python3 scripts/upload-build-metrics.py ../../build/cpu-usage.csv |
| 103 | + cd sp1/crates/cli |
| 104 | + GITHUB_ACTIONS=false SP1_BUILD_DIR=$GITHUB_WORKSPACE cargo run --bin cargo-prove -- prove build-toolchain |
238 | 105 |
|
239 | | - # This job isused to tell bors the final status of the build, as there is no practical way to detect |
240 | | - # when a workflow is successful listening to webhooks only in our current bors implementation (homu). |
241 | | - outcome: |
242 | | - name: bors build finished |
243 | | - runs-on: ubuntu-24.04 |
244 | | - needs: [ calculate_matrix, job ] |
245 | | - # !cancelled() executes the job regardless of whether the previous jobs passed or failed |
246 | | - if: ${{ !cancelled() && contains(fromJSON('["auto", "try"]'), needs.calculate_matrix.outputs.run_type) }} |
247 | | - steps: |
248 | | - - name: checkout the source code |
249 | | - uses: actions/checkout@v4 |
| 106 | + - name: Archive build output |
| 107 | + uses: actions/upload-artifact@v3 |
250 | 108 | with: |
251 | | - fetch-depth: 2 |
252 | | - # Calculate the exit status of the whole CI workflow. |
253 | | - # If all dependent jobs were successful, this exits with 0 (and the outcome job continues successfully). |
254 | | - # If a some dependent job has failed, this exits with 1. |
255 | | - - name: calculate the correct exit status |
256 | | - run: jq --exit-status 'all(.result == "success" or .result == "skipped")' <<< '${{ toJson(needs) }}' |
257 | | - # Publish the toolstate if an auto build succeeds (just before push to master) |
258 | | - - name: publish toolstate |
259 | | - run: src/ci/publish_toolstate.sh |
260 | | - shell: bash |
261 | | - if: needs.calculate_matrix.outputs.run_type == 'auto' |
262 | | - env: |
263 | | - TOOLSTATE_ISSUES_API_URL: https://api.github.com/repos/rust-lang/rust/issues |
264 | | - TOOLSTATE_PUBLISH: 1 |
| 109 | + name: rust-toolchain-aarch64-unknown-linux-gnu |
| 110 | + path: sp1/crates/cli/rust-toolchain-aarch64-unknown-linux-gnu.tar.gz |
0 commit comments