Skip to content

Commit 8179d9e

Browse files
author
Erik Kaneda
authored
1.85.0: Add CI files and use rzup to build toolchain (#21)
* add CI files * use latest rzup * run ci * fix path * fix
1 parent 4d91de4 commit 8179d9e

File tree

3 files changed

+86
-267
lines changed

3 files changed

+86
-267
lines changed

.github/workflows/ci.yml

Lines changed: 38 additions & 246 deletions
Original file line numberDiff line numberDiff line change
@@ -1,264 +1,56 @@
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-
101
name: CI
2+
113
on:
124
push:
13-
branches:
14-
- auto
15-
- try
16-
- try-perf
17-
- automation/bors/try
5+
branches: [ risc0 ]
186
pull_request:
19-
branches:
20-
- "**"
21-
22-
permissions:
23-
contents: read
24-
packages: write
7+
branches: [ risc0, "risc0-*" ]
8+
workflow_call:
9+
workflow_dispatch:
2510

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
32-
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 }}
4311
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 }}
12+
build:
7813
strategy:
14+
fail-fast: false
7915
matrix:
80-
# Check the `calculate_matrix` job to see how is the matrix defined.
81-
include: ${{ fromJSON(needs.calculate_matrix.outputs.jobs) }}
16+
include:
17+
- os: macOS
18+
arch: ARM64
19+
triple: aarch64-apple-darwin
20+
- os: Linux
21+
arch: X64
22+
triple: x86_64-unknown-linux-gnu
23+
runs-on: [ self-hosted, prod, "${{ matrix.os }}", "${{ matrix.arch }}" ]
8224
steps:
83-
- if: contains(matrix.os, 'windows')
84-
uses: msys2/[email protected]
25+
- name: Install Rust
26+
uses: risc0/actions-rs-toolchain@v1
8527
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
28+
toolchain: stable
29+
- uses: lukka/[email protected]
9830

99-
- name: disable git crlf conversion
100-
run: git config --global core.autocrlf false
31+
- name: Check out risc0/rust
32+
uses: actions/checkout@v3
33+
with:
34+
submodules: 'recursive'
35+
path: rust
36+
fetch-depth: 0
10137

102-
- name: checkout the source code
38+
- name: Check out risc0/risc0
10339
uses: actions/checkout@v4
10440
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
41+
repository: risc0/risc0
42+
ref: main
43+
path: risc0
15644

157-
- name: install WIX
158-
run: src/ci/scripts/install-wix.sh
45+
- name: Build
46+
run: GITHUB_ACTIONS=false cargo run --bin rzup -- build rust --path $GITHUB_WORKSPACE/rust
47+
working-directory: risc0
15948

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
174-
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
182-
183-
- name: ensure line endings are correct
184-
run: src/ci/scripts/verify-line-endings.sh
185-
186-
- name: ensure backported commits are in upstream branches
187-
run: src/ci/scripts/verify-backported-commits.sh
188-
189-
- name: ensure the stable version number is correct
190-
run: src/ci/scripts/verify-stable-version-number.sh
191-
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)] }}
198-
199-
- name: create github artifacts
200-
run: src/ci/scripts/create-doc-artifacts.sh
201-
202-
- name: print disk usage
203-
run: |
204-
echo "disk usage:"
205-
df -h
206-
207-
- name: upload artifacts to github
49+
- name: Archive build output
20850
uses: actions/upload-artifact@v4
20951
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
215-
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'
227-
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 }}
234-
run: |
235-
cd src/ci
236-
npm ci
237-
python3 scripts/upload-build-metrics.py ../../build/cpu-usage.csv
238-
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
250-
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
52+
name: rust-toolchain-${{ matrix.triple }}
53+
path: |
54+
rust/build/${{ matrix.triple }}/stage2
55+
!rust/build/${{ matrix.triple }}/stage2/lib/rustlib/src
56+
!rust/build/${{ matrix.triple }}/stage2/lib/rustlib/rustc-src

.github/workflows/dependencies.yml

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
not-waiting-on-bors:
2828
if: github.repository_owner == 'rust-lang'
2929
name: skip if S-waiting-on-bors
30-
runs-on: ubuntu-24.04
30+
runs-on: ubuntu-latest
3131
steps:
3232
- env:
3333
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -47,7 +47,7 @@ jobs:
4747
if: github.repository_owner == 'rust-lang'
4848
name: update dependencies
4949
needs: not-waiting-on-bors
50-
runs-on: ubuntu-24.04
50+
runs-on: ubuntu-latest
5151
steps:
5252
- name: checkout the source code
5353
uses: actions/checkout@v4
@@ -56,32 +56,19 @@ jobs:
5656
- name: install the bootstrap toolchain
5757
run: |
5858
# Extract the stage0 version
59-
TOOLCHAIN=$(awk -F= '{a[$1]=$2} END {print(a["compiler_version"] "-" a["compiler_date"])}' src/stage0)
59+
TOOLCHAIN=$(jq -r '.compiler | {version,date} | join("-")' -- src/stage0.json)
6060
# Install and set as default
6161
rustup toolchain install --no-self-update --profile minimal $TOOLCHAIN
6262
rustup default $TOOLCHAIN
6363
64-
- name: cargo update compiler & tools
64+
- name: cargo update
6565
# Remove first line that always just says "Updating crates.io index"
66-
run: |
67-
echo -e "\ncompiler & tools dependencies:" >> cargo_update.log
68-
cargo update 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
69-
- name: cargo update library
70-
run: |
71-
echo -e "\nlibrary dependencies:" >> cargo_update.log
72-
cargo update --manifest-path library/Cargo.toml 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
73-
- name: cargo update rustbook
74-
run: |
75-
echo -e "\nrustbook dependencies:" >> cargo_update.log
76-
cargo update --manifest-path src/tools/rustbook/Cargo.toml 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
66+
run: cargo update 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
7767
- name: upload Cargo.lock artifact for use in PR
7868
uses: actions/upload-artifact@v4
7969
with:
8070
name: Cargo-lock
81-
path: |
82-
Cargo.lock
83-
library/Cargo.lock
84-
src/tools/rustbook/Cargo.lock
71+
path: Cargo.lock
8572
retention-days: 1
8673
- name: upload cargo-update log artifact for use in PR
8774
uses: actions/upload-artifact@v4
@@ -94,7 +81,7 @@ jobs:
9481
if: github.repository_owner == 'rust-lang'
9582
name: amend PR
9683
needs: update
97-
runs-on: ubuntu-24.04
84+
runs-on: ubuntu-latest
9885
permissions:
9986
contents: write
10087
pull-requests: write
@@ -126,7 +113,7 @@ jobs:
126113
git config user.name github-actions
127114
git config user.email [email protected]
128115
git switch --force-create cargo_update
129-
git add ./Cargo.lock ./library/Cargo.lock ./src/tools/rustbook/Cargo.lock
116+
git add ./Cargo.lock
130117
git commit --no-verify --file=commit.txt
131118
132119
- name: push

0 commit comments

Comments
 (0)