Skip to content

Commit 0597b3b

Browse files
committed
Add basic CI
1 parent 8bb7893 commit 0597b3b

File tree

1 file changed

+159
-0
lines changed

1 file changed

+159
-0
lines changed

.github/workflows/ci-check.yaml

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919

2020
steps:
2121
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
22+
with:
23+
submodules: true
2224

2325
- name: Install Rust toolchain
2426
uses: moonrepo/setup-rust@ede6de059f8046a5e236c94046823e2af11ca670 # v1.2.2
@@ -66,13 +68,170 @@ jobs:
6668
--onlyAllow "MIT;Apache-2.0" \
6769
--summary
6870
71+
ethereum-prover-checks:
72+
name: ethereum-prover checks 🧪
73+
runs-on: matterlabs-ci-runner-high-performance
74+
steps:
75+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
76+
with:
77+
submodules: true
78+
79+
- name: Install Rust toolchain
80+
uses: moonrepo/setup-rust@ede6de059f8046a5e236c94046823e2af11ca670 # v1.2.2
81+
with:
82+
inherit-toolchain: true
83+
84+
- name: Install rustfmt and clippy
85+
run: rustup component add rustfmt clippy
86+
87+
- name: Install cargo-nextest
88+
uses: taiki-e/install-action@3522286d40783523f9c7880e33f785905b4c20d0 # v2.66.1
89+
with:
90+
tool: cargo-nextest
91+
92+
- name: Rustfmt
93+
run: cargo fmt -p ethereum_prover -- --check
94+
95+
- name: Clippy
96+
run: cargo clippy -p ethereum_prover -- -D warnings
97+
98+
- name: Tests (nextest)
99+
run: RUST_MIN_STACK=267108864 cargo nextest run -p ethereum_prover
100+
101+
####################################
102+
# Build prover integration tests #
103+
####################################
104+
build-prover-tests:
105+
runs-on: matterlabs-ci-runner-ultra-performance
106+
container:
107+
image: nvidia/cuda:12.9.1-devel-ubuntu22.04
108+
steps:
109+
110+
- name: Checkout code
111+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
112+
with:
113+
submodules: true
114+
115+
- name: Install Rust toolchain
116+
uses: moonrepo/setup-rust@ede6de059f8046a5e236c94046823e2af11ca670 # v1.2.2
117+
with:
118+
inherit-toolchain: true
119+
120+
- name: Install cargo-nextest
121+
uses: taiki-e/install-action@3522286d40783523f9c7880e33f785905b4c20d0 # v2.66.1
122+
with:
123+
tool: cargo-nextest
124+
125+
- name: Check CUDA version
126+
run: |
127+
nvcc --version
128+
129+
- name: Checkout era-bellman-cuda
130+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
131+
with:
132+
repository: matter-labs/era-bellman-cuda
133+
ref: main
134+
path: bellman-cuda
135+
fetch-depth: '1'
136+
137+
- name: Cache bellman-cuda
138+
id: bellman-cuda-cache
139+
uses: actions/cache@v4
140+
with:
141+
path: 'bellman-cuda/build'
142+
key: bellman-cuda-${{ hashFiles('bellman-cuda/**') }}
143+
144+
- name: Build bellman-cuda
145+
shell: 'bash -ex {0}'
146+
if: steps.bellman-cuda-cache.outputs.cache-hit != 'true'
147+
run: |
148+
cmake -Bbellman-cuda/build -Sbellman-cuda/ -DCMAKE_BUILD_TYPE=Release
149+
cmake --build bellman-cuda/build/
150+
151+
# Build and archive tests to execute on another machine.
152+
# Use `cargo nextest archive` to make sure that all dependencies are included properly.
153+
- name: Build and archive test
154+
env:
155+
# This is a special mandatory hack to transfer test binary from one machine to another.
156+
# We must use a dummy `./` path addition in the workspace path /home/runner/_work
157+
# to prevent GitHub Actions to replace it to the mapped `/__w` folder in the docker container.
158+
# This is required to make sure that the paths to workspace artifacts like zkos-l1-state.json
159+
# are correct inside prebuilt binary.
160+
# This variable overwrites the default relative `./` in the .cargo/config.toml.
161+
WORKSPACE_DIR: "/opt/./actions-runner/_work/zksync-os-server/zksync-os-server"
162+
BELLMAN_CUDA_DIR: ${{ github.workspace }}/bellman-cuda
163+
run: |
164+
RUST_MIN_STACK=267108864 cargo nextest archive --release -p ethereum_prover \
165+
--test gpu_prover_from_fixture_block --archive-file ${PROVER_GPU_TESTS}.tar.zst
166+
167+
- name: Upload tests
168+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f3 # v6.0.0
169+
with:
170+
name: ${{ env.PROVER_GPU_TESTS }}
171+
path: ${{ env.PROVER_GPU_TESTS }}.tar.zst
172+
if-no-files-found: error
173+
retention-days: 1 # delete sooner to not waste storage
174+
175+
176+
#################################################
177+
# Run prover integration tests on GPU machine #
178+
#################################################
179+
ethereum-prover-gpu-tests:
180+
runs-on: [matterlabs-ci-gpu-runner, hetzner]
181+
needs: build-prover-tests
182+
steps:
183+
- name: Checkout code
184+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
185+
with:
186+
submodules: true
187+
188+
- name: Install Rust toolchain
189+
uses: moonrepo/setup-rust@ede6de059f8046a5e236c94046823e2af11ca670 # v1.2.2
190+
with:
191+
inherit-toolchain: true
192+
193+
- name: Install cargo-nextest
194+
uses: taiki-e/install-action@3522286d40783523f9c7880e33f785905b4c20d0 # v2.66.1
195+
with:
196+
tool: cargo-nextest
197+
198+
- name: Check Nvidia driver version
199+
run: |
200+
echo $WORKSPACE
201+
pwd
202+
nvidia-smi
203+
204+
- name: Download prebuilt tests
205+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
206+
with:
207+
name: ${{ env.PROVER_GPU_TESTS }}
208+
209+
- name: Download CRS setup file
210+
if: steps.cache-crs.outputs.cache-hit != 'true'
211+
env:
212+
# Download CRS file from EU storage for GPU runner
213+
CRS_FILE_URL: https://storage.googleapis.com/matterlabs-setup-keys-europe/setup-keys/setup_compact.key
214+
run: wget -q --show-progress "${CRS_FILE_URL}"
215+
216+
# --workspace-remap is mandatory (!)
217+
# Otherwise, the prebuilt binary will not be able to find its dependencies and fails to execute
218+
- name: Run prover tests on GPU
219+
env:
220+
COMPACT_CRS_FILE: ${{ github.workspace }}/setup_compact.key
221+
RUST_MIN_STACK: 267108864
222+
run: |
223+
ulimit -s 300000
224+
RUN_GPU_TESTS=1 cargo nextest run -p ethereum_prover --test gpu_prover_from_fixture_block
225+
69226
# Special job that allows some of the jobs to be skipped or failed
70227
# requiring others to be successful
71228
pr-checks:
72229
runs-on: ubuntu-latest
73230
if: always()
74231
needs:
75232
- general-checks
233+
- ethereum-prover-checks
234+
- ethereum-prover-gpu-tests
76235
steps:
77236
- name: Decide on PR checks
78237
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2

0 commit comments

Comments
 (0)