-
-
Notifications
You must be signed in to change notification settings - Fork 2
58 lines (54 loc) · 1.77 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
name: CI
on:
push:
branches:
- main
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@v2
with:
tool: cargo-deny
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install pre-commit & gitlint
run: python -m pip install pre-commit gitlint
- run: python -m pip freeze --local
- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: pre-commit validation
run: pre-commit run --show-diff-on-failure --color=always --from-ref ${{ github.event.pull_request.base.sha || github.event.before || github.sha }}~ --to-ref ${{ github.sha }}
- name: gitlint validation
run: gitlint --commits ${{ github.event.pull_request.base.sha || github.event.before || github.sha }}~..${{ github.sha }}
if: always()
- name: Formatting
run: cargo fmt --all --check
- name: Linting
run: cargo clippy --all-targets --all-features
- name: Check
run: cargo check
- name: Tests
run: cargo test
- uses: pre-commit-ci/[email protected]
if: always() && matrix.os == 'ubuntu-latest'
with:
msg: "chore: Apply automatic fixes"