Add support for Python 3.12 #309
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: push-github-action | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Display Python version | |
run: python -c "import sys; print(sys.version)" | |
- name: Display pip version | |
run: python -m pip --version | |
- name: Get pip version | |
id: pip-version | |
run: echo "PIP_VERSION=$(python -m pip --version | cut -f 2 -d ' ')" >> $GITHUB_OUTPUT | |
- name: Install Poetry | |
run: pipx install "poetry>=1.4.0,<1.5.0" | |
- name: Display Poetry version | |
run: poetry --version | |
- name: Get Poetry version | |
id: poetry-version | |
run: echo "POETRY_VERSION=$(poetry --version | cut -f 3- -d ' ')" >> $GITHUB_OUTPUT | |
# NOTE: Necessary to cache pip files because the cached pypoetry | |
# virtualenv does depend on them. | |
- name: Cache pip files | |
id: cache-pip | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: pip--os-${{ runner.os }}-python-${{ matrix.python-version }}-pip-${{ steps.pip-version.outputs.PIP_VERSION }}-poetry-${{ steps.poetry-version.outputs.POETRY_VERSION }}-lock-${{ hashFiles('poetry.lock') }} | |
- name: Cache installed dependencies | |
id: cache-pypoetry | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pypoetry/virtualenvs | |
key: pypoetry--os-${{ runner.os }}-python-${{ matrix.python-version }}-pip-${{ steps.pip-version.outputs.PIP_VERSION }}-poetry-${{ steps.poetry-version.outputs.POETRY_VERSION }}-lock-${{ hashFiles('poetry.lock') }} | |
- name: Install dependencies with Poetry | |
if: ${{ (steps.cache-pip.outputs.cache-hit != 'true') || (steps.cache-pypoetry.outputs.cache-hit != 'true') }} | |
run: poetry install | |
- name: Lint | |
run: poetry run make lint | |
- name: Run tests | |
# Run tox using the version of Python in `PATH` | |
run: poetry run tox -e py |