Skip to content

Commit

Permalink
Added GitHub Action workflow to test all Python versions listed in th…
Browse files Browse the repository at this point in the history
…e project config file.
  • Loading branch information
nessita authored Oct 9, 2024
1 parent fc1119e commit 470f4c2
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/python_matrix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
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 }}
cache: 'pip'
cache-dependency-path: 'tests/requirements/py3.txt'
- name: Install libmemcached-dev for pylibmc
run: sudo apt-get install libmemcached-dev
- name: Install and upgrade packaging tools
run: python -m pip install --upgrade pip setuptools wheel
- run: python -m pip install -r tests/requirements/py3.txt -e .
- name: Run tests
run: python tests/runtests.py -v2

0 comments on commit 470f4c2

Please sign in to comment.