-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (59 loc) · 1.89 KB
/
ci.yaml
File metadata and controls
69 lines (59 loc) · 1.89 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
name: CI
on:
pull_request:
push:
branches: ["main"]
jobs:
changes:
name: Detect relevant file changes
runs-on: ubuntu-latest
outputs:
test: ${{ steps.filter.outputs.test }}
steps:
- uses: actions/checkout@v6
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
test:
- 'usajobsapi/**'
- 'tests/**'
- 'pyproject.toml'
- '.github/workflows/ci.yaml'
lint:
name: Lint Python
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/python-init
- name: Run commit hooks
run: uv run prek run --all-files --hook-stage manual
- uses: ./.github/actions/python-post
test:
needs: changes
if: needs.changes.outputs.test == 'true'
name: Test Python
runs-on: ubuntu-latest
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/python-init
- name: Run tests
run: uv run pytest --cov=usajobsapi --cov-report=term-missing --cov-report=xml --junitxml=junit.xml tests
- uses: ./.github/actions/python-post
- name: Warn if CODECOV_TOKEN is missing
if: ${{ !cancelled() && env.CODECOV_TOKEN == '' }}
run: printf "%s\n" "::warning::CODECOV_TOKEN secret not set; skipping Codecov uploads."
- name: Upload coverage to Codecov
if: ${{ !cancelled() && env.CODECOV_TOKEN != '' }}
uses: codecov/codecov-action@v5
with:
token: ${{ env.CODECOV_TOKEN }}
env:
CODECOV_STATUS: "project=default:threshold=80 patch=default:threshold=80"
- name: Upload test results to Codecov
if: ${{ !cancelled() && env.CODECOV_TOKEN != '' }}
uses: codecov/test-results-action@v1
with:
token: ${{ env.CODECOV_TOKEN }}