-
Notifications
You must be signed in to change notification settings - Fork 24
/
.gitlab-ci.yml
200 lines (177 loc) · 6.21 KB
/
.gitlab-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
variables:
CI_DISPOSABLE_ENVIRONMENT: "true"
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://localhost:2375
DOCKER_TLS_CERTDIR: ""
.base:
image: xenoky/lwk-builder@sha256:c933878376fad314c7f6ca347fd4de7d6c957fce9994ceaabc1ce75315e98bbc
tags:
- cloud
retry:
max: 2
when:
- runner_system_failure
- unknown_failure
- stuck_or_timeout_failure
services:
- docker:20.10.12-dind
fmt_clippy:
extends: .base
script:
- cp ./context/env.sh / && cd / && . ./env.sh && cd -
- cargo fmt --check
- cargo clippy --all-targets -- -D warnings
test_clean:
image: rust:1.75
script:
- cargo build
test_wollet:
extends: .base
script:
- docker pull xenoky/local-jade-emulator:1.0.27
- cp ./context/env.sh / && cd / && . ./env.sh && cd -
- cargo test -p lwk_wollet -p lwk_signer
test_jade:
extends: .base
variables:
TMPDIR: ${CI_PROJECT_DIR} # otherwise issue with the docker
script:
- docker pull tulipan81/blind_pin_server:v0.0.7
- docker pull xenoky/local-jade-emulator:1.0.27
- cargo test -p lwk_jade
test_ledger:
extends: .base
script:
- cargo test -p lwk_ledger --features asyncr
test_serial:
extends: .base
variables:
script:
- cp ./context/env.sh / && cd / && . ./env.sh && cd -
- cargo test --no-run --features serial
# run tests for minor crates all together
test_minor:
extends: .base
script:
- cargo test -p lwk_tiny_jrpc -p lwk_app -p lwk_containers -p lwk_common -p lwk_hwi -p lwk_rpc_model -p lwk_signer
test_cli:
extends: .base
script:
- cp ./context/env.sh / && cd / && . ./env.sh && cd -
- cargo test -p lwk_cli
unit_tests:
extends: .base
script:
- cargo nextest run --lib --profile unit # ensure unit tests don't take more than a sec each
test_coverage:
extends: .base
variables:
RUSTFLAGS: "-C instrument-coverage"
LLVM_PROFILE_FILE: "coverage-%p-%m.profraw"
TMPDIR: ${CI_PROJECT_DIR} # otherwise issue with the docker
script:
- docker pull tulipan81/blind_pin_server:v0.0.7
- docker pull xenoky/local-jade-emulator:1.0.27
- cp ./context/env.sh / && cd / && . ./env.sh && cd -
- cargo nextest run --features foreign_bindings,asyncr --profile ci
- grcov . -s . --binary-path ./target/debug/ -t cobertura --branch --ignore-not-existing --ignore "*cargo*" -o ./target/coverage.xml -p $(pwd)
- "xmllint --xpath \"concat('Coverage: ', 100 * string(//coverage/@line-rate), ' perc')\" target/coverage.xml"
- grcov . -s . --binary-path ./target/debug/ -t html --branch --ignore-not-existing --ignore "*cargo*" -o ./target/coverage/ -p $(pwd)
coverage: '/Coverage: \d+(?:\.\d+)?/'
artifacts:
paths:
- target/coverage.xml
- target/coverage/
- target/nextest/ci/junit.xml
reports:
coverage_report:
coverage_format: cobertura
path: target/coverage.xml
junit: target/nextest/ci/junit.xml
build_cli:
extends: .base
only:
- master@liquid/lwk
script:
- cargo build --release -p lwk_cli
artifacts:
paths:
- target/release/lwk_cli
when: always
expire_in: 14 days
audit:
extends: .base
script:
- cargo audit
doc:
extends: .base
variables:
RUSTDOCFLAGS: "-D warnings --cfg docsrs"
script:
- cp ./context/env.sh / && cd / && . ./env.sh && cd -
- cargo +nightly doc --all-features --no-deps
examples:
extends: .base
script:
- cargo run --example list_transactions
bindings:
extends: .base
script:
- cp ./context/env.sh / && cd / && . ./env.sh && cd -
- cargo test -p lwk_bindings --features foreign_bindings
csharp:
extends: .base
script:
- cargo build --release -p lwk_bindings
- mkdir csharp
- cp target/release/liblwk.so csharp/
- uniffi-bindgen-cs --library csharp/liblwk.so --out-dir csharp
- sed -i 's#\"lwk\"#\"./liblwk.so\"#g' csharp/lwk.cs # this is an hack, but make it work until we understand how to properly reference the dynamic lib
- cp lwk_bindings/tests/bindings/list_transactions.cs csharp
- cp lwk_bindings/tests/test_data/test-dotnet.csproj csharp
- cd csharp && dotnet run && cd -
- rm -rf csharp/bin && rm -rf csharp/obj # remove dotnet-build created files
artifacts:
paths:
- csharp
just:
extends: .base
script:
- just python-test-bindings
- just kotlin # kotlin-android would require cargo-ndk and various targets, tested on github which produce the kotlin package
wasm:
extends: .base
variables:
RUSTFLAGS: "--cfg=web_sys_unstable_apis"
script:
- cp ./context/env.sh / && cd / && . ./env.sh && cd -
- cargo check --target wasm32-unknown-unknown -p lwk_common -p lwk_rpc_model -p lwk_containers -p lwk_hwi
- cargo check --target wasm32-unknown-unknown -p lwk_wollet --no-default-features --features esplora,serial
- cargo check --target wasm32-unknown-unknown -p lwk_signer --no-default-features
- cargo check --target wasm32-unknown-unknown -p lwk_jade --no-default-features --features asyncr --features serial
- cargo check --target wasm32-unknown-unknown -p lwk_ledger --no-default-features
- cd lwk_wasm && WASM_BINDGEN_TEST_TIMEOUT=60 wasm-pack test --chrome --headless --features serial && cd -
- cd lwk_wasm && RUSTFLAGS="--cfg=web_sys_unstable_apis" CARGO_PROFILE_RELEASE_OPT_LEVEL=z wasm-pack build --features serial && cd -
artifacts:
paths:
- lwk_wasm/pkg
linux-wheels:
image:
name: ghcr.io/pyo3/maturin
entrypoint: [""]
script:
- pip install uniffi-bindgen==0.28.0 # major version must be the same as in lwk_bindings/Cargo.toml
- maturin build --release -m lwk_bindings/Cargo.toml -b uniffi
artifacts:
paths:
- target/wheels/
nix:
image: nixos/nix:2.22.0pre20240417_c16fc2c
variables:
EXP_FEAT: --extra-experimental-features nix-command --extra-experimental-features flakes
CACHE: --extra-trusted-public-keys nix.casatta.it:HseKZh7436/vKXfZDBHbhr7wwAkzjLwY5BIq+OOrITg= --extra-substituters https://nix.casatta.it
script:
- nix $EXP_FEAT $CACHE build .
- nix $EXP_FEAT $CACHE develop . -c cargo test -p lwk_cli --features registry -- registry_publish
- nix $EXP_FEAT $CACHE develop . -c rust-analyzer analysis-stats . 2>log # prints ERROR if there are cyclic deps with dev-deps
- (! grep ERROR log)