--- name: Test code env: CI_FORCE_COLORS_PYTEST: --color yes on: # yamllint disable-line rule:truthy workflow_dispatch: push: tags: - "!*" branches: - main - "test-me-*" pull_request: branches: - "**" jobs: build: name: Tests on ${{ matrix.os }} with python ${{ matrix.python-version }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: ["ubuntu-latest", "windows-latest", "macos-latest"] python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v3 - name: Fetch origin/main #: https://github.com/Bachmann1234/diff_cover#troubleshooting run: git fetch --no-tags origin main:refs/remotes/origin/main - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Display Python version run: python --version - name: Upgrade pip run: python -m pip install --upgrade pip - name: Install pipx run: python -m pip install --upgrade pipx - name: Install tox via pipx run: pipx install tox - name: Run tests via tox (linux/macos) if: runner.os != 'Windows' run: | major=$(python -c "import sys;print(sys.version_info[0])") minor=$(python -c "import sys;print(sys.version_info[1])") tox -m py${major}.${minor} - name: Run tests via tox (windows) if: runner.os == 'Windows' run: | $major = python -c "import sys;print(sys.version_info[0])" $minor = python -c "import sys;print(sys.version_info[1])" tox -m py${major}.${minor}