-
-
Notifications
You must be signed in to change notification settings - Fork 23
92 lines (83 loc) · 2.71 KB
/
rust.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
name: Rust
on:
push:
branches: [ main ]
schedule:
- cron: 0 0 1 * *
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
test:
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
- macos-11
rust:
- stable
- 1.46.0 # lib MSRV
- 1.60.0 # cli MSRV
include:
- os: ubuntu-latest
rust: stable
lint: 1
- rust: stable
rust-args: --all-features
- rust: 1.46.0
old-cargo-compat: 1
- rust: 1.60.0
rust-args: --all-features
exclude:
# rust < 1.54 does not work on macos >= 12:
# https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/.E2.9C.94.20How.20can.20I.20fix.20Rust.201.2E53.2E0.20or.20earlier.20to.20run.20on.20macOS.2012.2E6.3F/near/299263887
- os: macos-latest
rust: 1.46.0
- os: macos-11
rust: stable
- os: macos-11
rust: 1.60.0
runs-on: ${{ matrix.os }}
steps:
- name: Checkout source
uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
default: true
override: true
- uses: Swatinem/rust-cache@v1
- name: Compatibility fixes for older versions of cargo
if: matrix.old-cargo-compat
run: |
# If we're testing with Rust < 1.60, cargo won't be able to find
# the clap version specified in Cargo.lock, so remove the lockfile.
# This is safe because applications that only use us as a library
# will also ignore our Cargo.lock.
# https://users.rust-lang.org/t/optional-dependencies-and-msrv/82151
cargo update -p clap --precise 3.2.25
# Downgrade the following crates because they require edition 2021
cargo update -p serde --precise 1.0.156
cargo update -p thiserror --precise 1.0.39
cargo update -p quote --precise 1.0.30
cargo update -p proc-macro2 --precise 1.0.65
- name: cargo test
uses: actions-rs/cargo@v1
with:
command: test
args: --workspace ${{ matrix.rust-args }}
- name: rustfmt
if: github.event_name == 'pull_request' && matrix.lint
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: clippy
if: github.event_name == 'pull_request' && matrix.lint
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all --tests --all-features -- -D warnings