This repository has been archived by the owner on Jul 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
216 lines (198 loc) · 6.25 KB
/
rust-tests.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
name: rust-tests
on:
merge_group:
push:
branches: [ main ]
pull_request:
branches: [ '*' ]
env:
CARGO_TERM_COLOR: always
RUST_TOOLCHAIN: '1.74.1'
jobs:
build:
name: Build with release profile
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust $RUST_TOOLCHAIN
uses: dtolnay/rust-toolchain@master
with:
toolchain: $RUST_TOOLCHAIN
components: rustfmt, clippy
- name: Python3 Build
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Install deps
run: make deps
- name: Build
run: make build
lint:
name: Lint with fmt and clippy
runs-on: ubuntu-latest
env:
MLIR_SYS_170_PREFIX: /usr/lib/llvm-17/
TABLEGEN_170_PREFIX: /usr/lib/llvm-17/
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust $RUST_TOOLCHAIN
uses: dtolnay/rust-toolchain@master
with:
toolchain: $RUST_TOOLCHAIN
components: rustfmt, clippy
- name: Python3 Build
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: check and free hdd space left
run: |
echo "Listing 20 largest packages"
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 20
df -h
sudo apt-get update
sudo apt-get remove -y '^llvm-.*'
sudo apt-get remove -y 'php.*'
sudo apt-get remove -y '^dotnet-.*'
sudo apt-get remove -y '^temurin-.*'
sudo apt-get remove -y azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox powershell mono-devel
sudo apt-get autoremove -y
sudo apt-get clean
df -h
echo "Removing large directories"
# deleting 15GB
sudo rm -rf /usr/share/dotnet/
sudo rm -rf /usr/local/lib/android
df -h
- name: add llvm deb repository
uses: myci-actions/add-deb-repo@10
with:
repo: deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main
repo-name: llvm-repo
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key
- name: Install LLVM
run: sudo apt-get install llvm-17 llvm-17-dev llvm-17-runtime clang-17 clang-tools-17 lld-17 libpolly-17-dev libmlir-17-dev mlir-17-tools
- name: Install deps
run: make deps
- name: Format
run: cargo fmt --all -- --check
- name: Run clippy
run: make clippy
tests:
env:
RPC_ENDPOINT_TESTNET: ${{ secrets.JUNO_ENDPOINT_TESTNET }}
RPC_ENDPOINT_MAINNET: ${{ secrets.JUNO_ENDPOINT_MAINNET }}
MLIR_SYS_170_PREFIX: /usr/lib/llvm-17/
TABLEGEN_170_PREFIX: /usr/lib/llvm-17/
strategy:
fail-fast: false
matrix:
target: [ test-cairo-1, test-cairo-2, test-doctests, test-cairo-native ]
name: Run tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust $RUST_TOOLCHAIN
uses: dtolnay/rust-toolchain@master
with:
toolchain: $RUST_TOOLCHAIN
components: rustfmt, clippy
- name: Python3 Build
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Install deps
run: make deps
- name: Install testing tools
# TODO: remove `if` when nextest adds doctests support
if: ${{ matrix.target != 'test-doctests' }}
uses: taiki-e/install-action@v2
with:
tool: [email protected]
- name: check and free hdd space left
run: |
echo "Listing 20 largest packages"
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 20
df -h
sudo apt-get update
sudo apt-get remove -y '^llvm-.*'
sudo apt-get remove -y 'php.*'
sudo apt-get remove -y '^dotnet-.*'
sudo apt-get remove -y '^temurin-.*'
sudo apt-get remove -y azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox powershell mono-devel
sudo apt-get autoremove -y
sudo apt-get clean
df -h
echo "Removing large directories"
# deleting 15GB
sudo rm -rf /usr/share/dotnet/
sudo rm -rf /usr/local/lib/android
df -h
- name: add llvm deb repository
uses: myci-actions/add-deb-repo@10
with:
repo: deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main
repo-name: llvm-repo
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key
- name: Install LLVM
run: sudo apt-get install llvm-17 llvm-17-dev llvm-17-runtime clang-17 clang-tools-17 lld-17 libpolly-17-dev libmlir-17-dev mlir-17-tools
- name: Run tests (${{ matrix.target }})
run: make ${{ matrix.target }}
coverage:
name: Generate and upload coverage report
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/[email protected]
with:
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Cache coverage report
id: restore-report
uses: actions/cache/restore@v3
with:
path: lcov.info
key: coverage-cache-${{ github.sha }}
- name: Python3 Build
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Install deps
run: make deps
- name: Generate coverage report
if: steps.restore-report.outputs.cache-hit != 'true'
run: make coverage-report
- name: Save coverage report
if: steps.restore-report.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: lcov.info
key: coverage-cache-${{ github.sha }}
- name: Upload coverage to codecov.io
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info