tests #61
This file contains hidden or 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
name: tests | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
inputs: | |
operating_systems: | |
description: 'Operating systems to test on' | |
type: choice | |
default: 'all' | |
options: | |
- all | |
- ubuntu-latest | |
- windows-latest | |
- macos-latest | |
jobs: | |
# Generate matrix based on input | |
setup-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Set matrix | |
id: set-matrix | |
run: | | |
if [[ "${{ inputs.operating_systems }}" == "all" || "${{ github.event_name }}" == "push" ]]; then | |
echo 'matrix=["ubuntu-latest", "windows-latest", "macos-latest"]' >> $GITHUB_OUTPUT | |
else | |
echo 'matrix=["${{ inputs.operating_systems }}"]' >> $GITHUB_OUTPUT | |
fi | |
# Run tests using matrix strategy | |
tests: | |
needs: setup-matrix | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: ${{ fromJSON(needs.setup-matrix.outputs.matrix) }} | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Install python and dependencies | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.13' | |
cache: 'pip' | |
- name: Install requirements (Windows) | |
if: runner.os == 'Windows' | |
run: python -m pip install -r requirements.txt | |
- name: Install requirements (Unix) | |
if: runner.os != 'Windows' | |
run: pip install -r requirements.txt | |
- name: Run tests | |
run: pytest | |
- name: List the environment variables | |
run: env |