-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (59 loc) · 1.85 KB
/
Copy pathci.yml
File metadata and controls
67 lines (59 loc) · 1.85 KB
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
name: CI
on:
pull_request:
push:
branches: [main]
paths:
- "crates/**"
- "Cargo.toml"
- "Cargo.lock"
- ".github/workflows/ci.yml"
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
commit-lint:
name: Conventional commits
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check commit messages
run: |
pattern='^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\([a-z0-9_\-\/]+\))?!?: .{1,100}$'
bad=0
while IFS= read -r line; do
hash="${line%% *}"; msg="${line#* }"
case "$msg" in
Merge\ *|Revert\ *|fixup!\ *|squash!\ *) continue ;;
esac
if ! printf '%s' "$msg" | grep -Eq "$pattern"; then
echo "::error::Bad commit message ($hash): $msg"
bad=1
fi
done <<< "$(git log --format='%h %s' ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }})"
exit $bad
check:
name: fmt + clippy + test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Install Linux deps
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libx11-dev libxi-dev libxtst-dev libxdo-dev
- name: cargo fmt
run: cargo fmt --all -- --check
- name: cargo clippy
run: cargo clippy --workspace --all-targets -- -D warnings
- name: cargo test
run: cargo test --workspace