summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authornessita <124304+nessita@users.noreply.github.com>2024-10-09 14:33:48 -0300
committerGitHub <noreply@github.com>2024-10-09 14:33:48 -0300
commit345a6652e6a15febbf4f68351dcea5dd674ea324 (patch)
tree3a50d87fef4c732cc4679f63949015922120b588 /.github
parent52116774549e27ac5d1ba9423e2fe61c5503a4a4 (diff)
[4.2.x] Added GitHub Action workflow to test all Python versions listed in the project config file.
Backport of 470f4c2436e00873a31673a5992c5260b2de4e97 from main.
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/python_matrix.yml52
1 files changed, 52 insertions, 0 deletions
diff --git a/.github/workflows/python_matrix.yml b/.github/workflows/python_matrix.yml
new file mode 100644
index 0000000000..314d9301b8
--- /dev/null
+++ b/.github/workflows/python_matrix.yml
@@ -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" setup.cfg | 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