Skip to content

Copy to output directory #14

Copy to output directory

Copy to output directory #14

Workflow file for this run

name: Python Package
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
# no inputs
concurrency:
group: python-package-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions: read-all
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repo
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
#----------------------------------------------
# install & configure poetry
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-in-project: true
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install poetry
poetry install
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
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: poetry install --no-interaction --no-root
#----------------------------------------------
# run linter
#----------------------------------------------
# - name: Lint with ruff
# run: |
# source .venv/bin/activate
# # stop the build if there are Python syntax errors or undefined names
# ruff check . --select=E9,F63,F7,F82 --output-format=full --no-fix --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# ruff check . --select=E501,C901 --line-length=127 --exit-zero --no-fix --statistics
#----------------------------------------------
# run tests
#----------------------------------------------
- name: Test with pytest
run: |
source .venv/bin/activate
pytest
build_success:
name: Build Success
runs-on: ubuntu-latest
needs: build
steps:
- run: echo Done!