-
Notifications
You must be signed in to change notification settings - Fork 1
116 lines (109 loc) · 3.54 KB
/
run-tests.yaml
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Tests, Code Quality and Documentation
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
workflow_dispatch:
jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11"]
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Run poetry image
uses: abatilo/actions-poetry@v3.0.1
with:
poetry-version: ${{ vars.POETRY_VERSION }}
- name: Install dependencies
run: |
poetry install --with dev
- name: Run tests
run: |
poetry run pytest --cov=pystatis --vcr-record=none tests
code-quality:
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
# only support specific python version, as guidelines differ beween (minor) versions
python-version: ["3.11.7"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Run poetry image
uses: abatilo/actions-poetry@v3.0.1
with:
poetry-version: ${{ vars.POETRY_VERSION }}
- name: Install dependencies
run: poetry install --with dev
- name: Ruff format check
run: poetry run ruff format --check src
- name: Ruff lint check
run: poetry run ruff check src
- name: Run bandit
run: poetry run bandit -r src
- name: Run Safety CLI to check for vulnerabilities
uses: pyupio/safety-action@v1.0.1
with:
api-key: ${{ secrets.SAFETY_API_KEY }}
args: "--short-report --policy-file=.safety-policy.yml"
- name: Run mypy
run: poetry run mypy src
sphinx-documentation-and-coverage:
runs-on: ubuntu-latest
name: Sphinx Documentation and Test Coverage
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ vars.PYTHON_VERSION}}
uses: actions/setup-python@v5
with:
python-version: ${{ vars.PYTHON_VERSION}}
- name: Run poetry image
uses: abatilo/actions-poetry@v3.0.1
with:
poetry-version: ${{ vars.POETRY_VERSION }}
- name: Install dependencies
run: |
poetry install --with dev
- name: Build documentation
run: |
cd docs
poetry run make clean
poetry run make html
- name: Upload documentation as artifacts
uses: actions/upload-artifact@v4
with:
name: docs
path: docs/build/html/*
retention-days: 5
- name: Generate and filter test coverage report
run: |
poetry run pytest --cov=src/pystatis --cov-report=xml --vcr-record=none tests
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v5.0.7
with:
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}