-
Notifications
You must be signed in to change notification settings - Fork 49
278 lines (246 loc) · 7.94 KB
/
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
name: Tests
on:
push:
branches:
- master
- develop
pull_request:
types:
- opened
- synchronize
jobs:
build_wo_default_features:
name: Build without default features
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
override: true
- name: Build ergotree-ir
uses: actions-rs/cargo@v1
with:
command: build
args: --no-default-features --manifest-path ergotree-ir/Cargo.toml
- name: Build ergo-lib
uses: actions-rs/cargo@v1
with:
command: rustc
args: --no-default-features --manifest-path ergo-lib/Cargo.toml --crate-type rlib
test:
name: Tests on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions-rs/toolchain@v1
with:
override: true
- name: cargo fetch
uses: actions-rs/cargo@v1
with:
command: fetch
- name: Build tests
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --release --tests
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --release
test_coverage:
name: Code coverage in tests
runs-on: ubuntu-latest
container:
image: xd009642/tarpaulin:latest
options: --security-opt seccomp=unconfined
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Generate code coverage
run: |
cargo tarpaulin --avoid-cfg-tarpaulin --timeout=360 --out lcov --exclude-files 'bindings/**/*.*' --exclude-files 'ergo-rest/src/reqwest.rs' --exclude-files 'ergo-rest/src/reqwest/**/*.*' --exclude-files 'ergo-rest/src/wasm_timer.rs' --exclude-files 'ergo-rest/src/wasm_timer/**/*.*'
- name: Push code coverage results to coveralls.io
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./lcov.info
clippy:
name: Clippy (linter)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
components: clippy
override: true
- name: Check with Clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets -- -D warnings
js_tests:
name: Run JS tests and publish alpha versions
runs-on: ubuntu-latest
env:
HAS_NPM_TOKEN: ${{ secrets.NPM_TOKEN != '' }}
# Service containers to run `ergo` node in `devnet` mode
services:
# Label used to access the service container
ergo_node:
# Docker Hub image
image: ergoplatform/ergo-devnet:latest
ports:
# Maps tcp port 9053 on service container to the host
- 9053:9053
steps:
# Need the following command to get around a GA bug where the workspace can't be cleared due
# to incorrect access permissions. This comes up due to the use of the service container
# above. See https://github.com/actions/checkout/issues/211
- name: set_file_permissions
run: sudo chown -R $USER:$USER ${{ github.workspace }}
- name: checkout
uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
override: true
- name: install deps
run: |
cd bindings/ergo-lib-wasm
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get -y install nodejs
- name: run Wasm tests
run: |
cd bindings/ergo-lib-wasm
wasm-pack build
# wasm-pack test --firefox --headless
# wasm-pack test --firefox --headless --release
wasm-pack test --chrome --headless
wasm-pack test --chrome --headless --release
- name: run node JS tests
run: |
cd bindings/ergo-lib-wasm
wasm-pack build
npm install
npm run test
- name: run browser JS tests
run: |
cd bindings/ergo-lib-wasm
wasm-pack build
npm install
npm run test-browser
- name: build alpha versions
run: |
cd bindings/ergo-lib-wasm
npm run build-nodejs-alpha
npm run build-browser-alpha
- name: publish nodejs alpha version to npm
if: env.HAS_NPM_TOKEN == 'true'
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./bindings/ergo-lib-wasm/pkg-nodejs/package.json
tag: "alpha"
- name: publish browser alpha version to npm
if: env.HAS_NPM_TOKEN == 'true'
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./bindings/ergo-lib-wasm/pkg-browser/package.json
tag: "alpha"
rustfmt:
name: Code formatting (rustfmt)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
components: rustfmt
override: true
- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check --color always
doc-links:
name: Check intra-documentation links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
override: true
- name: cargo fetch
uses: actions-rs/cargo@v1
with:
command: fetch
# Ensure intra-documentation links all resolve correctly
# Requires #![deny(broken_intra_doc_links)] in crate.
- name: Check intra-doc links
uses: actions-rs/cargo@v1
with:
command: doc
args: --document-private-items
ios_tests:
name: Test Swift(iOS) bindings
runs-on: ubuntu-latest
# Service containers to run `ergo` node in `devnet` mode
services:
# Label used to access the service container
ergo_node:
# Docker Hub image
image: ergoplatform/ergo-devnet:latest
ports:
# Maps tcp port 9053 on service container to the host
- 9053:9053
steps:
- uses: fwal/setup-swift@v1
- name: checkout
uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2024-01-26
override: true
- name: install deps
run: cargo install cbindgen
- name: generate C-bindings header file
run: |
cd bindings/ergo-lib-c
cbindgen --config cbindgen.toml --crate ergo-lib-c --output h/ergo_lib.h
- uses: actions-rs/toolchain@v1
with:
override: true
- name: build and run tests
run: |
cargo build --all-features -p ergo-lib-c
cd bindings/ergo-lib-ios
swift test -Xlinker -L../../target/debug/
android_tests:
name: Test JNI(Android) bindings
runs-on: macos-12
steps:
- name: checkout
uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
override: true
- name: install deps
run: |
rustup target add armv7-linux-androideabi # for arm
rustup target add i686-linux-android # for x86
rustup target add aarch64-linux-android # for arm64
rustup target add x86_64-linux-android # for x86_64
- name: run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
ndk: 26.2.11394342
emulator-build: 6110076
script: cd ./bindings/ergo-lib-jni && ./gradlew connectedCheck