Fix CI and update to latest Ubuntu/Python versions #129
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: pre-merge | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
on: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
pre-merge: | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.12"] | |
include: | |
- python-version: "3.10" | |
python-py-version: "py310" | |
- python-version: "3.12" | |
python-py-version: "py312" | |
container: | |
image: ghcr.io/${{ github.repository }}-ci:${{ matrix.python-py-version }}-poetry-bullseye | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Poetry Venv Dir | |
run: | | |
echo "VENV_DIR=$(poetry config virtualenvs.path)" >> $GITHUB_ENV | |
- name: Restore the Cache | |
id: cache-deps | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.VENV_DIR }} | |
# bump the suffix if you need to force-refresh the cache | |
key: py-trees-ci-cache-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock', '**/tox.ini') }}-1 | |
# Install all deps, sans the project (--no-root) | |
- name: Poetry - Install Dependencies | |
run: poetry install --no-interaction --no-root | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
# Project is installed separately to avoid always invalidating the cache | |
- name: Poetry - Install Project | |
run: poetry install --no-interaction | |
# TODO: Caching above doesn't make much sense when tox effectively re-installs deps | |
- name: Tox - Tests | |
run: poetry run tox --workdir ${{ env.VENV_DIR }} -e ${{ matrix.python-py-version }} | |
- name: Tox - Formatters, Linters | |
run: poetry run tox --workdir ${{ env.VENV_DIR }} -e check | |
- name: Tox - MyPy | |
run: poetry run tox --workdir ${{ env.VENV_DIR }} -e my${{ matrix.python-py-version }} |