-
Notifications
You must be signed in to change notification settings - Fork 10
190 lines (164 loc) · 4.91 KB
/
Copy pathCI.yml
File metadata and controls
190 lines (164 loc) · 4.91 KB
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
# Copyright John Nunley, 2022.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE or copy at
# https://www.boost.org/LICENSE_1_0.txt)
name: CI
on:
push:
branches:
- master
pull_request:
env:
BREADX_EXAMPLE_TIMEOUT: 1
RUSTFLAGS: -Dwarnings
clippy_version: 1.60.0
jobs:
rustfmt:
name: rustfmt
runs-on: ubuntu-latest
strategy:
matrix:
include:
- rust: stable
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
components: rustfmt
- uses: Swatinem/rust-cache@v1
- name: Run rustfmt
run: |
if ! rustfmt --check --edition 2021 $(git ls-files '*.rs'); then
printf "Please fix rustfmt errors.\n" >&2
exit 1
fi
clippy:
name: clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.clippy_version }}
override: true
components: clippy
- uses: Swatinem/rust-cache@v1
- name: Run Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all --tests --all-features
# copy-pasted from async-io
cross:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install Rust
run: rustup update stable
- name: Install cross
uses: taiki-e/install-action@cross
- name: Android
if: startsWith(matrix.os, 'ubuntu')
run: cross test --target arm-linux-androideabi
- name: NetBSD
if: startsWith(matrix.os, 'ubuntu')
run: cross build --target x86_64-unknown-netbsd
- name: iOS
if: startsWith(matrix.os, 'macos')
run: cross build --target aarch64-apple-ios
test:
name: run tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- windows-latest
- ubuntu-latest
- macos-latest
toolchain:
- stable
include:
- os: ubuntu-latest
toolchain: beta
- os: ubuntu-latest
toolchain: nightly
- os: ubuntu-latest
toolchain: 1.49.0 # msrv
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
override: true
- uses: Swatinem/rust-cache@v1
# run tests for all crates
- name: Default Features Test
run: cargo test
# run tests with no default features
- name: No Default Features Test
run: cargo test --no-default-features --tests
working-directory: breadx
- name: No Default Features Test (All Extensions)
run: cargo test --no-default-features --features all-extensions --tests
working-directory: breadx
# run tests with all features
- name: All Features Test
run: cargo test --all-features
working-directory: breadx
# run tests for just async
- name: Async Test
run: cargo test --features async
working-directory: breadx
- name: Async Test (All Extensions)
run: cargo test --features async all-extensions
working-directory: breadx
# run pl tests
- name: Parking Lot Test
run: cargo test --features pl all-extensions
working-directory: breadx
# run all examples
# took this from x11rb's ci
- name: Run Examples (Linux)
if: startsWith(matrix.os, 'ubuntu')
run: |
cd breadx
for example in examples/*.rs; do
example=${example/examples\//}
example=${example/.rs/}
xvfb-run -a cargo run --example "$example" --all-features
done
# run examples on windows
- uses: cygwin/cygwin-install-action@master
if: startsWith(matrix.os, 'windows')
with:
packages: xorg-server-extra
- name: Run Examples (Windows)
if: startsWith(matrix.os, 'windows')
shell: powershell
env:
DISPLAY: 127.0.0.1:0
run: |
$xvfb = Start-Process -PassThru -FilePath C:\cygwin\bin\Xvfb.exe -ArgumentList "-listen tcp :0"
Get-ChildItem breadx/examples |
Where {$_.extension -eq ".rs"} |
Foreach-Object {
cargo run --example $($_.BaseName) --all-features
if ($LASTEXITCODE -ne 0) {
throw "Example $($_.BaseName) failed"
}
}
Stop-Process -Id $xvfb.Id