-
Notifications
You must be signed in to change notification settings - Fork 10
165 lines (157 loc) · 6.09 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
on:
push:
branches:
- main
pull_request:
branches:
- main
name: CI
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2
- name: Lint (clippy)
run: cargo clippy --all-features --all-targets
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: Clippy feature powerset for target-spec
run: cargo hack --feature-powerset --package target-spec clippy
- name: Lint (rustfmt)
run: cargo xfmt --check
- name: Install cargo readme
uses: baptiste0928/cargo-install@2cfb0024938d23011106cbf127b393bc83fddba1 # v1
with:
crate: cargo-readme
- name: Run cargo readme
run: ./scripts/regenerate-readmes.sh
- name: Check for differences
run: git diff --exit-code
build:
name: Build and test core crates
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
rust-version: [ 1.66, stable ]
fail-fast: false
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-version }}
- uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2
# Build all packages we care about one by one to ensure feature unification
# doesn't happen.
# Build all targets to ensure examples are built as well.
- name: Build target-spec
run: cargo build --all-targets --package target-spec
- name: Build guppy-summaries
run: cargo build --all-targets --package guppy-summaries
- name: Build guppy
run: cargo build --all-targets --package guppy
- name: Build determinator
run: cargo build --all-targets --package determinator
- name: Build hakari
run: cargo build --all-targets --package hakari
- name: Install latest nextest release
uses: taiki-e/install-action@nextest
- name: Run tests for core crates
run: cargo nextest run --package target-spec --package guppy-summaries --package guppy --package determinator --package hakari
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: Check feature powerset for target-spec
run: cargo hack --feature-powerset --package target-spec nextest run
build-all-features:
name: Build and test (all features)
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
rust-version: [ 1.66, stable ]
fail-fast: false
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-version }}
- uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2
- name: Build
# Build all targets to ensure examples are built as well.
# Exclude cargo-compare so that it only runs on the cfg-expr version below.
run: cargo test --no-run --all-targets --all-features --workspace --exclude cargo-compare
- name: Run doctests
run: cargo test --doc --all-features --workspace --exclude cargo-compare
- name: Install latest nextest release
uses: taiki-e/install-action@nextest
- name: Run all other tests
run: cargo nextest run --all-targets --all-features --workspace --exclude cargo-compare
build-rustdoc:
name: Build documentation
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
fail-fast: false
env:
RUSTDOCFLAGS: -D warnings
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
- uses: dtolnay/rust-toolchain@stable
# Note: caching doesn't appear to work for rustdoc as of 2022-12-04, and we're exceeding cache
# sizes anyway
- name: Build rustdoc
# cargo-compare currently pulls in cargo which bloats build times massively
run: cargo doc --all-features --workspace --exclude cargo-compare
test-extended:
name: cargo-compare extended tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Don't run cargo-compare tests on Windows for now. See
# https://github.com/facebookincubator/cargo-guppy/issues/265.
os: [ ubuntu-latest, macos-latest ]
fail-fast: false
env:
RUSTFLAGS: -D warnings
PROPTEST_MULTIPLIER: 64
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
# This matches the cfg-expr version.
- uses: dtolnay/[email protected]
- uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2
- name: Build and test
run: cargo test --package cargo-compare --release
aarch64-build:
runs-on: ubuntu-latest
name: Cross-compile to aarch64
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
- uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-unknown-linux-gnu
- uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2
- name: Build
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1
with:
use-cross: true
command: build
# * Exclude cargo-compare because it depends on cargo, which in turn
# depends on openssl, and getting *that* to cross-compile is a
# headache.
# * Build all targets to ensure examples are built as well.
args: --target aarch64-unknown-linux-gnu --workspace --exclude cargo-compare --all-targets
# TODO: run tests somehow? possibly through cross/qemu