-
Notifications
You must be signed in to change notification settings - Fork 269
291 lines (268 loc) · 9.22 KB
/
test.yml
File metadata and controls
291 lines (268 loc) · 9.22 KB
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
279
280
281
282
283
284
285
286
287
288
289
290
291
name: Build tests
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
permissions:
contents: read
env:
LLVM_PROFILE_FILE: ${{ github.workspace }}/target/solang-%p-%10m.profraw
jobs:
docs:
name: Docs
runs-on: solang-ubuntu-latest
steps:
- name: Install Python and git
run: |
sudo apt-get update
sudo apt-get install -y python3-pip git pkg-config libcairo-dev latexmk meson
- name: Checkout sources
uses: actions/checkout@v4
with:
# docs/conf.py uses `git describe --tags` which requires full history.
fetch-depth: 0
- name: Build docs
working-directory: ./docs
run: |
# Without the --add safe.directory we get the following error:
# fatal: detected dubious ownership in repository at '/__w/solang/solang'
# actions/checkout@v4 is supposed to fix this, but it does not work.
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
pip install -r requirements.txt
make html epub
linux-x86-64:
name: Linux x86-64
runs-on: solang-ubuntu-latest
container: ghcr.io/hyperledger/solang-llvm:ci-7
env:
RUSTFLAGS: -C instrument-coverage -C llvm-args=--instrprof-atomic-counter-update-all --cfg=coverage --cfg=trybuild_no_target
CARGO_INCREMENTAL: 0
CARGO_LLVM_COV: 1
CARGO_LLVM_COV_TARGET_DIR: ${{ github.workspace }}/target
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.90.0
components: |
llvm-tools
clippy
rustfmt
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Run cargo clippy
run: cargo clippy --workspace --lib --bins -- -D warnings
- name: Run Soroban test clippy
run: cargo clippy -p solang --all-features --test soroban -- -D warnings
- name: Run cargo clippy without wasm_opt feature
run: cargo clippy --workspace --no-default-features --features language_server,llvm,soroban --bins -- -D warnings
- name: Run cargo clippy without llvm feature
run: cargo clippy --workspace --no-default-features --lib -- -D warnings
- name: Run cargo clippy with only soroban feature
run: cargo clippy --workspace --no-default-features --features soroban,llvm --lib -- -D warnings
- name: Run cargo doc
run: cargo doc --workspace --bins
- name: Run cargo fmt
run: cargo fmt --all -- --check
- name: Configure llvm-cov and build
if: always()
run: |
cargo llvm-cov clean --workspace
cargo build
- name: Run library and binary tests
if: always()
run: cargo llvm-cov --all-features --workspace --lib --bins --no-report --jobs 2
- name: Run Soroban Rust tests
if: always()
run: cargo llvm-cov --all-features --test soroban --no-report --jobs 2
- name: Upload binary
uses: actions/upload-artifact@v4.4.0
with:
name: solang-linux-x86-64
path: ./target/debug/solang
- name: Compress test coverage files
run: |
rm -rf bpf wasm tmp cxxbridge CACHEDIR.TAG
rm -rf debug/build debug/deps debug/examples debug/incremental
tar -czvf rust-tests.tar.gz *
working-directory: ./target
- name: Upload test coverage files
uses: actions/upload-artifact@v4.4.0
with:
name: rust-tests.tar.gz
path: ./target/rust-tests.tar.gz
soroban:
name: Soroban Integration test
runs-on: solang-ubuntu-latest
container: ghcr.io/hyperledger/solang-llvm:ci-7
env:
SSL_CERT_FILE: /etc/ssl/certs/ca-certificates.crt
needs: linux-x86-64
steps:
- name: Checkout sources
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
- uses: dtolnay/rust-toolchain@1.90.0
with:
target: wasm32-unknown-unknown
- uses: actions/download-artifact@v4.1.8
with:
name: solang-linux-x86-64
path: bin
- name: Solang Compiler
run: |
chmod 755 ./bin/solang
echo "$(pwd)/bin" >> $GITHUB_PATH
- name: Install system dependencies
run: |
apt-get update
apt-get install -y --no-install-recommends \
ca-certificates curl openssl libdbus-1-dev pkg-config
update-ca-certificates
- name: Install Stellar CLI
run: cargo install --locked stellar-cli --version 23.0.0
- name: Add wasm32v1-none target
run: rustup target add wasm32v1-none
- name: Add cargo install location to PATH
run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- run: npm install
working-directory: ./integration/soroban
- name: Build Solang contracts
run: npm run build
working-directory: ./integration/soroban
- name: Build Rust contracts
run: stellar contract build --profile release-with-logs
working-directory: ./integration/soroban/rust/contracts
- name: Setup Soroban environment
run: npm run setup
working-directory: ./integration/soroban
- name: Deploy and test contracts
run: npm run test
working-directory: ./integration/soroban
- name: Upload test coverage files
uses: actions/upload-artifact@v4.4.0
with:
name: soroban-tests
path: ./target/*.profraw
std-lib-tests:
name: Stdlib
runs-on: solang-ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Lints for stdlib
run: make lint
working-directory: ./stdlib
- name: Stdlib tests
run: |
make test
./test
working-directory: ./stdlib
vscode:
name: Visual Code Extension
runs-on: solang-ubuntu-latest
needs: linux-x86-64
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/download-artifact@v4.1.8
with:
name: solang-linux-x86-64
path: bin
- run: |
chmod 755 ./bin/solang
echo "$(pwd)/bin" >> $GITHUB_PATH
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: '>=18.17'
- run: npm install
working-directory: ./vscode
- run: npm run compile
working-directory: ./vscode
- name: Run headless test
run: xvfb-run npm test
working-directory: ./vscode
- run: npm install -g vsce
working-directory: ./vscode
- run: vsce package
working-directory: ./vscode
- name: Upload test coverage files
uses: actions/upload-artifact@v4.4.0
with:
name: vscode-tests
path: ./target/*.profraw
coverage:
name: Coverage report
runs-on: ubuntu-latest
container: ghcr.io/hyperledger/solang-llvm:ci-7
needs: [linux-x86-64, soroban, vscode]
env:
RUSTFLAGS: -C instrument-coverage -C llvm-args=--instrprof-atomic-counter-update-all --cfg=coverage --cfg=trybuild_no_target
CARGO_INCREMENTAL: 0
CARGO_LLVM_COV: 1
CARGO_LLVM_COV_TARGET_DIR: ${{ github.workspace }}/target
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.90.0
components: llvm-tools
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Download Rust coverage files
uses: actions/download-artifact@v4.1.8
with:
name: rust-tests.tar.gz
path: ./target
- name: Download Soroban coverage files
uses: actions/download-artifact@v4.1.8
with:
name: soroban-tests
path: ./target
- name: Download VS Code coverage files
uses: actions/download-artifact@v4.1.8
with:
name: vscode-tests
path: ./target
- name: Unpack test coverage files
run: tar -xf rust-tests.tar.gz
working-directory: ./target
- name: Generate code report
run: cargo llvm-cov report --lcov --output-path lcov.info
- name: Upload coverage report to codecov.io
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
fail_ci_if_error: false
container:
name: Container Image
runs-on: solang-ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
permissions:
contents: read
packages: write
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
fetch-depth: 0
- run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
docker buildx build . \
--push \
--tag ghcr.io/${GITHUB_REPOSITORY}:latest \
--label org.opencontainers.image.description="Solidity Compiler for Soroban version $(git describe --tags)"