Repository navigation
91 lines (77 loc) · 2.59 KB
/
Copy pathpython-check.yaml
File metadata and controls
91 lines (77 loc) · 2.59 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
90
91
on:
push:
branches:
- main
paths:
- python-package/**
- .github/workflows/python-check.yaml
pull_request:
branches:
- main
paths:
- python-package/**
- .github/workflows/python-check.yaml
name: python-check
permissions: read-all
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
python-check:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
name: ${{ matrix.os }} (${{ matrix.python-version }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
defaults:
run:
working-directory: python-package
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
cache-dependency-glob: python-package/uv.lock
- name: Install dependencies
run: uv sync --frozen --extra geo
- name: Run unit tests
if: ${{ !(runner.os == 'Linux' && matrix.python-version == '3.12') }}
run: uv run --frozen pytest -m "not r_parity"
# Roda a partir da RAIZ do repo (e nao de python-package/) para que o
# coverage.xml grave filenames relativos a raiz
# (ex.: "python-package/geocodebr/geocode.py"), em sintonia com o
# paths da flag "python" no codecov.yml.
- name: Run unit tests with coverage
if: ${{ runner.os == 'Linux' && matrix.python-version == '3.12' }}
working-directory: .
run: >
uv run --project python-package --frozen pytest
python-package/tests
-m "not r_parity"
--cov=geocodebr
--cov-report=xml
--cov-report=term-missing
- name: Upload coverage to Codecov
if: ${{ runner.os == 'Linux' && matrix.python-version == '3.12' }}
uses: codecov/codecov-action@v4
with:
# Fail if error if not on PR, or if on PR and token is given
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
file: coverage.xml
plugin: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}
flags: python
name: codecov-python
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: pytest-log-${{ matrix.os }}-py${{ matrix.python-version }}
path: coverage.xml
if-no-files-found: ignore