Skip to content

Commit 2cbb974

Browse files
committed
CI: add targets in Makefile and replace it in ci.yaml
1 parent 2d758d1 commit 2cbb974

File tree

2 files changed

+34
-27
lines changed

2 files changed

+34
-27
lines changed

.github/workflows/ci.yaml

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,13 @@ jobs:
3232
rustup override set nightly
3333
- name: Download circuits files
3434
run: |
35-
git clone --depth 1 https://github.com/openmina/circuit-blobs.git
36-
ln -s -b $PWD/circuit-blobs/* ledger/
35+
make download-circuits
3736
- name: Build ledger tests
3837
run: |
39-
cd ledger
40-
cargo build --release --tests
38+
make build-ledger
4139
- name: Run ledger tests
4240
run: |
43-
cd ledger
44-
cargo test --release -- -Z unstable-options --report-time
41+
make test-ledger
4542
4643
ledger-32x9-tests:
4744
runs-on: ubuntu-22.04
@@ -59,8 +56,7 @@ jobs:
5956
rustup override set nightly
6057
- name: Download circuits files
6158
run: |
62-
git clone --depth 1 https://github.com/openmina/circuit-blobs.git
63-
ln -s -b $PWD/circuit-blobs/* ledger/
59+
make download-circuits
6460
- name: Enable 32x9 fields implementation
6561
run: |
6662
cargo install sd
@@ -70,12 +66,10 @@ jobs:
7066
cat ./Cargo.toml
7167
- name: Build ledger tests
7268
run: |
73-
cd ledger
74-
cargo build --release --tests
69+
make build-ledger
7570
- name: Run ledger tests
7671
run: |
77-
cd ledger
78-
cargo test --release -- -Z unstable-options --report-time
72+
make test-ledger
7973
8074
vrf-tests:
8175
runs-on: ubuntu-22.04
@@ -93,12 +87,10 @@ jobs:
9387
rustup override set nightly
9488
- name: Build vrf tests
9589
run: |
96-
cd vrf
97-
cargo build --release --tests
90+
make build-vrf
9891
- name: Run vrf tests
9992
run: |
100-
cd vrf
101-
cargo test --release -- -Z unstable-options --report-time
93+
make test-vrf
10294
10395
p2p-tests:
10496
runs-on: ubuntu-22.04
@@ -123,8 +115,7 @@ jobs:
123115

124116
- name: Test p2p crate
125117
run: |
126-
cargo test -p p2p --tests
127-
118+
make test-p2p
128119
129120
build:
130121
runs-on: ubuntu-22.04
@@ -149,7 +140,7 @@ jobs:
149140

150141
- name: Release build
151142
run: |
152-
cargo build --release --bin openmina
143+
make build-release
153144
154145
- name: Upload binaries
155146
uses: actions/upload-artifact@v4
@@ -182,10 +173,8 @@ jobs:
182173

183174
- name: Release build
184175
run: |
185-
cd node/web
186176
rustup component add rust-src rustfmt --toolchain nightly-x86_64-unknown-linux-gnu
187-
cargo +nightly build --release --target wasm32-unknown-unknown
188-
wasm-bindgen --keep-debug --web --out-dir pkg ../../target/wasm32-unknown-unknown/release/openmina_node_web.wasm
177+
make build-wasm
189178
190179
build-tests:
191180
runs-on: ubuntu-22.04

Makefile

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ help: ## Ask for help!
88
build: ## Build the project in debug mode
99
cargo build
1010

11+
.PHONY: build-ledger
12+
build-ledger: download-circuits ## Build the ledger binary and library, requires nightly Rust
13+
@cd ledger && cargo +nightly build --release --tests
14+
1115
.PHONY: build-release
1216
build-release: ## Build the project in release mode
1317
cargo build --release --bin openmina
@@ -16,9 +20,14 @@ build-release: ## Build the project in release mode
1620
build-tests: ## Build test binaries
1721
cargo build --release --tests --package=openmina-node-testing --package=cli
1822

23+
.PHONY: build-vrf
24+
build-vrf: ## Build the VRF package
25+
@cd vrf && cargo +nightly build --release --tests
26+
1927
.PHONY: build-wasm
2028
build-wasm: ## Build WebAssembly node
21-
cd node/web && cargo +nightly build --release --target wasm32-unknown-unknown
29+
@cd node/web && cargo +nightly build --release --target wasm32-unknown-unknown
30+
@wasm-bindgen --keep-debug --web --out-dir pkg target/wasm32-unknown-unknown/release/openmina_node_web.wasm
2231

2332
.PHONY: check
2433
check: ## Check code for compilation errors
@@ -36,6 +45,15 @@ check-format: ## Check code formatting
3645
clean: ## Clean build artifacts
3746
cargo clean
3847

48+
.PHONY: download-circuits
49+
download-circuits: ## Download the circuits used by Mina from GitHub
50+
@if [ ! -d "circuit-blobs" ]; then \
51+
git clone --depth 1 https://github.com/openmina/circuit-blobs.git; \
52+
ln -s -b "$$PWD"/circuit-blobs/* ledger/; \
53+
else \
54+
echo "circuit-blobs already exists, skipping download."; \
55+
fi
56+
3957
.PHONY: format
4058
format: ## Format code using rustfmt
4159
cargo +nightly fmt
@@ -49,8 +67,8 @@ test: ## Run tests
4967
cargo test
5068

5169
.PHONY: test-ledger
52-
test-ledger: ## Run ledger tests
53-
cd ledger && cargo test --release
70+
test-ledger: build-ledger ## Run ledger tests in release mode, requires nightly Rust
71+
@cd ledger && cargo +nightly test --release -- -Z unstable-options --report-time
5472

5573
.PHONY: test-p2p
5674
test-p2p: ## Run P2P tests
@@ -61,5 +79,5 @@ test-release: ## Run tests in release mode
6179
cargo test --release
6280

6381
.PHONY: test-vrf
64-
test-vrf: ## Run VRF tests
65-
cd vrf && cargo test --release
82+
test-vrf: ## Run VRF tests, requires nightly Rust
83+
@cd vrf && cargo +nightly test --release -- -Z unstable-options --report-time

0 commit comments

Comments
 (0)