-
Notifications
You must be signed in to change notification settings - Fork 13
116 lines (113 loc) · 3.46 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
# yaml-language-server: $schema=https://raw.githubusercontent.com/softprops/github-actions-schemas/master/workflow.json
name: CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
build_first:
name: "Build, check, and test with all features"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
with:
shared-key: "cargo-deps"
cache-targets: false
- name: Run Build
run: cargo build --verbose --bins --lib --examples --all-features
- name: Run Tests
run: cargo test --verbose --bins --lib --examples --all-features
build:
runs-on: ubuntu-latest
needs: [ "build_first" ]
strategy:
fail-fast: false
matrix:
include:
- build_type: ""
build_name: "Default"
- build_type: "--no-default-features"
build_name: "No features"
- build_type: "--no-default-features --features games"
build_name: "Just games"
- build_type: "--no-default-features --features services"
build_name: "Just Services"
- build_type: "--no-default-features --features game_defs"
build_name: "Just Game definitions"
- build_type: "--no-default-features --features serde"
build_name: "Just serde"
name: "Build ${{ matrix.build_name }}"
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
with:
shared-key: "cargo-deps"
cache-targets: false
- name: Run Build
run: cargo build --verbose --bins --lib ${{ matrix.build_type }}
build_msrv:
name: "Build using MSRV"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Install MSRV
uses: actions-rs/toolchain@v1
with:
toolchain: 1.65.0
override: true
- name: Run MSRV
run: cargo build
formatting:
name: "Check code formatting"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
with:
cache-targets: false
- name: Install Formatting nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2023-07-09
components: rustfmt
override: true
- name: Run Formatting check
run: cargo fmt --check --verbose
clippy:
name: "Run clippy tests"
runs-on: ubuntu-latest
needs: [ "build_first" ]
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
with:
shared-key: "cargo-deps"
cache-targets: false
- name: Run Clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --bins --lib --examples --all-features
if: ${{ !env.ACT }} # skip during local actions testing
- name: Run clippy (local)
run: cargo clippy --verbose --bins --lib --examples --all-features
if: ${{ env.ACT }} # only run during local actions testing
doc:
name: "Check rustdoc"
runs-on: ubuntu-latest
needs: [ "build_first" ]
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
with:
shared-key: "cargo-deps"
cache-targets: false
- name: "Run cargo doc"
run: cargo doc
env:
RUSTDOCFLAGS: "-D warnings"