Skip to content

CI

CI #46

Workflow file for this run

name: CI
on:
push:
branches-ignore:
- 'gh-readonly-queue/**' # don't run (again) when on these special branches created during merge groups; the `on: merge_group` already triggers it.
merge_group:
env:
PYTHONUNBUFFERED: True
PRE_COMMIT_HOME: ${{ github.workspace }}/.precommit_cache
permissions:
id-token: write
contents: write # needed for mutex
jobs:
lint:
name: Pre-commit
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Install latest versions of python packages
uses: ./.github/actions/install_deps_uv
with:
python-version: 3.12.7
- name: Set up mutex # Github concurrency management is horrible, things get arbitrarily cancelled if queued up. So using mutex until github fixes itself. When multiple jobs are modifying cache at once, weird things can happen. possible issue is https://github.com/actions/toolkit/issues/658
if: ${{ runner.os != 'Windows' }} # we're just gonna have to YOLO on Windows, because this action doesn't support it yet https://github.com/ben-z/gh-action-mutex/issues/14
uses: ben-z/gh-action-mutex@d3d5b354d460d4b6a1e3ee5b7951678658327812 # v1.0.0-alpha.9
with:
branch: mutex-venv-ubuntu-24.04-py3.12.7
timeout-minutes: 30 # this is the amount of time this action will wait to attempt to acquire the mutex lock before failing, e.g. if other jobs are queued up in front of it
- name: Cache Pre-commit hooks
uses: actions/[email protected]
env:
cache-name: cache-pre-commit-hooks
with:
path: ${{ env.PRE_COMMIT_HOME }}
key: ubuntu-24.04-py3.12.7-build-${{ env.cache-name }}-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
ubuntu-24.04-py3.12.7-build-${{ env.cache-name }}-
- name: Run pre-commit
run: pre-commit run -a
test:
needs: [ lint ]
strategy:
matrix:
os:
- "ubuntu-24.04"
- windows-2022
python-version:
- 3.12.7
include:
- os: "ubuntu-24.04"
python-version: "3.12.7"
JOB_MATCHING_DEV_ENV: true
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Install python tooling
uses: ./.github/actions/install_deps_uv
with:
python-version: ${{ matrix.python-version }}
- name: Unit test
run: uv run pytest --cov-report=xml --durations=5
- name: Upload coverage to Codecov
# only upload coverage from fastest job
if: matrix.JOB_MATCHING_DEV_ENV == true
uses: codecov/[email protected]
with:
files: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
slug: LabAutomationAndScreening/pyalab
build-docs:
needs: [ lint ]
strategy:
matrix:
python-version:
- 3.12.7
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Install python tooling
uses: ./.github/actions/install_deps_uv
with:
python-version: ${{ matrix.python-version }}
- name: Build docs
working-directory: ./docs
run: uv run make html SPHINXOPTS="-W"
required-check:
runs-on: ubuntu-24.04
needs: [ test, build-docs ]
if: always()
steps:
- name: fail if prior job failure
if: needs.test.result != 'success' || needs.build-docs.result != 'success'
run: |
exit 1