-
Notifications
You must be signed in to change notification settings - Fork 111
89 lines (80 loc) · 2.41 KB
/
dupekit-unit-tests.yaml
File metadata and controls
89 lines (80 loc) · 2.41 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
89
name: Dupekit - Tests
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
changes:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
should_run: ${{ steps.filter.outputs.relevant }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
relevant:
- 'rust/dupekit/**'
- 'uv.lock'
- '.github/workflows/dupekit-unit-tests.yaml'
check-user-mode:
needs: changes
if: needs.changes.outputs.should_run == 'true'
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Ensure pyproject.toml is in user mode
run: |
if grep -q 'dupekit = { path' pyproject.toml; then
echo "ERROR: pyproject.toml has dev-mode dupekit source. Run 'make rust-user' before committing."
exit 1
fi
unit-test:
needs: [changes, check-user-mode]
if: needs.changes.outputs.should_run == 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "rust/dupekit/uv.lock"
- name: Test dupekit
run: |
cd rust/dupekit && uv run --frozen --group test pytest tests/ -v
rust-checks:
needs: changes
if: needs.changes.outputs.should_run == 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: cargo fmt
run: cargo fmt --manifest-path rust/dupekit/Cargo.toml -- --check
- name: cargo clippy
run: cargo clippy --manifest-path rust/dupekit/Cargo.toml -- -D warnings
- name: cargo test
run: cargo test --manifest-path rust/dupekit/Cargo.toml