-
Notifications
You must be signed in to change notification settings - Fork 1
88 lines (77 loc) · 2.11 KB
/
pr.yml
File metadata and controls
88 lines (77 loc) · 2.11 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
---
name: pr
on:
merge_group:
types: [checks_requested]
pull_request:
branches:
- trunk
workflow_dispatch:
env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
CARGO_NET_RETRY: 10
CARGO_HTTP_TIMEOUT: 60
CARGO_INCREMENTAL: 0
jobs:
changes:
name: Detect changes
runs-on: ubuntu-latest
outputs:
rust: ${{ steps.filter.outputs.rust }}
steps:
- uses: actions/checkout@v6
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
rust:
- '**/*.rs'
- '**/Cargo.toml'
- '**/Cargo.lock'
- 'rust-toolchain.toml'
- '.github/workflows/pr.yml'
check:
name: cargo check + test
runs-on: spiceai-macos
timeout-minutes: 60
needs: changes
if: needs.changes.outputs.rust == 'true'
steps:
- uses: actions/checkout@v6
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.91
cache: false # Using GHA cache is slower than re-installing
- name: cargo check
run: make check
- name: cargo test
run: make test
lint-fix:
name: cargo fmt + clippy fix
runs-on: spiceai-macos
timeout-minutes: 60
needs: changes
if: needs.changes.outputs.rust == 'true' && github.event_name == 'pull_request'
permissions:
contents: write
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.91
cache: false # Using GHA cache is slower than re-installing
- name: cargo fmt + clippy fix
run: make fix
- name: Commit fixes
run: |
git diff --quiet && exit 0
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add -A
git commit -m "chore: auto-fix cargo fmt + clippy"
git push