-
Notifications
You must be signed in to change notification settings - Fork 18
65 lines (62 loc) · 2.11 KB
/
Copy pathtest.yml
File metadata and controls
65 lines (62 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
name: Python package
# pull_request_target gives PR runs access to secrets.CODECOV_TOKEN, including
# fork and Dependabot PRs. Each checkout below fetches the PR head so coverage
# reflects the PR's code. This exposes the (upload-only) token to PR code.
on: [push, pull_request_target]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel setuptools
pip install -e .[dev,test]
- name: Lint
run: |
ruff check
ruff format --check
- name: Type check
run: |
mypy netconan/
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel setuptools
pip install -e .[test]
- name: Test
run: |
pytest
- name: Upload coverage to Codecov
# PRs and pushes to master only; other-branch pushes (e.g. Dependabot)
# lack the token. Each version uploads under its own flag; Codecov
# merges all uploads for a commit.
if: >-
github.event_name == 'pull_request_target' ||
github.ref == 'refs/heads/master'
uses: codecov/codecov-action@v7
with:
files: coverage.xml
flags: python-${{ matrix.python-version }}
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
override_commit: ${{ github.event.pull_request.head.sha }}
override_pr: ${{ github.event.pull_request.number }}