-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (68 loc) · 2.46 KB
/
build.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
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
name: build
on:
pull_request:
push:
branches:
- main
jobs:
linters:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.12"
cache: 'pip'
cache-dependency-path: 'requirements.txt'
- name: Install Ruff
run: |
python -m pip install --upgrade pip
pip install ruff
- name: Run Ruff
run: ruff check .
build:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
runs-on: ubuntu-latest
steps:
- name: Clone this repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'requirements.txt'
- name: Upgrade pip and install dependencies
run: python -m pip install --upgrade pip
- name: Install package
run: |
pip install -e ."[dev]"
pru
- name: Run tests
id: pytest
run: |
python3 -m pytest . -c pyproject.toml --cov-report term-missing --cov=src/pru
continue-on-error: true
- name: Run tests with last failed
id: pytest2
if: steps.pytest.outcome != 'success'
run: |
python3 -m pytest . --lf -c pyproject.toml --cov-report term-missing --cov=src/pru
continue-on-error: true
- name: Run pru if tests fail
id: run_pru
if: steps.pytest.outcome != 'success' && steps.pytest2.outcome != 'success'
run: |
python_version_minor=$(python -c "import sys; print(f'{sys.version_info.minor}')")
pru -r pytests/requirements/3_${python_version_minor}/requirements_single.txt
pru -r pytests/requirements/3_${python_version_minor}/requirements_mix.txt
echo "Contents of pytests/requirements/3_${python_version_minor}/requirements_single.txt:"
cat pytests/requirements/3_${python_version_minor}/requirements_single.txt
echo "Contents of pytests/requirements/3_${python_version_minor}/requirements_mix.txt:"
cat pytests/requirements/3_${python_version_minor}/requirements_mix.txt
- name: Fail the job if tests fail
if: steps.pytest.outcome != 'success' && steps.pytest2.outcome != 'success'
run: exit 1