-
Notifications
You must be signed in to change notification settings - Fork 1
103 lines (97 loc) · 2.84 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
name: CI
on: [push, pull_request]
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
cargo:
name: Test on ${{ matrix.toolchain }}
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- stable
- beta
- nightly
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ matrix.toolchain }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- name: Install rustfmt
run: rustup component add rustfmt
- name: Check
run: cargo fmt --check --verbose
- name: Build
run: cargo build --verbose
- name: Test
run: cargo test --verbose
clippy:
name: Lint
if: "!startsWith(github.ref, 'refs/tags/')"
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: clippy-${{ hashFiles('**/Cargo.lock') }}
- run: brew install rust gtk4 libadwaita
- run: rustup component add clippy
- run: cargo clippy --all-features -- -D clippy::all -D warnings
codecov:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
needs: cargo
name: Code coverage on ${{ matrix.os }}
if: "!startsWith(github.ref, 'refs/tags/')"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-codecov-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust
run: rustup update stable
- uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: cargo llvm-cov --workspace --lcov --output-path lcov.info
- name: Upload to codecov.io
uses: codecov/codecov-action@v4
with:
files: lcov.info
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
release:
needs: cargo
name: Release
permissions:
contents: write
if: github.repository_owner == 'charlesrocket' && startsWith(github.ref, 'refs/tags/')
uses: ./.github/workflows/cd.yml
secrets:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}