-
Notifications
You must be signed in to change notification settings - Fork 7
160 lines (137 loc) · 5.05 KB
/
ci.yaml
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
name: Openmina CI
on:
push:
branches: [ main, develop ]
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
ledger-tests:
runs-on: ubuntu-20.04
env:
CARGO_TERM_COLOR: always
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Setup Rust
run: |
# Nightly to be able to use `--report-time` below
rustup install nightly
rustup override set nightly
- name: Download circuits files
run: |
git clone --depth 1 https://github.com/openmina/circuit-blobs.git
ln -s -b $PWD/circuit-blobs/* ledger/
- name: Build ledger tests
run: |
cd ledger
cargo build --release --tests
- name: Run ledger tests
run: |
cd ledger
cargo test --release -- -Z unstable-options --report-time
build:
runs-on: ubuntu-20.04
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Setup Rust
run: |
rustup install 1.77
rustup override set 1.77
rustup component add clippy rustfmt
# - name: Check
# uses: actions-rs/cargo@v1
# with:
# command: check
# - name: Clippy
# uses: actions-rs/cargo@v1
# with:
# command: clippy
# # don't fail the job until clippy is fixed
# continue-on-error: true
- name: Setup Rust Cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: "ver-0"
- name: Release build
run: |
cargo build --release --bin openmina
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: bin
path: target/release/openmina
- name: Build tests
run: |
mkdir target/release/tests
cargo build --release --features=scenario-generators --package=openmina-node-testing --tests
cargo build --release --features=scenario-generators --package=openmina-node-testing --tests --message-format=json > cargo-build-test.json
jq -r '. | select(.executable != null and (.target.kind | (contains(["test"])))) | [.target.name, .executable ] | @tsv' cargo-build-test.json > tests.tsv
while read NAME FILE; do cp -a $FILE target/release/tests/$NAME; done < tests.tsv
cargo build --release --features=scenario-generators,p2p-webrtc --package=openmina-node-testing --tests
cargo build --release --features=scenario-generators,p2p-webrtc --package=openmina-node-testing --tests --message-format=json > cargo-build-test.json
jq -r '. | select(.executable != null and (.target.kind | (contains(["test"])))) | [.target.name, .executable ] | @tsv' cargo-build-test.json > tests.tsv
while read NAME FILE; do cp -a $FILE target/release/tests/webrtc_$NAME; done < tests.tsv
cargo build --release --features=scenario-generators,p2p-libp2p --package=openmina-node-testing --tests
cargo build --release --features=scenario-generators,p2p-libp2p --package=openmina-node-testing --tests --message-format=json > cargo-build-test.json
jq -r '. | select(.executable != null and (.target.kind | (contains(["test"])))) | [.target.name, .executable ] | @tsv' cargo-build-test.json > tests.tsv
while read NAME FILE; do cp -a $FILE target/release/tests/libp2p_$NAME; done < tests.tsv
tar cf tests.tar -C target/release/tests .
- name: Upload tests
uses: actions/upload-artifact@v4
with:
name: tests
path: tests.tar
p2p-tests:
needs: [ build ]
runs-on: ubuntu-20.04
container:
image: minaprotocol/mina-daemon:2.0.0berkeley-rc1-1551e2f-focal-berkeley
strategy:
matrix:
test: [p2p_basic_connections, p2p_basic_incoming, p2p_basic_outgoing]
libp2p:
- external
# - internal
fail-fast: false
env:
TEST: ${{ matrix.libp2p == 'external' && format('libp2p_{0}', matrix.test) || matrix.test }}
steps:
- name: Download tests
uses: actions/download-artifact@v4
with:
name: tests
- name: Unpack tests
run: |
tar xf tests.tar ./${{ env.TEST }}
- name: Run the test
run: |
./${{ env.TEST }} --nocapture --test-threads=1
scenario-tests:
needs: [ build ]
runs-on: ubuntu-20.04
container:
image: minaprotocol/mina-daemon:2.0.0berkeley-rc1-1551e2f-focal-berkeley
strategy:
matrix:
test:
- single_node
- multi_node
- webrtc_single_node
- webrtc_multi_node
# - connection_discovery
fail-fast: false
steps:
- name: Download tests
uses: actions/download-artifact@v4
with:
name: tests
- name: Unpack tests
run: |
tar xf tests.tar ./${{ matrix.test }}
- name: Run the test
run: |
./${{ matrix.test }} --nocapture --test-threads=1