-
Notifications
You must be signed in to change notification settings - Fork 39
151 lines (143 loc) · 5.25 KB
/
main.yml
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: CI
on:
merge_group:
pull_request:
branches: [main, "release-*"]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
# this is needed to gain access via OIDC to the S3 bucket for caching
permissions:
id-token: write
contents: read
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RISC0_TOOLCHAIN_VERSION: v2024-01-31.1
jobs:
# see: https://github.com/orgs/community/discussions/26822
main-status-check:
if: always()
needs:
- check
- check-benchmarks
- check-template
- crates-validator
- doc
- examples
- reproducible-build
- stark2snark
- test
- web
runs-on: ubuntu-latest
steps:
- name: Check all job status
# see https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#needs-context
# see https://stackoverflow.com/a/67532120/4907315
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
run: exit 1
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Full history is required by license-check.py
fetch-depth: 0
- uses: ./.github/actions/rustup
- name: Install cargo-sort
uses: risc0/cargo-install@b9307573043522ab0d3e3be64a51763b765b52a4
with:
crate: cargo-sort
version: "1.0"
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: risc0/foundry-toolchain@2fe7e70b520f62368a0e3c464f997df07ede420f
with:
version: nightly-09fe3e041369a816365a020f715ad6f94dbce9f2
- run: cargo fmt --all --check
- run: cargo fmt --all --check --manifest-path relay/tests/methods/guest/Cargo.toml
- run: cargo clippy
env:
RISC0_SKIP_BUILD: true
- run: cargo sort --workspace --check
- run: cargo sort --workspace --check relay/tests/methods/guest
- run: forge fmt --check
working-directory: contracts
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- run: python license-check.py
test:
runs-on: [self-hosted, prod, "${{ matrix.os }}", "${{ matrix.device }}"]
strategy:
fail-fast: false
matrix:
os: [Linux, macOS]
feature: [default]
device: [cpu]
include:
- os: Linux
feature: default
device: nvidia_rtx_a5000
- os: macOS
feature: default
device: apple_m2_pro
env:
FEATURE: ${{ matrix.feature }}
RISC0_BUILD_LOCKED: 1
RUST_BACKTRACE: full
steps:
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842
- run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :"
- uses: actions/checkout@v4
- if: matrix.feature == 'cuda'
uses: ./.github/actions/cuda
- uses: ./.github/actions/rustup
- uses: ./.github/actions/sccache
with:
key: ${{ matrix.os }}-${{ matrix.feature }}
# TODO(victor) How to install cargo-risczero
- run: cargo run --bin cargo-risczero --no-default-features -- risczero install --version $RISC0_TOOLCHAIN_VERSION
- uses: risc0/foundry-toolchain@2fe7e70b520f62368a0e3c464f997df07ede420f
with:
version: nightly-09fe3e041369a816365a020f715ad6f94dbce9f2
- name: build workspace
run: |
cargo test -F $FEATURE --workspace --timings --no-run \
--exclude doc-test \
--exclude bonsai-ethereum-contracts \
--exclude bonsai-ethereum-relay \
--exclude bonsai-rest-api-mock
- name: test workspace
run: |
cargo test -F $FEATURE -F prove --workspace --timings \
--exclude doc-test \
--exclude bonsai-ethereum-contracts \
--exclude bonsai-ethereum-relay \
--exclude bonsai-rest-api-mock
- uses: actions/upload-artifact@v3
with:
name: cargo-timings-${{ matrix.os }}-${{ matrix.device }}
path: target/cargo-timings/
retention-days: 5
- run: forge test -vvv
working-directory: contracts
- run: sccache --show-stats
doc:
runs-on: [self-hosted, prod, macOS, cpu]
steps:
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842
- run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :"
- uses: actions/checkout@v4
- uses: ./.github/actions/rustup
- uses: risc0/foundry-toolchain@2fe7e70b520f62368a0e3c464f997df07ede420f
with:
version: nightly-09fe3e041369a816365a020f715ad6f94dbce9f2
- uses: ./.github/actions/sccache
with:
key: macOS-default
# TODO(victor): Figure out how to install cargo-risczro here
- run: cargo run --bin cargo-risczero --no-default-features -- risczero install --version $RISC0_TOOLCHAIN_VERSION
- run: cargo doc --no-deps --exclude=risc0-ethereum-relay-test-methods --workspace
- run: sccache --show-stats