github actions: fix installation after move to ubuntu 24.04 #143
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: Python check | |
on: | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
name: Check if every commit in the PR works | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- name: Compute PR fetch depth | |
shell: bash | |
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits || 1 }} + 1 ))" >> "${GITHUB_ENV}" | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: ${{ env.PR_FETCH_DEPTH }} | |
- name: install cairo so we can install hwgraph dependencies | |
run: apt install libcairo2 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
version: "0.4.28" | |
enable-cache: true | |
- name: Set up Python ${{ matrix.python-version }} | |
run: uv python install ${{ matrix.python-version }} | |
- name: Test every commit in the PR for Python ${{ matrix.python-version }} | |
run: | | |
COMMITS=$(git rev-list ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}) | |
for commit in $COMMITS; do | |
git checkout $commit || exit 1 | |
git show --no-patch --format='Testing commit %h %s' | |
make sync_deps check_ci bundle || exit 1 | |
done | |
- name: Minimize uv cache | |
run: uv cache prune --ci |