Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 51 additions & 66 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: Main testing workflow

on:
push:
pull_request:
workflow_dispatch:

jobs:
build:
name: Build package
Expand All @@ -17,9 +15,7 @@ jobs:
cache: "pip"
- name: Install pypa/build
run: >-
python3 -m pip install --user
build
twine
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`
Expand Down Expand Up @@ -58,76 +54,65 @@ jobs:
toxfactor: py3.13
ignore-typecheck-outcome: true
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==2.0.0

- 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 `--parallel 4` as it's the number of CPUs in the GitHub Actions runner
# Using `installpkg dist/*.whl` because we want to install the pre-built package (want to test against that)
tox run-parallel -f ${{ matrix.toxfactor }} --parallel 4 --parallel-no-spinner --parallel-live --installpkg dist/*.whl
coverage combine
coverage xml

- uses: codecov/codecov-action@v4
with:
- 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==2.0.0
- 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 `--parallel 4` as it's the number of CPUs in the GitHub Actions runner
# Using `installpkg dist/*.whl` because we want to install the pre-built package (want to test against that)
tox run-parallel -f ${{ matrix.toxfactor }} --parallel 4 --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)

# 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-factoryboy
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs:
- "test-run"
Expand Down
40 changes: 22 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/psf/black
rev: 8a737e727ac5ab2f1d4cf5876720ed276dc8dc4b # frozen: 25.1.0
- repo: https://github.com/psf/black
rev: 8a737e727ac5ab2f1d4cf5876720ed276dc8dc4b # frozen: 25.1.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: c8ab4a5b21bac924d106e3103dd7c979fdd0f9bc # frozen: 6.0.1
- id: black
- repo: https://github.com/pycqa/isort
rev: c8ab4a5b21bac924d106e3103dd7c979fdd0f9bc # frozen: 6.0.1
hooks:
- id: isort
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0
- id: isort
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/asottile/pyupgrade
rev: 37bfa06d791fd38fb4e54910b36a2ff57641b074 # frozen: v3.20.0
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/google/yamlfmt
rev: a69a26f0e2a6d5768f3496239ba1e41c6bb74b6e # frozen: v0.17.2
hooks:
- id: pyupgrade
- id: yamlfmt
- repo: https://github.com/asottile/pyupgrade
rev: 37bfa06d791fd38fb4e54910b36a2ff57641b074 # frozen: v3.20.0
hooks:
- id: pyupgrade
args: [--py39-plus]
- repo: https://github.com/python-poetry/poetry
rev: "84eeadc21f92a04d46ea769e3e39d7c902e44136" # frozen: 2.1.3
- repo: https://github.com/python-poetry/poetry
rev: "84eeadc21f92a04d46ea769e3e39d7c902e44136" # frozen: 2.1.3
hooks:
- id: poetry-check
- id: poetry-check
args: ["--lock"]
6 changes: 1 addition & 5 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

version: 2

build:
os: ubuntu-22.04
tools:
python: "3"

sphinx:
configuration: docs/conf.py
configuration: docs/conf.py
formats:
- epub
- pdf
- htmlzip

python:
install:
- method: pip
Expand Down
Loading