-
Notifications
You must be signed in to change notification settings - Fork 2
59 lines (53 loc) · 1.75 KB
/
python-latest.yml
File metadata and controls
59 lines (53 loc) · 1.75 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Latest Python Support
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
# Collect available Python versions
get-python-versions:
runs-on: ubuntu-latest
outputs:
python-matrix: ${{ steps.trim.outputs.matrix }}
steps:
- uses: snok/latest-python-versions@v1
id: get-python-versions-action
with:
min-version: '3.12'
# keep only major.minor and remove duplicates
- name: Keep only major.minor
id: trim
shell: bash
run: |
versions='${{ steps.get-python-versions-action.outputs.latest-python-versions }}'
# → ["3.13.5","3.12.11", ...]
matrix=$(echo "$versions" \
| jq -c 'map(split(".")[:2] | join(".")) | unique')
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
# Use the trimmed versions list in matrix
test:
needs: [get-python-versions]
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ ubuntu-latest, windows-latest, macOS-latest ]
python-version: ${{ fromJson(needs.get-python-versions.outputs.python-matrix) }}
continue-on-error: true
steps:
- uses: actions/checkout@v4
- name: Set up Python on ${{ matrix.operating-system }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
- name: Install dependencies
run: |
python -m pip install -r requirements.txt -r test-requirements.txt
- name: Lint
run: |
python -m check_python_versions --expect 3.9- --only setup.py
- name: Test
env:
TEST_CONFIGURATION_ACCESS_TOKEN: ${{ secrets.TEST_CONFIGURATION_ACCESS_TOKEN }}
run: python -Werror -m pytest