-
Notifications
You must be signed in to change notification settings - Fork 2
101 lines (89 loc) · 2.77 KB
/
ci-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
93
94
95
96
97
98
99
100
101
name: Continuous Integration (rust)
on:
push:
branches: [ "develop" ]
# See docu here: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-including-and-excluding-branches
# it seems pretty similar to .gitignore
paths:
- '**'
- '!**.md'
pull_request:
paths:
- '**'
- '!**.md'
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
jobs:
# builds and tests rust code, with --deny warnings. tests for dirty git
build-and-test-rust:
runs-on: ubuntu-latest
env:
RUSTFLAGS: --deny warnings
steps:
- uses: actions/checkout@v4
- name: Rustup update
run: rustup update
- name: Show cargo version
run: cargo --version
- name: rust build caching
uses: Swatinem/rust-cache@v2
with:
workspaces: . -> target
key: default-features
save-if: ${{ github.ref == 'refs/heads/develop' }}
- name: Build Rust
run: cargo check --verbose --locked
- name: Test Rust
run: cargo test --all --verbose --locked
- name: Check dirty git
uses: ./.github/actions/check-dirty-git
# builds and tests rust code, with --no-default-features, with --deny warnings. tests for dirty git
build-and-test-rust-no-default-features:
runs-on: ubuntu-latest
env:
RUSTFLAGS: --deny warnings
steps:
- uses: actions/checkout@v4
- name: Rustup update
run: rustup update
- name: Show cargo version
run: cargo --version
- name: rust build caching
uses: Swatinem/rust-cache@v2
with:
workspaces: . -> target
key: no-default-features
save-if: ${{ github.ref == 'refs/heads/develop' }}
- name: Build Rust
run: cargo check --no-default-features --verbose --locked
- name: Test Rust
run: cargo test --no-default-features --verbose --locked
- name: Check dirty git
uses: ./.github/actions/check-dirty-git
# lints and checks formatting of rust code
lint-rust:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Rustup install nightly & update
run: rustup toolchain add nightly && rustup component add --toolchain nightly rustfmt && rustup update
- name: Show cargo version
run: cargo --version
- name: rust build caching
uses: Swatinem/rust-cache@v2
with:
key: lint
workspaces: . -> target
save-if: ${{ github.ref == 'refs/heads/develop' }}
- name: Format
run: cargo +nightly fmt -- --check
- name: Clippy
run: cargo clippy --all --all-features -- -D warnings
semver-checks:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check semver
uses: obi1kenobi/cargo-semver-checks-action@v2