64 lines
2.3 KiB
YAML
64 lines
2.3 KiB
YAML
name: test
|
|
|
|
on: push
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
#----------------------------------------------
|
|
# check-out repo and set-up python
|
|
#----------------------------------------------
|
|
- name: Check out repository
|
|
uses: actions/checkout@v7
|
|
- name: Set up python
|
|
id: setup-python
|
|
uses: actions/setup-python@v7
|
|
with:
|
|
python-version: "3.14"
|
|
#----------------------------------------------
|
|
# install & configure poetry
|
|
#----------------------------------------------
|
|
- name: Load cached Poetry installation
|
|
id: cached-poetry
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: ~/.local # the path depends on the OS
|
|
key: poetry-1 # increment to reset cache
|
|
- name: Install Poetry
|
|
if: steps.cached-poetry.outputs.cache-hit != 'true'
|
|
uses: snok/install-poetry@v1
|
|
with:
|
|
virtualenvs-create: true
|
|
virtualenvs-in-project: true
|
|
virtualenvs-path: .venv
|
|
installer-parallel: true
|
|
#----------------------------------------------
|
|
# load cached venv if cache exists
|
|
#----------------------------------------------
|
|
- name: Load cached venv
|
|
id: cached-poetry-dependencies
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: .venv
|
|
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
|
|
#----------------------------------------------
|
|
# install dependencies if cache does not exist
|
|
#----------------------------------------------
|
|
- name: Install dependencies
|
|
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
|
|
run: ~/.local/bin/poetry install --no-interaction --no-root
|
|
#----------------------------------------------
|
|
# install your root project, if required
|
|
#----------------------------------------------
|
|
- name: Install project
|
|
run: ~/.local/bin/poetry install --no-interaction
|
|
#----------------------------------------------
|
|
# run test suite
|
|
#----------------------------------------------
|
|
- name: Run tests
|
|
run: |
|
|
source .venv/bin/activate
|
|
coverage run -m pytest tests/
|
|
coverage report
|