-
Notifications
You must be signed in to change notification settings - Fork 4
87 lines (72 loc) · 2.35 KB
/
test.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
81
82
83
84
85
86
87
name: tests
on:
workflow_dispatch:
push:
branches:
- "*" # matches every branch that doesn't contain a '/'
- "*/*" # matches every branch containing a single '/'
- "**" # matches every branch
jobs:
run_tests:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Check out GitHub repository ${{ github.repository }}
uses: actions/checkout@v4
- name: Set up Python on ${{ runner.os }}
uses: actions/setup-python@v5
id: setup_python
with:
python-version: '3.10'
- name: Get Python version
run: echo "PYTHON_VERSION=$(python --version)" >> $GITHUB_ENV
- name: Manage Poetry cache
uses: actions/cache@v4
id: poetry-cache
with:
path: |
~/.cache/pypoetry/cache
~/.cache/pypoetry/artifacts
key: poetry-cache-${{ runner.os }}-${{ hashFiles('poetry.lock') }}
restore-keys: poetry-cache-${{ runner.os }}-
- name: Create virtual environment on ${{ env.PYTHON_VERSION }}
run: python -m venv venv
- name: Activate virtual environment and install Poetry
run: |
source venv/bin/activate
python --version
pip install --upgrade pip
pip install poetry==2.0.0
- name: Install dependencies with Poetry
run: |
source venv/bin/activate
poetry install --with dev
- name: Check and fix with Ruff
run: |
source venv/bin/activate
poetry run ruff check ./tests/*.py ./openseries/*.py --fix --exit-non-zero-on-fix
- name: Format with Ruff
run: |
source venv/bin/activate
poetry run ruff format
- name: Manage Mypy cache
uses: actions/cache@v4
id: mypy-cache
with:
path: .mypy_cache
key: mypy-cache-${{ hashFiles('**/*.py') }}
restore-keys: mypy-cache-
- name: Type check with Mypy
run: |
source venv/bin/activate
poetry run mypy --cache-dir .mypy_cache .
- name: Tests with Pytest
run: |
source venv/bin/activate
PYTHONPATH=${PWD} poetry run coverage run -m pytest --verbose --capture=no
- name: Report coverage
run: |
source venv/bin/activate
poetry run coverage report