-
Notifications
You must be signed in to change notification settings - Fork 536
157 lines (132 loc) · 4.51 KB
/
unit_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
name: Unit Tests
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
workflow_dispatch:
env:
CARGO_SCCACHE_COMMIT: bed5571c
jobs:
avail_unit_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
- name: Install build-essential
run: |
sudo apt update
sudo apt install -y build-essential
sudo apt install -y git clang curl libssl-dev protobuf-compiler
# Restore cache from `build`
- uses: actions/cache/restore@v3
with:
path: |
~/.cache/
~/.cargo/bin/sccache*
key: ${{ runner.OS }}-sccache-bin-${{ env.CARGO_SCCACHE_COMMIT }}-v1
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential pkg-config libssl-dev valgrind git clang curl libssl-dev protobuf-compiler unzip python3-pip
- name: Setup Rust toolchain
run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y
source "$HOME/.cargo/env"
rustup show
- name: Set PATH for cargo
run: |
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
echo "SCCACHE_DIR=${HOME}/.cache/sccache" >> $GITHUB_ENV
- name: SCCache
run: |
# We altered the path to avoid old actions to overwrite it
if [ ! -f ~/.cargo/bin/sccache ]; then
cargo install sccache \
--git https://github.com/purestake/sccache.git \
--rev $CARGO_SCCACHE_COMMIT \
--force --no-default-features --features=dist-client
fi
if [[ -z `pgrep sccache` ]]; then
chmod +x ~/.cargo/bin/sccache
sccache --start-server
fi
sccache -s
echo "RUSTC_WRAPPER=${HOME}/.cargo/bin/sccache" >> $GITHUB_ENV
- name: Run tests
run: |
env
cargo test --release --workspace
env:
RUSTFLAGS: "-C instrument-coverage"
LLVM_PROFILE_FILE: "profile-%p-%m.profraw"
- name: Display SCCache Stats
run: sccache --show-stats
- name: Cleanup
run: find . -name \*.profraw -type f -exec rm -f {} +
subxt_unit_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
- name: Install build-essential
run: |
sudo apt update
sudo apt install -y build-essential
sudo apt install -y git clang curl libssl-dev protobuf-compiler
# Restore cache from `build`
- uses: actions/cache/restore@v3
with:
path: |
~/.cache/
~/.cargo/bin/sccache*
key: ${{ runner.OS }}-sccache-bin-${{ env.CARGO_SCCACHE_COMMIT }}-v1
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential pkg-config libssl-dev valgrind git clang curl libssl-dev protobuf-compiler unzip python3-pip
- name: Setup Rust toolchain
run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y
source "$HOME/.cargo/env"
rustup show
- name: Set PATH for cargo
run: |
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
echo "SCCACHE_DIR=${HOME}/.cache/sccache" >> $GITHUB_ENV
- name: SCCache
run: |
# We altered the path to avoid old actions to overwrite it
if [ ! -f ~/.cargo/bin/sccache ]; then
cargo install sccache \
--git https://github.com/purestake/sccache.git \
--rev $CARGO_SCCACHE_COMMIT \
--force --no-default-features --features=dist-client
fi
if [[ -z `pgrep sccache` ]]; then
chmod +x ~/.cargo/bin/sccache
sccache --start-server
fi
sccache -s
echo "RUSTC_WRAPPER=${HOME}/.cargo/bin/sccache" >> $GITHUB_ENV
- name: Run tests
run: |
env
cargo test --release --manifest-path avail-subxt/Cargo.toml
env:
RUSTFLAGS: "-C instrument-coverage"
LLVM_PROFILE_FILE: "profile-%p-%m.profraw"
- name: Display SCCache Stats
run: sccache --show-stats
- name: Cleanup
run: find . -name \*.profraw -type f -exec rm -f {} +