-
Notifications
You must be signed in to change notification settings - Fork 74
192 lines (170 loc) · 6.43 KB
/
Copy pathmain.yml
File metadata and controls
192 lines (170 loc) · 6.43 KB
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
name: Main-CI-Flow
on:
pull_request:
types:
- opened
- reopened
- edited
- synchronize
workflow_dispatch:
env:
CI: 1
RUSTFLAGS: "-D warnings"
RUSTDOCFLAGS: "-D warnings"
# Cancel existing CI runs on this same PR when new commits are pushed.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# https://graphite.com/docs/stacking-and-ci
optimize_ci:
runs-on: ubuntu-24.04
timeout-minutes: 60
outputs:
skip: ${{ steps.check_skip.outputs.skip || steps.manual_run.outputs.skip }}
steps:
- name: Optimize CI
id: check_skip
if: github.event_name == 'pull_request'
uses: withgraphite/graphite-ci-action@v0.0.9
with:
graphite_token: ${{ secrets.GRAPHITE_CI_OPTIMIZER_TOKEN }}
- name: Don't skip for manual runs
id: manual_run
if: github.event_name == 'workflow_dispatch'
run: echo "skip=false" >> $GITHUB_OUTPUT
code_style:
runs-on: namespace-profile-medium-ubuntu-24-04-amd64
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
timeout-minutes: 30
steps:
# Environment setup.
- uses: actions/checkout@v6
with:
# Fetch the entire history. Required to checkout the merge target commit, so the diff can
# be computed.
fetch-depth: 0
# Install rust components + lld.
- uses: ./.github/actions/bootstrap
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Setup pypy and link to the location expected by .cargo/config.toml.
- uses: actions/setup-python@v5
id: setup-pypy
with:
python-version: "pypy3.9"
- run: ln -s '${{ steps.setup-pypy.outputs.python-path }}' /usr/local/bin/pypy3.9
- env:
LD_LIBRARY_PATH: ${{ env.Python3_ROOT_DIR }}/bin
run: echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV
- run: pip install -r scripts/requirements.txt
# Check Cargo.lock is up to date.
- name: "Check Cargo.lock"
run: cargo metadata --locked --format-version=1 > /dev/null
# Run code style checks.
- name: "Run TODO style"
run: scripts/named_todos.py --commit_id ${{ github.event.pull_request.base.sha || 'origin/main' }}
- name: "Run clippy"
run: scripts/run_tests.py --command clippy --changes_only --commit_id ${{ github.event.pull_request.base.sha || 'origin/main' }}
- name: "Run cargo doc"
run: scripts/run_tests.py --command doc --changes_only --commit_id ${{ github.event.pull_request.base.sha || 'origin/main' }}
- name: "Run python code style"
run: scripts/py_code_style.py
- name: "Run rustfmt"
run: scripts/rust_fmt.sh --check
- name: "Run taplo"
run: scripts/taplo.sh
- name: Run Machete (detect unused dependencies)
run: cargo machete
run-workspace-tests:
runs-on: namespace-profile-medium-ubuntu-24-04-amd64
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
timeout-minutes: 30
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/bootstrap
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- run: cargo test -p workspace_tests
run-tests:
runs-on: namespace-profile-xlarge-ubuntu-24-04-amd64
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
timeout-minutes: 45
steps:
- uses: actions/checkout@v6
with:
# Fetch the entire history.
fetch-depth: 0
- uses: ./.github/actions/bootstrap
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Setup pypy and link to the location expected by .cargo/config.toml.
- uses: actions/setup-python@v5
id: setup-pypy
with:
python-version: "pypy3.9"
- run: ln -s '${{ steps.setup-pypy.outputs.python-path }}' /usr/local/bin/pypy3.9
- env:
LD_LIBRARY_PATH: ${{ env.Python3_ROOT_DIR }}/bin
run: echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV
- run: pip install -r scripts/requirements.txt
# Auth with GCS for tests to download artifacts.
- id: auth
uses: "google-github-actions/auth@v2"
with:
credentials_json: ${{ secrets.SYSTEST_BLOBS_READ_ACCESS_KEY }}
- uses: "google-github-actions/setup-gcloud@v2"
- name: Clone starknet-specs for spec tests
run: scripts/prepare_starknet_specs.sh /tmp/starknet-specs
- name: "Run tests"
run: |
scripts/run_tests.py --command test --changes_only --include_dependencies --commit_id ${{ github.event.pull_request.base.sha || 'origin/main' }}
env:
SEED: 0
STARKNET_SPECS_DIR: /tmp/starknet-specs
- run: sccache --show-stats
run-integration-tests:
runs-on: namespace-profile-large-ubuntu-24-04-amd64
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
timeout-minutes: 45
steps:
- uses: actions/checkout@v6
with:
# Fetch the entire history.
fetch-depth: 0
- uses: ./.github/actions/bootstrap
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Setup pypy and link to the location expected by .cargo/config.toml.
- uses: actions/setup-python@v5
id: setup-pypy
with:
python-version: "pypy3.9"
- run: ln -s '${{ steps.setup-pypy.outputs.python-path }}' /usr/local/bin/pypy3.9
- env:
LD_LIBRARY_PATH: ${{ env.Python3_ROOT_DIR }}/bin
run: echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV
- run: pip install -r scripts/requirements.txt
- name: "Run integration tests"
run: |
scripts/run_tests.py --command integration --changes_only --include_dependencies --commit_id ${{ github.event.pull_request.base.sha || 'origin/main' }}
env:
SEED: 0
# TODO(dan): Once all cargo-deny issues are resolved, consider merging this into code_style job.
cargo-deny:
runs-on: namespace-profile-medium-ubuntu-24-04-amd64
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
timeout-minutes: 30
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/bootstrap
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Run cargo-deny (security/license check)
continue-on-error: true # Warning only until all issues are resolved
run: cargo deny check