-
Notifications
You must be signed in to change notification settings - Fork 13
169 lines (161 loc) · 6.14 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
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2
- name: Install just
uses: taiki-e/install-action@just
- name: Lint (clippy)
run: just bootstrap clippy
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: Lint (rustfmt)
run: cargo xfmt --check
- name: Install cargo readme
uses: taiki-e/install-action@6a08c6906b66c5d625b29bd6af1556c5b20a1203 # v2
with:
tool: cargo-readme
- name: Generate readmes
run: just generate-readmes
- name: Check for differences
run: git diff --exit-code
# cargo hack might cause changes to Cargo.lock which can cause the git diff above to fail. Put
# this at the end.
- name: target-spec-powerset clippy
run: just target-spec-powerset clippy
build:
name: Build and test core crates
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-14, windows-latest]
rust-version: ["1.78", stable]
fail-fast: false
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-version }}
- uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2
- name: Install tools
uses: taiki-e/install-action@6a08c6906b66c5d625b29bd6af1556c5b20a1203 # v2.47.24
with:
tool: cargo-hack,just,nextest
# 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: Run tests for core crates
run: cargo nextest run --package target-spec --package guppy-summaries --package guppy --package determinator --package hakari
- name: target-spec-powerset nextest run
run: just target-spec-powerset nextest run
build-all-features:
name: Build and test (all features)
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-14, windows-latest]
rust-version: ["1.78", stable]
fail-fast: false
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-version }}
- uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2
- name: Build
# Build all targets to ensure examples are built as well.
# Exclude cargo-compare: it runs as part of test-extended 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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- 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-14]
fail-fast: false
env:
RUSTFLAGS: -D warnings
PROPTEST_MULTIPLIER: 64
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
# This matches the cfg-expr version.
- uses: dtolnay/[email protected]
- uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # 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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-unknown-linux-gnu
- uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # 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