Skip to content

Commit 563dcb1

Browse files
committed
Modify CI files and add release.yml
1 parent 129f3b9 commit 563dcb1

File tree

2 files changed

+85
-207
lines changed

2 files changed

+85
-207
lines changed

.github/workflows/ci.yml

+45-207
Original file line numberDiff line numberDiff line change
@@ -1,218 +1,56 @@
1-
#############################################################
2-
# WARNING: automatically generated file, DO NOT CHANGE! #
3-
#############################################################
4-
5-
# This file was automatically generated by the expand-yaml-anchors tool. The
6-
# source file that generated this one is:
7-
#
8-
# src/ci/github-actions/ci.yml
9-
#
10-
# Once you make changes to that file you need to run:
11-
#
12-
# ./x.py run src/tools/expand-yaml-anchors/
13-
#
14-
# The CI build will fail if the tool is not run after changes to this file.
15-
16-
---
171
name: CI
18-
"on":
2+
3+
on:
194
push:
20-
branches:
21-
- auto
22-
- try
23-
- try-perf
24-
- automation/bors/try
25-
- master
5+
branches: [ risc0 ]
266
pull_request:
27-
branches:
28-
- "**"
29-
permissions:
30-
contents: read
31-
packages: write
32-
defaults:
33-
run:
34-
shell: bash
35-
concurrency:
36-
group: "${{ github.workflow }}-${{ ((github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.sha) || github.ref }}"
37-
cancel-in-progress: true
7+
branches: [ risc0 ]
8+
workflow_call:
9+
workflow_dispatch:
10+
3811
jobs:
39-
calculate_matrix:
40-
name: Calculate job matrix
41-
runs-on: ubuntu-latest
42-
outputs:
43-
jobs: "${{ steps.jobs.outputs.jobs }}"
44-
steps:
45-
- name: Checkout the source code
46-
uses: actions/checkout@v4
47-
- name: Calculate the CI job matrix
48-
run: python3 src/ci/github-actions/calculate-job-matrix.py >> $GITHUB_OUTPUT
49-
id: jobs
50-
job:
51-
name: "${{ matrix.name }}"
52-
needs:
53-
- calculate_matrix
54-
env:
55-
CI_JOB_NAME: "${{ matrix.image }}"
56-
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
57-
HEAD_SHA: "${{ github.event.pull_request.head.sha || github.sha }}"
58-
DOCKER_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
59-
SCCACHE_BUCKET: rust-lang-ci-sccache2
60-
TOOLSTATE_REPO: "https://github.com/rust-lang-nursery/rust-toolstate"
61-
CACHE_DOMAIN: ci-caches.rust-lang.org
62-
continue-on-error: "${{ matrix.continue_on_error || false }}"
12+
build:
6313
strategy:
14+
fail-fast: false
6415
matrix:
65-
include: "${{ fromJSON(needs.calculate_matrix.outputs.jobs) }}"
66-
if: "fromJSON(needs.calculate_matrix.outputs.jobs)[0] != null"
67-
defaults:
68-
run:
69-
shell: "${{ contains(matrix.os, 'windows') && 'msys2 {0}' || 'bash' }}"
70-
timeout-minutes: 600
71-
runs-on: "${{ matrix.os }}"
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 }}" ]
7224
steps:
73-
- if: "contains(matrix.os, 'windows')"
74-
uses: msys2/[email protected]
25+
- name: Install Rust
26+
uses: risc0/actions-rs-toolchain@v1
7527
with:
76-
msystem: "${{ contains(matrix.name, 'i686') && 'mingw32' || 'mingw64' }}"
77-
update: false
78-
release: true
79-
path-type: inherit
80-
install: "make dos2unix diffutils\n"
81-
- name: disable git crlf conversion
82-
run: git config --global core.autocrlf false
83-
- name: checkout the source code
84-
uses: actions/checkout@v4
28+
toolchain: stable
29+
- uses: lukka/[email protected]
30+
31+
- name: Check out risc0/rust
32+
uses: actions/checkout@v3
8533
with:
86-
fetch-depth: 2
87-
- name: configure the PR in which the error message will be posted
88-
run: "echo \"[CI_PR_NUMBER=$num]\""
89-
env:
90-
num: "${{ github.event.number }}"
91-
if: "success() && github.event_name == 'pull_request'"
92-
- name: add extra environment variables
93-
run: src/ci/scripts/setup-environment.sh
94-
env:
95-
EXTRA_VARIABLES: "${{ toJson(matrix.env) }}"
96-
- name: ensure the channel matches the target branch
97-
run: src/ci/scripts/verify-channel.sh
98-
- name: collect CPU statistics
99-
run: src/ci/scripts/collect-cpu-stats.sh
100-
- name: show the current environment
101-
run: src/ci/scripts/dump-environment.sh
102-
- name: install awscli
103-
run: src/ci/scripts/install-awscli.sh
104-
- name: install sccache
105-
run: src/ci/scripts/install-sccache.sh
106-
- name: select Xcode
107-
run: src/ci/scripts/select-xcode.sh
108-
- name: install clang
109-
run: src/ci/scripts/install-clang.sh
110-
- name: install tidy
111-
run: src/ci/scripts/install-tidy.sh
112-
- name: install WIX
113-
run: src/ci/scripts/install-wix.sh
114-
- name: disable git crlf conversion
115-
run: src/ci/scripts/disable-git-crlf-conversion.sh
116-
- name: checkout submodules
117-
run: src/ci/scripts/checkout-submodules.sh
118-
- name: install MSYS2
119-
run: src/ci/scripts/install-msys2.sh
120-
- name: install MinGW
121-
run: src/ci/scripts/install-mingw.sh
122-
- name: install ninja
123-
run: src/ci/scripts/install-ninja.sh
124-
- name: enable ipv6 on Docker
125-
run: src/ci/scripts/enable-docker-ipv6.sh
126-
- name: disable git crlf conversion
127-
run: src/ci/scripts/disable-git-crlf-conversion.sh
128-
- name: ensure line endings are correct
129-
run: src/ci/scripts/verify-line-endings.sh
130-
- name: ensure backported commits are in upstream branches
131-
run: src/ci/scripts/verify-backported-commits.sh
132-
- name: ensure the stable version number is correct
133-
run: src/ci/scripts/verify-stable-version-number.sh
134-
- name: run the build
135-
run: src/ci/scripts/run-build-from-ci.sh 2>&1
136-
env:
137-
AWS_ACCESS_KEY_ID: "${{ env.CACHES_AWS_ACCESS_KEY_ID }}"
138-
AWS_SECRET_ACCESS_KEY: "${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }}"
139-
TOOLSTATE_REPO_ACCESS_TOKEN: "${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}"
140-
- name: create github artifacts
141-
run: src/ci/scripts/create-doc-artifacts.sh
142-
- name: upload artifacts to github
143-
uses: actions/upload-artifact@v4
34+
submodules: 'recursive'
35+
path: rust
36+
fetch-depth: 0
37+
38+
- name: Check out risc0/risc0
39+
uses: actions/checkout@v3
14440
with:
145-
name: "${{ env.DOC_ARTIFACT_NAME }}"
146-
path: obj/artifacts/doc
147-
if-no-files-found: ignore
148-
retention-days: 5
149-
- name: upload artifacts to S3
150-
run: src/ci/scripts/upload-artifacts.sh
151-
env:
152-
AWS_ACCESS_KEY_ID: "${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }}"
153-
AWS_SECRET_ACCESS_KEY: "${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }}"
154-
if: "success() && (github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1')"
155-
master:
156-
name: master
157-
runs-on: ubuntu-latest
158-
env:
159-
SCCACHE_BUCKET: rust-lang-ci-sccache2
160-
DEPLOY_BUCKET: rust-lang-ci2
161-
TOOLSTATE_REPO: "https://github.com/rust-lang-nursery/rust-toolstate"
162-
TOOLSTATE_ISSUES_API_URL: "https://api.github.com/repos/rust-lang/rust/issues"
163-
TOOLSTATE_PUBLISH: 1
164-
CACHES_AWS_ACCESS_KEY_ID: AKIA46X5W6CZI5DHEBFL
165-
ARTIFACTS_AWS_ACCESS_KEY_ID: AKIA46X5W6CZN24CBO55
166-
AWS_REGION: us-west-1
167-
CACHE_DOMAIN: ci-caches.rust-lang.org
168-
if: "github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'rust-lang-ci/rust'"
169-
steps:
170-
- name: checkout the source code
171-
uses: actions/checkout@v4
41+
repository: risc0/risc0
42+
ref: main
43+
path: risc0
44+
45+
- name: Build
46+
run: GITHUB_ACTIONS=false RISC0_BUILD_DIR=$GITHUB_WORKSPACE cargo run --bin cargo-risczero -- risczero build-toolchain
47+
working-directory: risc0
48+
49+
- name: Archive build output
50+
uses: actions/upload-artifact@v3
17251
with:
173-
fetch-depth: 2
174-
- name: publish toolstate
175-
run: src/ci/publish_toolstate.sh
176-
shell: bash
177-
env:
178-
TOOLSTATE_REPO_ACCESS_TOKEN: "${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}"
179-
try-success:
180-
needs:
181-
- job
182-
if: "success() && github.event_name == 'push' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.repository == 'rust-lang-ci/rust'"
183-
steps:
184-
- name: mark the job as a success
185-
run: exit 0
186-
shell: bash
187-
name: bors build finished
188-
runs-on: ubuntu-latest
189-
try-failure:
190-
needs:
191-
- job
192-
if: "!success() && github.event_name == 'push' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.repository == 'rust-lang-ci/rust'"
193-
steps:
194-
- name: mark the job as a failure
195-
run: exit 1
196-
shell: bash
197-
name: bors build finished
198-
runs-on: ubuntu-latest
199-
auto-success:
200-
needs:
201-
- job
202-
if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
203-
steps:
204-
- name: mark the job as a success
205-
run: exit 0
206-
shell: bash
207-
name: bors build finished
208-
runs-on: ubuntu-latest
209-
auto-failure:
210-
needs:
211-
- job
212-
if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
213-
steps:
214-
- name: mark the job as a failure
215-
run: exit 1
216-
shell: bash
217-
name: bors build finished
218-
runs-on: ubuntu-latest
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/release.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- '*'
6+
7+
jobs:
8+
build:
9+
uses: ./.github/workflows/ci.yml
10+
11+
release:
12+
needs: build
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
steps:
17+
- name: Download artifacts
18+
uses: actions/download-artifact@v3
19+
with:
20+
path: artifacts
21+
- name: Compress artifacts
22+
shell: bash
23+
run: |
24+
ls -lha ./artifacts
25+
mkdir assets
26+
for DIR in $(ls ./artifacts); do
27+
tar czf "assets/$DIR.tar.gz" -C "artifacts/$DIR" .
28+
done
29+
ls -lha ./assets
30+
- name: Create release
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
run: |
34+
echo "Installing gh CLI..."
35+
curl -L https://github.com/cli/cli/releases/download/v2.17.0/gh_2.17.0_linux_amd64.tar.gz | \
36+
tar xvz --strip-components=2 --exclude=man
37+
chmod +x ./gh
38+
39+
./gh release create --repo "$GITHUB_REPOSITORY" "$GITHUB_REF_NAME" ./assets/* || \
40+
./gh release upload --repo "$GITHUB_REPOSITORY" "$GITHUB_REF_NAME" ./assets/*

0 commit comments

Comments
 (0)