-
Notifications
You must be signed in to change notification settings - Fork 5
46 lines (39 loc) · 1.36 KB
/
python-check.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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 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