-
Notifications
You must be signed in to change notification settings - Fork 29
58 lines (45 loc) · 1.81 KB
/
Copy pathtests.yaml
File metadata and controls
58 lines (45 loc) · 1.81 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
name: Tests
on:
merge_group:
pull_request:
jobs:
test:
name: Tests
runs-on: ubuntu-latest
permissions:
contents: write # Required for git-auto-commit-action.
steps:
- name: Checkout
uses: actions/checkout@v6
with:
# Internal PRs: Check out the head branch so git-auto-commit-action can push pre-commit fixes.
# Fork PRs: The head branch doesn't exist in this repo, so fall back to the default merge ref.
ref: ${{ github.event.pull_request.head.repo.full_name == github.repository && github.head_ref || '' }}
- name: Install uv
uses: astral-sh/setup-uv@v8.1.0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version-file: pyproject.toml
- name: Install dependencies
run: uv sync --extra dev --frozen
- name: Run pre-commit
id: run-pre-commit
continue-on-error: true
uses: pre-commit/action@v3.0.1
- name: Commit and push changes
# Fork PRs: The token is read-only so it's not possible to push pre-commit fixes.
if: github.event.pull_request.head.repo.full_name == github.repository
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: Apply pre-commit
- name: Run tests
run: uv run pytest tests/ --color=yes --cov=eva --cov-report=term-missing --durations=10
- name: pre-commit failed (fork PR)
if: steps.run-pre-commit.outcome == 'failure' && github.event.pull_request.head.repo.full_name != github.repository
run: |
echo "::error::Please run 'uv run pre-commit run --all-files', commit the fixes, and push."
exit 1
- name: pre-commit failed (internal PR)
if: steps.run-pre-commit.outcome == 'failure'
run: exit 1