Skip to content

Bump actions/cache from 3 to 4 #54

Bump actions/cache from 3 to 4

Bump actions/cache from 3 to 4 #54

Workflow file for this run

name: Tests
on:
push:
branches:
- master
- develop
pull_request:
branches:
- '**'
concurrency:
group: tests-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
tests:
name: ${{ matrix.os }} / ${{ matrix.python-version }}
runs-on: ${{ matrix.image }}
strategy:
matrix:
os: [Ubuntu, Windows, MacOS]
python-version: ["3.8", "3.9", "3.10"]
qt-version: ["pyside2", "pyside6", "pyqt5", "pyqt6"]
include:
- os: Ubuntu
image: ubuntu-20.04
- os: Windows
image: windows-2022
- os: MacOS
image: macos-12
fail-fast: false
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Get full Python version
id: full-python-version
run: echo version=$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") >> $GITHUB_OUTPUT
- name: Bootstrap poetry
run: |
curl -sSL https://install.python-poetry.org | python - -y
- name: Update Path
if: ${{ matrix.os != 'Windows' }}
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Update Path for Windows
if: ${{ matrix.os == 'Windows' }}
run: echo "$APPDATA\Python\Scripts" >> $GITHUB_PATH
- name: Enable long paths on Windows
if: ${{ matrix.os == 'Windows' }}
run: git config --system core.longpaths true
- name: Configure poetry
run: poetry config virtualenvs.in-project true
- name: Setup cache
uses: actions/cache@v4
id: cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.qt-version }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
- name: Valdate cache
if: steps.cache.outputs.cache-hit == 'true'
run: |
# `timeout` is not available on macOS, so we define a custom function.
[ "$(command -v timeout)" ] || function timeout() { perl -e 'alarm shift; exec @ARGV' "$@"; }
# Using `timeout` is a safeguard against the Poetry command hanging for some reason.
timeout 10s poetry run pip --version || rm -rf .venv
- name: Check lock file
run: poetry check --lock
- name: Install dependencies
run: poetry install --with github-actions
# - name: Run mypy
# run: poetry run mypy
- name: Install Qt
run: poetry run pip install ${{ matrix.qt-version }}
- name: Install libxcb dependencies
if: ${{ matrix.os == 'Ubuntu' }}
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get -qq update
sudo apt-get -qq install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev
- name: Run pytest
uses: coactions/setup-xvfb@v1
env:
QT_API: ${{ matrix.qt-version }}
with:
run: poetry run pytest --cov qasync -v