-
Notifications
You must be signed in to change notification settings - Fork 4
114 lines (96 loc) · 3.21 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
name: CI
on:
push:
branches-ignore:
- renovate/*
pull_request:
types:
- opened
- synchronize
jobs:
build:
strategy:
fail-fast: false
matrix:
conf:
- stable
- msrv
include:
- conf: stable
toolchain: stable
- conf: nightly
toolchain: nightly
- conf: msrv
toolchain: '1.73.0'
env:
RUST_BACKTRACE: 1
# For other ways of skipping CI runs, see: https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs
if: >-
(github.event_name == 'push' && !endsWith(github.event.head_commit.message, 'CI: skip')) ||
(github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.names, 'skip-ci'))
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Install ${{ matrix.toolchain }}
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
components: rustfmt, clippy
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Install cargo-nono
if: matrix.conf == 'nightly'
uses: taiki-e/install-action@v2
with:
tool: cargo-nono
- name: Install cargo-hack
if: matrix.conf == 'nightly'
uses: taiki-e/install-action@v2
with:
tool: cargo-hack
- name: Install clippy-sarif
if: matrix.conf == 'nightly'
uses: taiki-e/install-action@v2
with:
tool: clippy-sarif
- name: Install sarif-fmt
if: matrix.conf == 'nightly'
uses: taiki-e/install-action@v2
with:
tool: sarif-fmt
- name: Run rustfmt
if: matrix.conf == 'nightly'
run: cargo fmt --check --verbose -- --color=always
- name: Run linter for all feature combinations
if: matrix.conf == 'nightly'
run: >
cargo hack clippy --no-deps --all-targets --feature-powerset --message-format=json -- -D warnings
| clippy-sarif
| tee clippy-results.sarif
| sarif-fmt
- name: Run tests
run: make zopfli && make test
- name: Run tests (no-std)
run: cargo test --release --no-default-features
# The documentation generation command should match what's defined on
# Cargo.toml's `package.metadata.docs.rs` section for docs.rs
- name: Generate documentation
if: matrix.conf == 'nightly'
run: cargo doc --all-features
- name: Check effective no_std compatibility
if: matrix.conf == 'nightly'
run: |
# Temporarily drop the binary crate so that cargo nono does not
# get confused about what crate to analyze: we are only interested
# in the library one
sed -i 's;^bin = ;#&;' Cargo.toml
rm src/main.rs
cargo nono check --no-default-features --features gzip,zlib
- name: Upload analysis results to GitHub
uses: github/codeql-action/upload-sarif@v3
if: always() && matrix.conf == 'nightly'
continue-on-error: true
with:
sarif_file: clippy-results.sarif
category: clippy