Skip to content

Add more steps to workflow #1

Add more steps to workflow

Add more steps to workflow #1

Workflow file for this run

name: Check style, linting, typing, and tests
on:
workflow_dispatch:
push:
branches: ["**"]
paths-ignore:
["**.md", "**.sh", ".github/workflows/*.yml", ".editorconfig", "LICENSE"]
pull_request:
branches: [main]
paths-ignore:
["**.md", "**.sh", ".github/workflows/*.yml", ".editorconfig", "LICENSE"]
jobs:
test:
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]
poetry-version: ["1.6.1"]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# Cache the installation of Poetry itself, e.g. the next step. This prevents the workflow
# from installing Poetry every time, which can be slow. Note the use of the Poetry version
# number in the cache key, and the "-0" suffix: this allows you to invalidate the cache
# manually if/when you want to upgrade Poetry, or if something goes wrong.
- name: Cache poetry install
uses: actions/cache@v2
with:
path: ~/.local
key: poetry-${{ matrix.poetry-version }}-${{ matrix.os }}-${{ matrix.python-version }}-0
- name: Install poetry
uses: snok/install-poetry@v1
with:
version: ${{ matrix.poetry-version }}
virtualenvs-create: true
virtualenvs-in-project: true
# Cache your dependencies (i.e. all the stuff in your `pyproject.toml`).
# Note the cache key: if you're using multiple Python versions, or multiple OSes,
# you'd need to include them in the cache key.
- name: Cache dependencies
id: cache-deps
uses: actions/cache@v2
with:
path: .venv
key: deps-${{ hashFiles('**/poetry.lock') }}-${{ matrix.os }}-${{ matrix.python-version }}
# Install dependencies. `--no-root` means "install all dependencies but not the project
# itself", which is what you want to avoid caching your code. The `if` statement
# ensures this only runs on a cache miss.
- name: Poetry install
if: steps.cache-deps.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
# It fully-exercises the pyproject.toml and makes that if you add things like console-scripts
# at some point that they'll be installed and working.
- name: Poetry install (finalization)
run: poetry install --no-interaction
- name: Check style
run: poetry run poe style
- name: Check lint
run: poetry run poe lint
- name: Check typing
run: poetry run poe type
- name: Run tests
run: poetry run poe test