generated from stacks-network/.github
-
Notifications
You must be signed in to change notification settings - Fork 15
191 lines (162 loc) · 5.26 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
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
name: Continuous Integration
on:
push:
branches: [main]
paths-ignore:
- "**.md"
- "**.yml"
- "**.yaml"
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
branches: [main]
paths-ignore:
- "**.md"
- "**.yml"
- "**.yaml"
merge_group:
types: [checks_requested]
env:
CARGO_TERM_COLOR: always
jobs:
fmt:
name: Code Formatting
runs-on: ubuntu-latest
steps:
- name: Checkout PR
uses: actions/checkout@v4
- name: Use Rust nightly with rustfmt
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- run: cargo fmt -- --config group_imports=StdExternalCrate,imports_granularity=Module --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- name: Checkout PR
uses: actions/checkout@v4
- name: Use Rust stable with clippy
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- run: cargo clippy --no-deps --all-features --all-targets -- -D warnings -D clippy::expect_used -D clippy::unwrap_used -D clippy::unimplemented
# Create tests and code coverage archives using llvm-cov.
build-test-artifacts:
runs-on: ubuntu-latest
needs: [fmt, clippy]
strategy:
matrix:
clarity_version: [1, 2, 3]
name: Clarity::V${{ matrix.clarity_version }} Artifacts
steps:
- name: Checkout PR
uses: actions/checkout@v4
- name: Use Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Install nextest
uses: taiki-e/install-action@nextest
- name: Create archive of test binaries
run: |
cargo llvm-cov nextest-archive \
--features test-clarity-v${{ matrix.clarity_version }} \
--workspace \
--archive-file nextest-archive-v${{ matrix.clarity_version }}.tar.zst
- name: Upload test binaries
uses: actions/upload-artifact@v4
with:
name: nextest-archive-v${{ matrix.clarity_version }}
path: nextest-archive-v${{ matrix.clarity_version }}.tar.zst
if-no-files-found: error
- name: Upload standard.wasm file
uses: actions/upload-artifact@v4
with:
name: standard-v${{ matrix.clarity_version }}.wasm
path: ${{github.workspace}}/clar2wasm/src/standard/standard.wasm
if-no-files-found: error
# Run the tests and generates coverage reports
# using the precompiled data from the build-test-artifacts job.
run-tests:
runs-on: ubuntu-latest
needs: build-test-artifacts
strategy:
fail-fast: false
matrix:
clarity_version: [1, 2, 3]
name: Clarity::V${{ matrix.clarity_version }} Tests
steps:
- name: Checkout PR
uses: actions/checkout@v4
- name: Use Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Install nextest
uses: taiki-e/install-action@nextest
- name: Download standard.wasm file
uses: actions/download-artifact@v4
with:
name: standard-v${{ matrix.clarity_version }}.wasm
path: ${{github.workspace}}/clar2wasm/src/standard/
- name: Download archive
uses: actions/download-artifact@v4
with:
name: nextest-archive-v${{ matrix.clarity_version }}
- name: Run tests and output coverage
shell: bash
run: |
cargo llvm-cov nextest \
--archive-file nextest-archive-v${{ matrix.clarity_version }}.tar.zst \
--codecov \
--output-path codecov-v${{ matrix.clarity_version }}.json
- name: Upload codecov.json
uses: actions/upload-artifact@v4
with:
name: code-coverage-v${{ matrix.clarity_version }}
path: codecov-v${{ matrix.clarity_version }}.json
if-no-files-found: error
# Code coverage
codecov:
runs-on: ubuntu-latest
if: ${{ always() }}
needs: run-tests
strategy:
fail-fast: false
matrix:
clarity_version: [1, 2, 3]
name: Clarity::V${{ matrix.clarity_version }} Code Coverage
steps:
- name: Download codecov.json
uses: actions/download-artifact@v4
with:
name: code-coverage-v${{ matrix.clarity_version }}
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v4
with:
files: codecov-v${{ matrix.clarity_version }}.json
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
# Compile boot contracts with a release version.
compile-boot-contracts:
name: Compile boot-contracts
runs-on: ubuntu-latest
needs: [fmt, clippy]
defaults:
run:
working-directory: ./clar2wasm
steps:
- name: Checkout PR
uses: actions/checkout@v4
- name: Use Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Setup wasm-tools
uses: bytecodealliance/actions/wasm-tools/setup@v1
- name: Compile boot-contracts
run: |
cargo build --release
bash ./scripts/boot-contracts-compile.sh