Skip to content

Commit

Permalink
ci: check every PR against baseline versions of deps
Browse files Browse the repository at this point in the history
  • Loading branch information
xen0n committed Dec 29, 2024
1 parent 59c2ceb commit e07f80c
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on:

jobs:
lint:
name: 'lint & typecheck & test (Python ${{ matrix.python }})'
name: "lint & typecheck & test (Python ${{ matrix.python }}${{ matrix.baseline && ', baseline deps' || '' }}${{ matrix.experimental && ', experimental' || '' }})"
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
Expand All @@ -33,9 +33,14 @@ jobs:
- '3.11'
- '3.12'
experimental: [false]
baseline: [false]
include:
- python: '3.13'
baseline: false
experimental: true
- python: '3.10'
baseline: true
experimental: false
steps:
- uses: actions/checkout@v4
- name: Install Poetry
Expand All @@ -46,6 +51,9 @@ jobs:
cache: poetry
- name: Install deps
run: poetry install --with=dev
- name: Replace deps with baseline versions
if: matrix.baseline
run: ./scripts/install-baseline-deps.sh
- name: Lint with ruff
run: poetry run ruff check
- name: Type-check with mypy
Expand Down
26 changes: 26 additions & 0 deletions scripts/install-baseline-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

set -e

MY_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

main() {
local requirements_file="$MY_DIR/requirements.baseline.txt"

# Install pygit2 build deps -- prebuilt 1.6.1 wheels on PyPI are only
# available for Python up to 3.9.
export DEBIAN_FRONTEND=noninteractive
export DEBCONF_NONINTERACTIVE_SEEN=true
sudo apt-get update -qqy
sudo apt-get install -qqy libgit2-dev

# Workaround https://github.com/yaml/pyyaml/issues/724 because we need
# exactly this version of PyYAML for faithful reproduction of the baseline
# environment.
poetry run pip install 'Cython<3'
poetry run pip install --no-build-isolation 'PyYAML==5.4.1'

poetry run pip install -r "$requirements_file"
}

main "$@"
13 changes: 13 additions & 0 deletions scripts/requirements.baseline.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Package versions provided by Ubuntu 22.04 LTS.
arpy==1.1.1
certifi==2020.6.20
jinja2==3.0.3
packaging==21.3
pygit2==1.6.1
# pyyaml==5.4.1 # https://github.com/yaml/pyyaml/issues/724
requests==2.25.1
rich==11.2.0
semver==2.10.2
tomli==1.2.2
tomlkit==0.9.2
typing_extensions==3.10.0.2

0 comments on commit e07f80c

Please sign in to comment.