Skip to content

Python package template #12

Python package template

Python package template #12

Workflow file for this run

name: CI
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
- uses: actions/setup-python@cfd55ca82492758d853442341ad4d8010466803a
with:
python-version: '3.12'
- name: Run pre-commit
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd
test:
needs: lint
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@cfd55ca82492758d853442341ad4d8010466803a
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@ff8a7d7de27005376176819789742a2280cc35e2
- name: Configure Poetry
run: poetry config virtualenvs.in-project true
- name: Cache dependencies
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
with:
path: .venv
key: v1-${{ runner.os }}-python-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
v1-${{ runner.os }}-python-${{ matrix.python-version }}-
- name: Install dependencies
run: poetry install --no-interaction --no-root
- name: Run tests
run: poetry run pytest