-
Notifications
You must be signed in to change notification settings - Fork 4
50 lines (47 loc) · 1.31 KB
/
hooks_test_pr.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
name: Apply pre-commit and run tests on PR
on:
pull_request:
jobs:
# pre-commit hooks job
pre-commit:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python 3.11.9
uses: actions/setup-python@v2
with:
python-version: "3.11.9"
- name: Setup PDM
uses: pdm-project/setup-pdm@v4
- name: Install dependencies
run: pdm install --frozen-lockfile
- name: Cache pre-commit hooks
uses: actions/cache@v2
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-precommit-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Install pre-commit
run: pdm run pip install pre-commit
- name: Run pre-commit
run: pdm run pre-commit run --all-files
# testing job
test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python 3.11.9
uses: actions/setup-python@v2
with:
python-version: "3.11.9"
- name: Setup PDM
uses: pdm-project/setup-pdm@v4
- name: Install dependencies
run: pdm install --frozen-lockfile
- name: Run tests
run: pdm run pytest