-
Notifications
You must be signed in to change notification settings - Fork 355
162 lines (143 loc) · 5.07 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
name: ci
on:
pull_request:
push:
branches:
- main
schedule:
- cron: "0 0 * * 1"
jobs:
rustfmt:
name: Check rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- run: cargo fmt --all -- --check
clippy:
name: Run linter
runs-on: ubuntu-latest
strategy:
matrix:
rust: ["1.60"]
env:
RUSTFLAGS: -D warnings
RUSTDOCFLAGS: -D warnings
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: hecrj/setup-rust-action@v1
with:
components: clippy
rust-version: ${{ matrix.rust }}
- name: Cache cargo directories
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
${{ runner.os }}-cargo-
- name: Cache cargo target dirs
uses: actions/cache@v2
with:
path: target
key: ${{ runner.os }}-target-lint-stable-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-target-lint-stable-${{ hashFiles('**/Cargo.toml') }}
${{ runner.os }}-target-lint-stable-
${{ runner.os }}-target-lint-
# feature testing
- name: no features
run: cargo clippy --workspace --all-targets
- name: docking feature
run: cargo clippy --workspace --all-targets --features docking
- name: freetype feature
run: cargo clippy --workspace --all-targets --features freetype
- name: freetype and docking
run: cargo clippy --workspace --all-targets --features freetype,docking
- name: all features
run: cargo clippy --workspace --all-targets --features docking,freetype
test:
name: Run tests
runs-on: ${{ matrix.os }}
env:
RUSTFLAGS: -D warnings
RUST_BACKTRACE: 1
strategy:
fail-fast: false
matrix:
rust:
- stable
- "1.60"
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- run: sudo apt install libxcb-shape0-dev libxcb-xfixes0-dev
if: runner.os == 'Linux'
# workaround for https://github.com/actions/cache/issues/403
- name: Install GNU tar
if: matrix.os == 'macos-latest'
run: |
brew install gnu-tar
echo PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH" >> $GITHUB_ENV
- name: Cache cargo directories
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
${{ runner.os }}-cargo-
- name: Cache cargo target dirs
uses: actions/cache@v2
with:
path: target
# note `cargo test` and `cargo clippy` don't use the same build
# artifacts, so this has a different key
key: ${{ runner.os }}-target-test-${{ matrix.rust }}-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-target-test-${{ matrix.rust }}-${{ hashFiles('**/Cargo.toml') }}
${{ runner.os }}-target-test-${{ matrix.rust }}-
- name: Setup vcpkg
if: matrix.os == 'windows-latest'
run: vcpkg integrate install; vcpkg install freetype:x64-windows-static-md
# feature testing
- name: no features
run: cargo test --workspace --all-targets
- name: docking feature
run: cargo test --workspace --all-targets --features docking
- name: freetype feature (non-Windows, pkg-config)
if: matrix.os != 'windows-latest'
run: cargo test --workspace --all-targets --features freetype
- name: freetype and docking (non-Windows, pkg-config)
if: matrix.os != 'windows-latest'
run: cargo test --workspace --all-targets --features freetype,docking
- name: freetype feature (Windows, vcpkg)
if: matrix.os == 'windows-latest'
run: cargo test --workspace --all-targets --features freetype,use-vcpkg
- name: freetype and docking (Windows, vcpkg)
if: matrix.os == 'windows-latest'
run: cargo test --workspace --all-targets --features freetype,docking,use-vcpkg
- run: cargo test --workspace --doc
# run to check for lint problems
- name: build documentation
run: cargo doc
# Run unreasonably slow tests under release, but only the crates that have
# them, and don't bother doing this on most platforms.
- run: cargo test -p imgui --release -- --ignored
if: matrix.os == 'ubuntu-latest' && matrix.rust == 'stable'