-
Notifications
You must be signed in to change notification settings - Fork 3
49 lines (45 loc) · 1.57 KB
/
python_matrix.yaml
File metadata and controls
49 lines (45 loc) · 1.57 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
name: Python Matrix from config file
on:
pull_request:
types: [labeled, synchronize, opened, reopened]
paths-ignore:
- 'docs/**'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
define-matrix:
if: contains(github.event.pull_request.labels.*.name, 'python-matrix')
runs-on: ubuntu-latest
outputs:
python_versions_output: ${{ steps.set-matrix.outputs.python_versions }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- id: set-matrix
run: |
python_versions=$(sed -n "s/^.*Programming Language :: Python :: \([[:digit:]]\+\.[[:digit:]]\+\).*$/'\1', /p" pyproject.toml | tr -d '\n' | sed 's/, $//g')
echo "Supported Python versions: $python_versions"
echo "python_versions=[$python_versions]" >> "$GITHUB_OUTPUT"
python:
runs-on: ubuntu-latest
needs: define-matrix
strategy:
matrix:
python-version: ${{ fromJson(needs.define-matrix.outputs.python_versions_output) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
uses: abatilo/actions-poetry@v3
- name: Install and upgrade packaging tools
run: poetry install --no-interaction --all-extras --with dev
- name: Run tests
run: poetry run python -Wall tests/runtests.py -v2