-
Notifications
You must be signed in to change notification settings - Fork 11
148 lines (138 loc) · 4.45 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
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 }}
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# Full history is required by license-check.py
fetch-depth: 0
- uses: risc0/risc0/.github/actions/rustup@4ab1f0bba1b0515819221bebc59f95aad0a6a3a9
- name: Install cargo-sort
uses: risc0/cargo-install@v1
with:
crate: cargo-sort
version: "1.0"
- run: cargo fmt --all -- --check
- run: cargo fmt --manifest-path zirgen/bootstrap/Cargo.toml -- --check
- run: cargo sort --workspace --check
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- run: python license-check.py
bazel:
runs-on: [self-hosted, prod, cpu, "${{ matrix.os }}"]
strategy:
fail-fast: false
matrix:
os: [Linux, macOS]
include:
- os: Linux
config: --config=ci
steps:
- name: Get Date
id: get-date
run: |
echo "date=$(/bin/date -u "+%Y-%m-%d")" >> $GITHUB_OUTPUT
shell: bash
- uses: actions/checkout@v3
# Cache bazel build on linux. (MacOS uses the local cache on the runner.)
- if: matrix.os == 'Linux'
uses: actions/cache@v4
env:
cache-name: bazel-build
with:
path: "~/.cache/bazel"
# Generate a new build cache once a day, reusing the previous day's if available
key: "bazel-${{ matrix.os }}-${{ steps.get-date.outputs.date }}"
restore-keys: "bazel-${{ matrix.os }}-"
- uses: ./.github/actions/bazelisk
- name: Build & test
env:
CONFIG: ${{ matrix.config }}
run: bazelisk test //... $CONFIG
test:
runs-on: [self-hosted, prod, "${{ matrix.os }}", "${{ matrix.arch }}", "${{ matrix.device }}"]
strategy:
fail-fast: false
matrix:
include:
- os: Linux
arch: X64
feature: default
device: cpu
- os: Linux
arch: X64
feature: cuda
device: nvidia_rtx_a5000
- os: macOS
arch: ARM64
feature: default
device: apple_m2_pro
env:
FEATURE: ${{ matrix.feature }}
RISC0_BUILD_LOCKED: 1
RUST_BACKTRACE: full
steps:
- uses: actions/checkout@v3
- if: matrix.feature == 'cuda'
uses: ./.github/actions/cuda
- uses: risc0/risc0/.github/actions/rustup@4ab1f0bba1b0515819221bebc59f95aad0a6a3a9
- uses: risc0/risc0/.github/actions/sccache@1a373c71585766e4f6985b96c48389daaf69d528
with:
key: ${{ matrix.os }}-${{ matrix.feature }}
- run: |
curl -L https://risczero.com/install | bash
echo "$HOME/.risc0/bin" >> $GITHUB_PATH
shell: bash
- run: rzup install rust
- run: cargo test --locked -F $FEATURE
- run: cargo check --benches
- run: cargo check --manifest-path zirgen/bootstrap/Cargo.toml
- run: sccache --show-stats
doc:
runs-on: [self-hosted, prod, Linux, cpu]
env:
RUST_BACKTRACE: full
RISC0_BUILD_LOCKED: 1
steps:
- uses: actions/checkout@v3
- uses: risc0/risc0/.github/actions/rustup@4ab1f0bba1b0515819221bebc59f95aad0a6a3a9
- uses: risc0/risc0/.github/actions/sccache@1a373c71585766e4f6985b96c48389daaf69d528
- run: |
curl -L https://risczero.com/install | bash
echo "$HOME/.risc0/bin" >> $GITHUB_PATH
shell: bash
- run: rzup install rust
- run: cargo doc --no-deps --workspace
- run: sccache --show-stats
# see: https://github.com/orgs/community/discussions/26822
main-status-check:
if: always()
needs:
- check
- bazel
- test
- doc
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