-
Notifications
You must be signed in to change notification settings - Fork 18
166 lines (161 loc) · 5.06 KB
/
build-test.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
# copy of https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md
# Steps for checking PRs.
on:
pull_request:
branches:
- "*"
push:
branches: [ master ]
name: PR check
jobs:
check:
name: Check
runs-on: [ 'self-hosted' ]
strategy:
fail-fast: true
matrix:
feature: [ libp2p ]
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: cargo-bins/cargo-binstall@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install risc0
run: cargo binstall -y cargo-risczero && cargo risczero install
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rs/cargo@v1
with:
command: check
args: --all --no-default-features --features ${{ matrix.feature }}
test:
name: Test Suite
if: ${{ !startsWith(github.event.pull_request.title, '[WIP]') && !contains(github.event.label.name, 'DO NOT MERGE') }}
strategy:
fail-fast: false # all OSes should be tested even if one fails (default: true)
matrix:
feature: [ libp2p ]
os: [ self-hosted, macos-latest ] # drop windows for now as risc0 does not support it
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Remove unwanted software
if: matrix.os == 'ubuntu-latest'
uses: ./.github/actions/prune-vm
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
# Setup Rust toolchain with GNU for Windows
- name: Setup Rust with GNU toolchain (Windows)
if: matrix.os == 'windows-latest'
uses: actions-rs/toolchain@v1
with:
toolchain: stable-msvc
target: x86_64-pc-windows-msvc
override: true
# Setup Rust toolchain for other OSes
- name: Setup Rust toolchain (Other OSes)
if: matrix.os != 'windows-latest'
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
# Setup build environment (Windows)
- name: Setup build environment (Windows)
if: matrix.os == 'windows-latest'
uses: ./.github/actions/mingw-env
- uses: cargo-bins/cargo-binstall@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install risc0
run: cargo binstall -y cargo-risczero && cargo risczero install
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cargo build
uses: actions-rs/cargo@v1
with:
command: build
args: --all --no-default-features --features ${{ matrix.feature }}
- name: Cargo test (Other OSes)
if: matrix.os != 'windows-latest'
uses: actions-rs/cargo@v1
env:
RISC0_DEV_MODE: true
CONSENSUS_SLOT_TIME: 5
with:
command: test
args: --all --no-default-features --features ${{ matrix.feature }}
- name: Cargo test (Windows)
if: matrix.os == 'windows-latest'
uses: actions-rs/cargo@v1
env:
# Because Windows runners in Github Actions tend to be slow.
SLOW_TEST_ENV: true
RISC0_DEV_MODE: true
CONSENSUS_SLOT_TIME: 5
with:
command: test
args: --no-default-features --features ${{ matrix.feature }}
- name: Cargo bench (no-run)
if: matrix.os != 'windows-latest'
uses: actions-rs/cargo@v1
env:
RISC0_DEV_MODE: true
CONSENSUS_SLOT_TIME: 5
with:
command: bench
args: --no-run
- uses: actions/upload-artifact@v3
if: failure()
with:
name: integration-test-artifacts
path: tests/.tmp*
lints:
name: Rust lints
runs-on: self-hosted
strategy:
matrix:
feature: [ libp2p ]
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
- uses: cargo-bins/cargo-binstall@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install risc0
run: cargo binstall -y cargo-risczero && cargo risczero install
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all --no-default-features --features ${{ matrix.feature }} -- --deny warnings