forked from OffchainLabs/nitro
-
Notifications
You must be signed in to change notification settings - Fork 13
194 lines (167 loc) · 5.84 KB
/
arbitrator-ci.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
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
193
194
name: Arbitrator CI
run-name: Arbitrator CI triggered from @${{ github.actor }} of ${{ github.head_ref }}
on:
workflow_dispatch:
merge_group:
pull_request:
paths:
- 'arbitrator/**'
- 'contracts'
- '.github/workflows/arbitrator-ci.yml'
- 'Makefile'
push:
branches:
- master
env:
RUST_BACKTRACE: 1
RUSTFLAGS: -Dwarnings
WABT_VERSION: 1.0.32
jobs:
coverage:
name: Run Arbitrator tests
runs-on: ubuntu-8
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Ubuntu dependencies
run: |
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update && sudo apt-get install -y \
build-essential cmake ethereum lld-14 libudev-dev
sudo ln -s /usr/bin/wasm-ld-14 /usr/local/bin/wasm-ld
- name: Install go
uses: actions/setup-go@v4
with:
go-version: 1.20.x
- name: Setup nodejs
uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'
- name: Install rust stable
uses: actions-rs/toolchain@v1
id: install-rust
with:
profile: minimal
toolchain: "stable"
override: true
components: 'llvm-tools-preview, rustfmt, clippy'
- name: Install grcov
uses: actions-rs/install@v0.1
with:
crate: grcov
version: latest
use-tool-cache: true
- name: Install rust wasm targets
run: rustup target add wasm32-wasi wasm32-unknown-unknown
- name: Cache Rust intermediate build products
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
arbitrator/target/
arbitrator/wasm-libraries/target/
key: ${{ runner.os }}-cargo-${{ steps.install-rust.outputs.rustc_hash }}-full-${{ hashFiles('arbitrator/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ steps.install-rust.outputs.rustc_hash }}-full-
${{ runner.os }}-cargo-${{ steps.install-rust.outputs.rustc_hash }}-
- name: Cache wabt build
id: cache-wabt
uses: actions/cache@v3
with:
path: ~/wabt-prefix
key: ${{ runner.os }}-wabt-${{ env.WABT_VERSION }}
- name: Install latest wabt
if: steps.cache-wabt.outputs.cache-hit != 'true'
run: |
cd "$(mktemp -d)"
git clone --recursive -b "$WABT_VERSION" https://github.com/WebAssembly/wabt .
mkdir build
cd build
mkdir -p ~/wabt-prefix
cmake .. -DCMAKE_INSTALL_PREFIX="$HOME/wabt-prefix"
make -j
make install
- name: Cache cbrotli
uses: actions/cache@v3
id: cache-cbrotli
with:
path: |
target/include/brotli/
target/lib-wasm/
target/lib/libbrotlicommon-static.a
target/lib/libbrotlienc-static.a
target/lib/libbrotlidec-static.a
key: ${{ runner.os }}-brotli-3-${{ hashFiles('scripts/build-brotli.sh') }}-${{ hashFiles('.github/workflows/arbitrator-ci.yaml') }}
restore-keys: ${{ runner.os }}-brotli-2-
- name: Build cbrotli-local
if: steps.cache-cbrotli.outputs.cache-hit != 'true'
run: ./scripts/build-brotli.sh -l
- name: Setup emsdk
if: steps.cache-cbrotli.outputs.cache-hit != 'true'
uses: mymindstorm/setup-emsdk@v12
with:
# Make sure to set a version number!
version: 3.1.6
# This is the name of the cache folder.
# The cache folder will be placed in the build directory,
# so make sure it doesn't conflict with anything!
actions-cache-folder: 'emsdk-cache'
no-cache: true
- name: Build cbrotli-wasm
if: steps.cache-cbrotli.outputs.cache-hit != 'true'
run: ./scripts/build-brotli.sh -w
- name: Add wabt to path
run: echo "$HOME/wabt-prefix/bin" >> "$GITHUB_PATH"
- name: Make arbitrator libraries
run: make -j wasm-ci-build
- name: Enable rust instrumentation
run: |
echo LLVM_PROFILE_FILE="your_name-%p-%m.profraw" >> $GITHUB_ENV
echo "CARGO_INCREMENTAL=0" >> $GITHUB_ENV
echo RUSTFLAGS="-Cinstrument-coverage" >> $GITHUB_ENV
echo RUSTDOCFLAGS="-Cpanic=abort" >> $GITHUB_ENV
- name: Clippy check
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all --manifest-path arbitrator/Cargo.toml -- -D warnings
- name: Run rust tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all --manifest-path arbitrator/Cargo.toml
- name: Rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all --manifest-path arbitrator/Cargo.toml -- --check
- name: Make proofs from test cases
run: make -j test-gen-proofs
- name: Create code-coverage files
run: |
grcov . --binary-path arbitrator/target/release/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info
- name: Upload to codecov.io
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./lcov.info
fail_ci_if_error: true
verbose: false
- name: Start geth server
run: |
geth --dev --http --http.port 8545 &
sleep 2
- name: Run proof validation tests
run: |
npm install --global yarn
cd contracts
yarn install
yarn build
yarn hardhat --network localhost test test/prover/*.ts