Skip to content

Merge pull request #746 from daara-s/fix-empty-usefixtures #1410

Merge pull request #746 from daara-s/fix-empty-usefixtures

Merge pull request #746 from daara-s/fix-empty-usefixtures #1410

Workflow file for this run

name: Main testing workflow
on:
push:
pull_request:
workflow_dispatch:
jobs:
build:
name: Build package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
cache: "pip"
- name: Install pypa/build
run: >-
python3 -m pip install --user
build
twine
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Check the distribution files with `twine`
run: twine check --strict dist/*
- name: Upload artifact
id: artifact-upload-step
uses: actions/upload-artifact@v4
with:
name: dist-files
path: dist/*
if-no-files-found: error
compression-level: 0 # They are already compressed
test-run:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
include:
- python-version: "3.9"
toxfactor: py3.9
ignore-typecheck-outcome: false
ignore-test-outcome: false
- python-version: "3.10"
toxfactor: py3.10
ignore-typecheck-outcome: false
ignore-test-outcome: false
- python-version: "3.11"
toxfactor: py3.11
ignore-typecheck-outcome: false
ignore-test-outcome: false
- python-version: "3.12"
toxfactor: py3.12
ignore-typecheck-outcome: false
ignore-test-outcome: false
- python-version: "3.13"
toxfactor: py3.13
ignore-typecheck-outcome: false
ignore-test-outcome: false
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
id: setup-python
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
run: |
python -m pip install poetry==1.8.3
- name: Configure poetry
run: |
python -m poetry config virtualenvs.in-project true
- name: Cache the virtualenv
id: poetry-dependencies-cache
uses: actions/cache@v3
with:
path: ./.venv
key: ${{ runner.os }}-venv-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dev dependencies
if: steps.poetry-dependencies-cache.outputs.cache-hit != 'true'
run: |
python -m poetry install --only=dev
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: dist-files
path: dist/
- name: Type checking
# Ignore errors for older pythons
continue-on-error: ${{ matrix.ignore-typecheck-outcome }}
run: |
source .venv/bin/activate
tox -e mypy
- name: Test with tox
continue-on-error: ${{ matrix.ignore-test-outcome }}
run: |
source .venv/bin/activate
coverage erase
# Using `installpkg dist/*.tar.gz` because we want to install the pre-built package (want to test against that)
tox run-parallel -f ${{ matrix.toxfactor }} --parallel-no-spinner --parallel-live --installpkg dist/*.whl
coverage combine
coverage xml
- uses: codecov/codecov-action@v4
with:
# Explicitly using the token to avoid Codecov rate limit errors
# See https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
verbose: true # optional (default = false)
pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pytest-bdd
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs:
- "test-run"
- "build"
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: dist-files
path: dist/
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1