-
Notifications
You must be signed in to change notification settings - Fork 24
197 lines (167 loc) · 5.16 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
name: CI
on: [push, pull_request]
env:
CARGO_TERM_COLOR: always
RUST_TEST_THREADS: 1
jobs:
test:
name: Test (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# Linux
- target: i686-unknown-linux-gnu
os: ubuntu-20.04
- target: i686-unknown-linux-musl
os: ubuntu-20.04
- target: x86_64-unknown-linux-gnu
os: ubuntu-20.04
- target: x86_64-unknown-linux-musl
os: ubuntu-20.04
# Cross
- target: armv7-unknown-linux-gnueabihf
os: ubuntu-20.04
use-cross: true
- target: aarch64-linux-android
toolchain: '1.52.0' # See: https://github.com/rust-lang/rust/issues/110786
os: ubuntu-20.04
use-cross: true
- target: mips-unknown-linux-gnu
toolchain: '1.52.0' # See: https://github.com/rust-lang/compiler-team/issues/648
os: ubuntu-20.04
use-cross: true
# Windows
- target: i686-pc-windows-gnu
os: windows-2019
- target: i686-pc-windows-msvc
os: windows-2019
- target: x86_64-pc-windows-gnu
os: windows-2019
- target: x86_64-pc-windows-msvc
os: windows-2019
# macOS
- target: x86_64-apple-darwin
os: macos-13
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain || 'stable' }}
profile: minimal
target: ${{ matrix.target }}
override: true
- name: Run tests (cross)
if: ${{ matrix.use-cross }}
uses: actions-rs/cargo@v1
with:
use-cross: true
command: test
args: --target ${{ matrix.target }}
- name: Run tests (cargo)
if: ${{ !matrix.use-cross }}
run: cargo test
test-qemu:
name: Test (${{ matrix.target }})
runs-on: ubuntu-20.04
env: { SSHPASS: 12345 }
strategy:
matrix:
include:
- target: x86_64-unknown-freebsd
image: https://gitlab.com/kit-ty-kate/qemu-base-images/-/raw/master/FreeBSD-13.2-RELEASE-amd64.qcow2?inline=false
md5: 33b6bc89cdc675f5cbaf92e71ae648f8
args: -net nic
- target: x86_64-unknown-openbsd
image: https://gitlab.com/kit-ty-kate/qemu-base-images/-/raw/master/OpenBSD-7.4-amd64.qcow2?inline=false
md5: 1b7f3867c72f1dac3901b4a08257f580
args: -net nic
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install QEMU
run: sudo apt-get update && sudo apt-get install -y qemu-system-x86
- name: Lookup image
id: lookup-image
uses: actions/cache@v2
with:
path: ~/image.qcow2
key: ${{ matrix.target }}-image
- name: Download image
if: steps.lookup-image.outputs.cache-hit != 'true'
run: |
wget -O - --progress=dot:mega "${{ matrix.image }}" \
| tee ~/image.qcow2 \
| md5sum -c <(echo "${{ matrix.md5 }} -")
- name: Boot image
run: |
qemu-system-x86_64 -m 2048 -display none -snapshot -daemonize \
-drive if=ide,media=disk,file=$HOME/image.qcow2 \
-net user,hostfwd=tcp::1025-:22 \
${{ matrix.args }}
- name: Configure SSH
run: |
ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa
cat > ~/.ssh/config <<EOF
Host qemu
User root
HostName localhost
Port 1025
EOF
chmod og-rw ~
parallel -t --retries 20 --delay 5 ::: 'sshpass -e ssh-copy-id -o StrictHostKeyChecking=no qemu'
- name: Install toolchain (rustup)
if: ${{ contains(matrix.target, 'freebsd') }}
run: |
ssh qemu <<'EOF'
pkg install -y curl
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal
ln -s ~/.cargo/bin ~/bin
EOF
- name: Install toolchain (pkg)
if: ${{ contains(matrix.target, 'openbsd') }}
run: ssh qemu "pkg_add rust"
- name: Copy crate
run: scp -r $PWD qemu:crate
# TODO: Respect RUST_TEST_THREADS
- name: Run tests
run: ssh qemu "cd crate && cargo test"
check:
name: Check (${{ matrix.target }})
runs-on: ubuntu-20.04
strategy:
matrix:
target:
- x86_64-unknown-illumos
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
target: ${{ matrix.target }}
override: true
- name: Run check
run: cargo check --target ${{ matrix.target }}
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- name: Run rustfmt
run: cargo fmt -- --check
- name: Run clippy
run: cargo clippy --all-targets