-
Notifications
You must be signed in to change notification settings - Fork 49
134 lines (113 loc) · 3.63 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_call:
# Cancel previous runs for PRs but not pushes to main
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
cargo-toml-features:
name: Generate Feature Combinations
runs-on: ubuntu-latest
outputs:
feature-combinations: ${{ steps.cargo-toml-features.outputs.feature-combinations }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Determine Cargo Features
id: cargo-toml-features
uses: Holzhaus/cargo-toml-features-action@3afa751aae4071b2d1ca1c5fa42528a351c995f4
build:
needs: cargo-toml-features
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
features: ${{ fromJson(needs.cargo-toml-features.outputs.feature-combinations) }}
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Check out source repository
uses: actions/checkout@v4
- name: Install FFmpeg (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install -y ffmpeg
- name: Install FFmpeg (macOS)
if: runner.os == 'macOS'
run: |
brew install ffmpeg
- name: Install FFmpeg (Windows)
if: runner.os == 'Windows'
run: |
choco install ffmpeg
shell: powershell
- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache dependencies
uses: actions/cache@v4
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Build
run: cargo build --no-default-features --features "${{ join(matrix.features, ',') }}"
- name: Run tests
run: cargo test --no-default-features --features "${{ join(matrix.features, ',') }}" --no-fail-fast
msrv:
name: Current MSRV is 1.70.0
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Now check that `cargo build` works with respect to the oldest possible
# deps and the stated MSRV
- uses: dtolnay/[email protected]
- run: cargo build --all-features
style:
runs-on: ubuntu-latest
steps:
- name: Check out source repository
uses: actions/checkout@v4
- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache dependencies
uses: actions/cache@v4
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Format
run: cargo fmt --check
- name: Lint
run: cargo clippy --all-features -- -Dwarnings
- name: Check for debug macro
run: "! grep -r 'dbg!' ./src"
conventional-commits:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: pip3 install -U Commitizen
# The commit hash here is that of the commit where we started using conventional commits.
- run: cz check --rev-range 16610ddb..HEAD