-
Notifications
You must be signed in to change notification settings - Fork 2
164 lines (157 loc) · 4.75 KB
/
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
name: Tests
# Cancel workflow if there is a new change to the branch.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
on:
workflow_dispatch:
merge_group:
pull_request:
branches:
- main
push:
branches:
- main
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
# https://github.com/BurntSushi/quickcheck/blob/master/src/tester.rs#L21
QUICKCHECK_TESTS: 10
QUICKCHECK_MAX_TESTS: 100
jobs:
test:
name: build-and-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup sccache
uses: mozilla-actions/[email protected]
timeout-minutes: 5
continue-on-error: true
- uses: actions/setup-go@v4
with:
go-version-file: "./go_compat/go.mod"
- name: Build
run: cargo check --workspace --all-features --all-targets
env:
CC: "sccache clang"
CXX: "sccache clang++"
- name: Run tests
run: cargo test --workspace --all-features --all-targets
env:
CC: "sccache clang"
CXX: "sccache clang++"
forest-sync-check:
if: ${{ contains(github.event.pull_request.labels.*.name, 'Release') }}
name: forest calibnet sync check
runs-on: buildjet-8vcpu-ubuntu-2004
steps:
- uses: actions/checkout@v4
- name: Setup sccache
uses: mozilla-actions/[email protected]
timeout-minutes: 5
continue-on-error: true
- name: Update submodule forest
run: make update-forest
- name: Modify deps forest
run: make modify-forest
- name: Apt Dependencies Forest
uses: nick-fields/retry@v2
with:
timeout_minutes: 5
max_attempts: 3
command: sudo make -C forest install-deps
- uses: actions/setup-go@v4
with:
go-version-file: "./forest/src/libp2p_bitswap/tests/go-app/go.mod"
- name: Install nextest
uses: taiki-e/install-action@nextest
- name: Test forest
run: |
cd forest
make test
env:
CC: "sccache clang"
CXX: "sccache clang++"
- name: Install forest
run: |
cd forest
make install
env:
CC: "sccache clang"
CXX: "sccache clang++"
- name: Calibnet health check
run: |
cd forest
./scripts/tests/calibnet_other_check.sh
lint-all:
name: All lint checks (lint audit spellcheck udeps)
runs-on: ubuntu-latest
steps:
- name: Checkout Sources
uses: actions/checkout@v4
- name: Setup sccache
uses: mozilla-actions/[email protected]
timeout-minutes: 5
continue-on-error: true
- name: Apt Dependencies
uses: nick-fields/retry@v2
with:
timeout_minutes: 5
max_attempts: 3
command: |
sudo apt-get update -y
sudo apt-get install -y libclang-dev # required dep for cargo-spellcheck
- uses: hanabi1224/[email protected]
- run: rustup toolchain install nightly
- name: Install Lint tools
run: make install-lint-tools
env:
RUSTFLAGS: "-Cstrip=symbols"
- run: make lint-all
env:
CC: "sccache clang"
CXX: "sccache clang++"
codecov:
name: Code coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup sccache
uses: mozilla-actions/[email protected]
timeout-minutes: 5
continue-on-error: true
- uses: actions/setup-go@v4
with:
go-version-file: "./go_compat/go.mod"
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: |
cargo llvm-cov --workspace --all-features --all-targets --lcov --output-path lcov.info
env:
CC: "sccache clang"
CXX: "sccache clang++"
- name: Upload CodeCov
uses: codecov/codecov-action@v3
with:
files: lcov.info
fail_ci_if_error: true
cargo-dependency-check:
name: Check cargo files for duplicates
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1"
- name: Run rubocop
run: |
gem install rubocop --no-document
rubocop scripts/
- name: Run dependencies checks
run: |
gem install toml-rb --no-document
ruby scripts/find_duplicate_deps.rb && \
ruby scripts/find_unused_deps.rb --ignore serde --ignore num --ignore num-bigint --ignore num-traits --ignore fvm_ipld_bitfield