Release Workflows #32
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python Testing Workflow | |
# | |
# - Automatically runs tests on all supported versions of Python | |
name: Python - Testing | |
on: | |
pull_request: | |
workflow_call: | |
inputs: | |
versions: | |
description: 'Python versions to test against' | |
type: string | |
# All Major versions of Python that are currently supported | |
default: '3.9,3.10,3.11,3.12' | |
jobs: | |
python-versions: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Set matrix | |
id: set-matrix | |
run: | | |
versions="${{ inputs.versions }}" | |
echo "Version Input :: $versions" | |
matrix=$(echo "$versions" | tr "," "\n" | awk '{print "\""$1"\""}' | paste -sd "," -) | |
echo "matrix :: [$matrix]" | |
echo "matrix=[$matrix]" >> "$GITHUB_OUTPUT" | |
python-testing: | |
# This workflow runs on the latest version of Ubuntu | |
runs-on: ubuntu-latest | |
if: ${{ needs.python-versions.outputs.matrix != '[]' }} | |
needs: [ python-versions ] | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ${{ fromJSON(needs.python-versions.outputs.matrix) }} | |
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 dependencies | |
run: | | |
set -e | |
echo "Installing dependencies..." | |
if [[ -f pyproject.toml ]]; then | |
python -m pip install --upgrade pip poetry | |
poetry install | |
elif [[ -f Pipfile ]]; then | |
python -m pip install --upgrade pip pipenv | |
pipenv sync -d | |
elif [[ -f requirements.txt ]]; then | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
elif [[ -f Makefile ]]; then | |
make install | |
else | |
echo "No manifest files found to install dependencies" | |
fi | |
- name: Run tests | |
run: | | |
set -e | |
echo "Running Python tests..." | |
if [[ -f pyproject.toml ]]; then | |
echo "Running poetry run test" | |
poetry run test | |
elif [[ -f Pipfile ]]; then | |
echo "Running pipenv run test" | |
pipenv run test | |
elif [[ -f Makefile ]]; then | |
echo "Running make test" | |
make test | |
else | |
echo "Unknown test runner..." | |
echo "Please contact the oss-maintainers team for help." | |
fi |