Skip to content

Switch to Poetry

Switch to Poetry #34

Workflow file for this run

name: Test
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
tags:
- '**'
jobs:
test:
runs-on: ubuntu-latest
strategy:
# Playlist title is the same for all tests, which would make tests clash with each other.
# Thus running only one Python version at a time.
# TODO: Figure out how to make this run in parallel
max-parallel: 1
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
name: Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: |
pip install pre-commit
pre-commit run --all-files
if: matrix.python-version == '3.12'
- run: |
pip install poetry
poetry install
- run: |
poetry run python tests/tools/authenticate.py
poetry run pytest -s
env:
D8Y_AUTH_CACHE_DATA: ${{ secrets.D8Y_AUTH_CACHE_DATA }}
- uses: codecov/codecov-action@v4
if: matrix.python-version == '3.12'
# Update the secret with the data from D8Y_AUTH_CACHE_FILE in order to keep it in sync across test runs for
# different Python versions.
- id: capture_auth_cache_data
run: echo "AUTH_CACHE_DATA=$(cat $GITHUB_WORKSPACE/tests/data/auth)" >> $GITHUB_OUTPUT
- uses: gliech/create-github-secret-action@v1
with:
name: D8Y_AUTH_CACHE_DATA
value: ${{ steps.capture_auth_cache_data.outputs.AUTH_CACHE_DATA }}
pa_token: ${{ secrets.GH_TOKEN }}
publish:
if: github.ref_type == 'tag'
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: poetry publish --build
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}