Linux tests workflow (spyder-ide/qtawesome)
The Linux tests workflow from spyder-ide/qtawesome, explained and optimized by Latchkey.
CI health: B - good
Point runs-on at Latchkey and get run de-duplication, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Linux tests workflow from the spyder-ide/qtawesome repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: Linux tests
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
linux-qt5:
name: Linux Py${{ matrix.PYTHON_VERSION }} - ${{ matrix.QT_BINDING }} - ${{ matrix.QT_BINDING_VERSION }}
timeout-minutes: 15
runs-on: ubuntu-latest
env:
CI: True
QT_API: ${{ matrix.QT_BINDING }}
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
RUNNER_OS: 'ubuntu'
strategy:
fail-fast: false
matrix:
PYTHON_VERSION: ['3.9', '3.13']
QT_BINDING: ['pyqt5', 'pyside2']
include:
- QT_BINDING_VERSION: 'latest'
- PYTHON_VERSION: '3.10'
QT_BINDING: 'pyside2'
QT_BINDING_VERSION: 'latest'
exclude:
- PYTHON_VERSION: '3.13'
QT_BINDING: 'pyside2'
steps:
- name: Checkout branch
uses: actions/checkout@v2
- name: Install System Packages
run: |
sudo apt-get update --fix-missing
sudo apt-get install -qq pyqt5-dev-tools libxcb-xinerama0 xterm --fix-missing
- name: Install Conda
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: test
auto-update-conda: false
auto-activate-base: false
python-version: ${{ matrix.PYTHON_VERSION }}
channels: conda-forge,defaults
channel-priority: strict
conda-remove-defaults: true
- name: Install dependencies
shell: bash -l {0}
run: conda env update --file requirements/environment_tests_${{ matrix.QT_BINDING }}_${{ matrix.QT_BINDING_VERSION }}.yml
- name: Install Package
shell: bash -l {0}
run: pip install -e .
- name: Show environment information
shell: bash -l {0}
run: |
conda info
conda list
- name: Run tests
shell: bash -l {0}
run: |
xvfb-run --auto-servernum python example.py
xvfb-run --auto-servernum pytest -x -vv --cov-report xml --cov=qtawesome qtawesome
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
linux-qt6:
name: Linux Py${{ matrix.PYTHON_VERSION }} - ${{ matrix.QT_BINDING }} - ${{ matrix.QT_BINDING_VERSION }}
timeout-minutes: 15
runs-on: ubuntu-latest
env:
CI: True
QT_API: ${{ matrix.QT_BINDING }}
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
RUNNER_OS: 'ubuntu'
strategy:
fail-fast: false
matrix:
PYTHON_VERSION: ['3.9', '3.13']
QT_BINDING: ['pyqt6', 'pyside6']
include:
- QT_BINDING_VERSION: 'latest'
- PYTHON_VERSION: '3.13' # PySide6 but specific version (6.8.3) on Python 3.13
QT_BINDING: 'pyside6'
QT_BINDING_VERSION: '6.8.3'
steps:
- name: Checkout branch
uses: actions/checkout@v2
- name: Install System Packages
run: |
sudo apt-get update --fix-missing
sudo apt-get install -qq pyqt6-dev-tools --fix-missing
- name: Setup a headless display
uses: pyvista/setup-headless-display-action@v3
with:
qt: true
- name: Install Conda
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: test
auto-update-conda: false
auto-activate-base: false
python-version: ${{ matrix.PYTHON_VERSION }}
channels: conda-forge,defaults
channel-priority: strict
conda-remove-defaults: true
- name: Install dependencies
shell: bash -l {0}
run: conda env update --file requirements/environment_tests_${{ matrix.QT_BINDING }}_${{ matrix.QT_BINDING_VERSION }}.yml
- name: Install Package
shell: bash -l {0}
run: pip install -e .
- name: Show environment information
shell: bash -l {0}
run: |
conda info
conda list
- name: Run tests
shell: bash -l {0}
run: |
xvfb-run --auto-servernum python example.py
xvfb-run --auto-servernum pytest -x -vv --cov-report xml --cov=qtawesome qtawesome
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Linux tests on: push: branches: - master pull_request: branches: - master concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: linux-qt5: name: Linux Py${{ matrix.PYTHON_VERSION }} - ${{ matrix.QT_BINDING }} - ${{ matrix.QT_BINDING_VERSION }} timeout-minutes: 15 runs-on: latchkey-small env: CI: True QT_API: ${{ matrix.QT_BINDING }} PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }} RUNNER_OS: 'ubuntu' strategy: fail-fast: false matrix: PYTHON_VERSION: ['3.9', '3.13'] QT_BINDING: ['pyqt5', 'pyside2'] include: - QT_BINDING_VERSION: 'latest' - PYTHON_VERSION: '3.10' QT_BINDING: 'pyside2' QT_BINDING_VERSION: 'latest' exclude: - PYTHON_VERSION: '3.13' QT_BINDING: 'pyside2' steps: - name: Checkout branch uses: actions/checkout@v2 - name: Install System Packages run: | sudo apt-get update --fix-missing sudo apt-get install -qq pyqt5-dev-tools libxcb-xinerama0 xterm --fix-missing - name: Install Conda uses: conda-incubator/setup-miniconda@v3 with: activate-environment: test auto-update-conda: false auto-activate-base: false python-version: ${{ matrix.PYTHON_VERSION }} channels: conda-forge,defaults channel-priority: strict conda-remove-defaults: true - name: Install dependencies shell: bash -l {0} run: conda env update --file requirements/environment_tests_${{ matrix.QT_BINDING }}_${{ matrix.QT_BINDING_VERSION }}.yml - name: Install Package shell: bash -l {0} run: pip install -e . - name: Show environment information shell: bash -l {0} run: | conda info conda list - name: Run tests shell: bash -l {0} run: | xvfb-run --auto-servernum python example.py xvfb-run --auto-servernum pytest -x -vv --cov-report xml --cov=qtawesome qtawesome - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 with: fail_ci_if_error: true verbose: true env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} linux-qt6: name: Linux Py${{ matrix.PYTHON_VERSION }} - ${{ matrix.QT_BINDING }} - ${{ matrix.QT_BINDING_VERSION }} timeout-minutes: 15 runs-on: latchkey-small env: CI: True QT_API: ${{ matrix.QT_BINDING }} PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }} RUNNER_OS: 'ubuntu' strategy: fail-fast: false matrix: PYTHON_VERSION: ['3.9', '3.13'] QT_BINDING: ['pyqt6', 'pyside6'] include: - QT_BINDING_VERSION: 'latest' - PYTHON_VERSION: '3.13' # PySide6 but specific version (6.8.3) on Python 3.13 QT_BINDING: 'pyside6' QT_BINDING_VERSION: '6.8.3' steps: - name: Checkout branch uses: actions/checkout@v2 - name: Install System Packages run: | sudo apt-get update --fix-missing sudo apt-get install -qq pyqt6-dev-tools --fix-missing - name: Setup a headless display uses: pyvista/setup-headless-display-action@v3 with: qt: true - name: Install Conda uses: conda-incubator/setup-miniconda@v3 with: activate-environment: test auto-update-conda: false auto-activate-base: false python-version: ${{ matrix.PYTHON_VERSION }} channels: conda-forge,defaults channel-priority: strict conda-remove-defaults: true - name: Install dependencies shell: bash -l {0} run: conda env update --file requirements/environment_tests_${{ matrix.QT_BINDING }}_${{ matrix.QT_BINDING_VERSION }}.yml - name: Install Package shell: bash -l {0} run: pip install -e . - name: Show environment information shell: bash -l {0} run: | conda info conda list - name: Run tests shell: bash -l {0} run: | xvfb-run --auto-servernum python example.py xvfb-run --auto-servernum pytest -x -vv --cov-report xml --cov=qtawesome qtawesome - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 with: fail_ci_if_error: true verbose: true env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Cancel superseded runs when a branch or PR gets a newer push.
3 third-party actions are referenced by a movable tag. Pin them to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.
What Latchkey heals here
This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:
- Dependency installs
This workflow runs 2 jobs (8 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.