-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (44 loc) · 1.35 KB
/
python-tests.yml
File metadata and controls
53 lines (44 loc) · 1.35 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
name: "[Tests] Python Tests"
on:
workflow_call:
inputs:
python_version:
type: string
default: "3.12"
working_directory:
type: string
default: "."
jobs:
pytest:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python_version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Cache Poetry dependencies
uses: actions/cache@v5
with:
path: ${{ inputs.working_directory }}/.venv
key: venv-${{ matrix.os }}-${{ hashFiles(format('{0}/poetry.lock', inputs.working_directory)) }}
restore-keys: |
venv-${{ matrix.os }}-
- name: Add Poetry to PATH (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: echo "$env:USERPROFILE\.local\bin" >> $env:GITHUB_PATH
- name: Install dependencies
working-directory: ${{ inputs.working_directory }}
run: poetry install --with dev
- name: Run tests
working-directory: ${{ inputs.working_directory }}
run: poetry run pytest tests/ -v