|
| 1 | +name: Python Matrix from config file |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [labeled, synchronize, opened, reopened] |
| 6 | + paths-ignore: |
| 7 | + - 'docs/**' |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +concurrency: |
| 11 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 12 | + cancel-in-progress: true |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: read |
| 16 | + |
| 17 | +jobs: |
| 18 | + define-matrix: |
| 19 | + if: contains(github.event.pull_request.labels.*.name, 'python-matrix') |
| 20 | + runs-on: ubuntu-latest |
| 21 | + outputs: |
| 22 | + python_versions_output: ${{ steps.set-matrix.outputs.python_versions }} |
| 23 | + steps: |
| 24 | + - name: Checkout code |
| 25 | + uses: actions/checkout@v4 |
| 26 | + - id: set-matrix |
| 27 | + run: | |
| 28 | + python_versions=$(sed -n "s/^.*Programming Language :: Python :: \([[:digit:]]\+\.[[:digit:]]\+\).*$/'\1', /p" pyproject.toml | tr -d '\n' | sed 's/, $//g') |
| 29 | + echo "Supported Python versions: $python_versions" |
| 30 | + echo "python_versions=[$python_versions]" >> "$GITHUB_OUTPUT" |
| 31 | + python: |
| 32 | + runs-on: ubuntu-latest |
| 33 | + needs: define-matrix |
| 34 | + strategy: |
| 35 | + matrix: |
| 36 | + python-version: ${{ fromJson(needs.define-matrix.outputs.python_versions_output) }} |
| 37 | + steps: |
| 38 | + - name: Checkout |
| 39 | + uses: actions/checkout@v4 |
| 40 | + - name: Set up Python ${{ matrix.python-version }} |
| 41 | + uses: actions/setup-python@v5 |
| 42 | + with: |
| 43 | + python-version: ${{ matrix.python-version }} |
| 44 | + cache: 'pip' |
| 45 | + cache-dependency-path: 'tests/requirements/py3.txt' |
| 46 | + - name: Install libmemcached-dev for pylibmc |
| 47 | + run: sudo apt-get install libmemcached-dev |
| 48 | + - name: Install and upgrade packaging tools |
| 49 | + run: python -m pip install --upgrade pip setuptools wheel |
| 50 | + - run: python -m pip install -r tests/requirements/py3.txt -e . |
| 51 | + - name: Run tests |
| 52 | + run: python tests/runtests.py -v2 |
0 commit comments