-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (121 loc) · 3.58 KB
/
Copy pathci.yml
File metadata and controls
134 lines (121 loc) · 3.58 KB
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
# Shared CI template. Keep jobs in sync; customize only the env block per repo.
name: CI
on:
push:
branches: [main, master]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: "0"
CARGO_BUILD_JOBS: "1"
MSRV: "1.88"
NO_STD_TARGET: thumbv7em-none-eabihf
NO_STD_CARGO_ARGS: "--no-default-features --features libm"
CLIPPY_ARGS: "--lib --all-features"
DOCS_ARGS: "--lib --no-deps --all-features"
CHECK_ARGS: "--lib --all-features"
CI_HOST_TARGET: ""
CI_UNIT_TEST_ARGS: "--lib --all-features"
CI_INTEGRATION_TEST_ARGS: "--all-features"
CI_EXTRA_TEST_COMMANDS: ""
CI_INTEGRATION_CHECK: "true"
CI_INTEGRATION_CHECK_CMD: "cargo build --examples --all-features"
NEEDS_SDL: "true"
jobs:
fmt:
name: Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all -- --check
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: |
if [ -n "${{ env.CI_HOST_TARGET }}" ]; then
cargo check ${{ env.CHECK_ARGS }} --target ${{ env.CI_HOST_TARGET }}
else
cargo check ${{ env.CHECK_ARGS }}
fi
check-no-std:
name: Check (no_std)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ env.NO_STD_TARGET }}
- uses: Swatinem/rust-cache@v2
- run: cargo check --lib ${{ env.NO_STD_CARGO_ARGS }} --target ${{ env.NO_STD_TARGET }}
msrv:
name: MSRV check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.MSRV }}
- run: bash .github/scripts/ci_msrv.sh
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy ${{ env.CLIPPY_ARGS }} -- -W clippy::all
- run: rustup target add ${{ env.NO_STD_TARGET }}
- run: cargo clippy --lib ${{ env.NO_STD_CARGO_ARGS }} --target ${{ env.NO_STD_TARGET }} -- -W clippy::all
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install SDL2
if: ${{ env.NEEDS_SDL == 'true' }}
run: sudo apt-get update && sudo apt-get install -y libsdl2-dev
- run: bash .github/scripts/ci_test.sh
docs:
name: Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: bash .github/scripts/ci_docs.sh
publish-dry-run:
name: Publish dry-run
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo publish --dry-run
audit:
name: Security audit
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
steps:
- uses: actions/checkout@v4
- uses: rustsec/audit-check@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}