-
Notifications
You must be signed in to change notification settings - Fork 7
208 lines (190 loc) · 6.25 KB
/
ci.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
name: ci
on:
pull_request:
types:
- opened
- synchronize
push:
branches:
- main
workflow_dispatch:
jobs:
job-matrix:
name: ${{ matrix.make.task }} (${{ matrix.rust }}; ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- make:
task: format
os: ubuntu-latest
rust: stable
- make:
task: check-dependencies
os: ubuntu-latest
rust: stable
- make:
task: lint
os: ubuntu-latest
rust: stable
- make:
task: doc
os: ubuntu-latest
rust: stable
- make:
task: deadlink
install-cargo-deadlinks: true
install-mlc: true
os: ubuntu-latest
rust: stable
- make:
task: lcov
install-grcov: true
os: ubuntu-latest
rust: stable
- make:
task: copyright
rust-free: true
os: ubuntu-latest
- make:
task: test
os: ubuntu-latest
rust: nightly
- make:
task: test
os: ubuntu-latest
rust: stable
- make:
task: test
os: ubuntu-latest
rust: 1.63.0
- make:
task: test
os: macos-latest
rust: stable
# Example does not cover various envs. Should be done in test.
- make:
task: example-run
install-replayman: true
os: ubuntu-latest
rust: stable
env:
RUST_BACKTRACE: full
CACHE_RESET_KEY: 20211022-01
steps:
- uses: actions/checkout@v2
- name: Install Rust ${{ matrix.rust }}
if: ${{ ! matrix.make.rust-free }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
components: rustfmt, clippy, llvm-tools-preview
override: true
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.make.task }}
- name: Check versions on crates.io
if: ${{ matrix.make.task == 'check-dependencies' }}
id: dep-versions
run: |
# load helper script
source .github/workflows/scripts/crates.io-script.bash
# get latest version from crates.io
echo "CARGO_DENY_VERSION=$(get_crate_latest_version cargo-deny)" >> $GITHUB_ENV
# add other dependencies versions here
- name: Cache cargo-deny
if: ${{ matrix.make.task == 'check-dependencies' }}
uses: actions/cache@v2
with:
path: |
~/.cargo/bin/cargo-deny
key: ${{ env.CACHE_RESET_KEY }}-${{ runner.os }}-${{ matrix.rust }}-cargo-deny-${{ env.CARGO_DENY_VERSION }}
- name: Install cargo-deny
if: ${{ matrix.make.task == 'check-dependencies' }}
run: |
if ! test -f "$HOME/.cargo/bin/cargo-deny"; then
cargo install cargo-deny
fi
- name: Install cargo-make
env:
BASE_URL: https://github.com/sagiegurari/cargo-make/releases/download
VERSION: 0.35.10
run: |
if [ "${{ matrix.os }}" = "macos-latest" ]; then
FILE_BASE="cargo-make-v${VERSION}-x86_64-apple-darwin"
else
FILE_BASE="cargo-make-v${VERSION}-x86_64-unknown-linux-musl"
fi
mkdir -p "${HOME}/.local/bin"
curl -L "${BASE_URL}/${VERSION}/${FILE_BASE}.zip" --output /tmp/cargo-make.zip
unzip "/tmp/cargo-make.zip" -d /tmp/cargo-make
mv -f "/tmp/cargo-make/${FILE_BASE}/cargo-make" "$HOME/.local/bin/cargo-make"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Install cargo-deadlinks
if: ${{ matrix.make.install-cargo-deadlinks }}
env:
BASE_URL: https://github.com/deadlinks/cargo-deadlinks/releases/download
VERSION: 0.8.1
run: |
if [ "${{ matrix.os }}" = "macos-latest" ]; then
FILE_BASE=cargo-deadlinks-macos
else
FILE_BASE=cargo-deadlinks-linux
fi
curl -L "${BASE_URL}/${VERSION}/${FILE_BASE}" --output "$HOME/.local/bin/cargo-deadlinks"
chmod +x "$HOME/.local/bin/cargo-deadlinks"
cargo deadlinks --version
- name: Install mlc
if: ${{ matrix.make.install-mlc }}
env:
BASE_URL: https://github.com/becheran/mlc/releases/download
VERSION: 0.14.3
run: |
if [ "${{ matrix.os }}" = "macos-latest" ]; then
FILE_BASE=mlc-x86_64-apple-darwin
else
FILE_BASE=mlc-x86_64-linux
fi
curl -L "${BASE_URL}/v${VERSION}/${FILE_BASE}" --output "$HOME/.local/bin/mlc"
chmod +x "$HOME/.local/bin/mlc"
mlc --version
- name: Install grcov
if: ${{ matrix.make.install-grcov }}
env:
BASE_URL: https://github.com/mozilla/grcov/releases/download
VERSION: 0.8.7
run: |
if [ "${{ matrix.os }}" = "macos-latest" ]; then
FILE_BASE=grcov-x86_64-apple-darwin
else
FILE_BASE=grcov-x86_64-unknown-linux-gnu
fi
curl -L "${BASE_URL}/v${VERSION}/${FILE_BASE}.tar.bz2" --output /tmp/grcov.tar.bz2
tar xvf /tmp/grcov.tar.bz2 --directory="$HOME/.local/bin/"
grcov --version
- name: Install replayman
if: ${{ matrix.make.install-replayman }}
run: |
cargo install replayman
- name: ${{ matrix.make.task }}
run: |
cargo make ${{ matrix.make.task }}
- name: Upload lcov to codecov
if: ${{ matrix.make.install-grcov }}
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_SECRET }}
files: ./target/lcov.info
slack-notify:
if: always()
needs:
- job-matrix
name: workflow notification to slack
runs-on: ubuntu-latest
steps:
- uses: Gamesight/slack-workflow-status@master
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}