| 1 |
name: build |
| 2 |
on: |
| 3 |
push: |
| 4 |
branches: ["dev", "*.x-line"] |
| 5 |
tags: ["*"] |
| 6 |
pull_request: |
| 7 |
# Run builds nightly to catch incompatibilities with new marshmallow releases |
| 8 |
schedule: |
| 9 |
- cron: "0 0 * * *" |
| 10 |
jobs: |
| 11 |
tests: |
| 12 |
name: ${{ matrix.name }} |
| 13 |
runs-on: ubuntu-latest |
| 14 |
strategy: |
| 15 |
fail-fast: false |
| 16 |
matrix: |
| 17 |
include: |
| 18 |
- { name: "3.10-ma3", python: "3.10", tox: py310-marshmallow3 } |
| 19 |
- { name: "3.14-ma3", python: "3.14", tox: py314-marshmallow3 } |
| 20 |
- { name: "3.10-ma4", python: "3.10", tox: py310-marshmallow4 } |
| 21 |
- { name: "3.14-ma4", python: "3.14", tox: py314-marshmallow4 } |
| 22 |
- { name: "lowest", python: "3.10", tox: py310-lowest } |
| 23 |
- { name: "3.14-madev", python: "3.14", tox: py314-marshmallowdev } |
| 24 |
steps: |
| 25 |
- uses: actions/[email protected] |
| 26 |
- uses: actions/setup-python@v6 |
| 27 |
with: |
| 28 |
python-version: ${{ matrix.python }} |
| 29 |
- run: pip install tox |
| 30 |
- run: tox -e${{ matrix.tox }} |
| 31 |
build: |
| 32 |
name: Build package |
| 33 |
runs-on: ubuntu-latest |
| 34 |
steps: |
| 35 |
- uses: actions/[email protected] |
| 36 |
- uses: actions/setup-python@v6 |
| 37 |
with: |
| 38 |
python-version: "3.14" |
| 39 |
- name: Install pypa/build |
| 40 |
run: python -m pip install build |
| 41 |
- name: Build a binary wheel and a source tarball |
| 42 |
run: python -m build |
| 43 |
- name: Install twine |
| 44 |
run: python -m pip install twine |
| 45 |
- name: Check build |
| 46 |
run: python -m twine check --strict dist/* |
| 47 |
- name: Store the distribution packages |
| 48 |
uses: actions/upload-artifact@v7 |
| 49 |
with: |
| 50 |
name: python-package-distributions |
| 51 |
path: dist/ |
| 52 |
# this duplicates pre-commit.ci, so only run it on tags |
| 53 |
# it guarantees that linting is passing prior to a release |
| 54 |
lint-pre-release: |
| 55 |
if: startsWith(github.ref, 'refs/tags') |
| 56 |
runs-on: ubuntu-latest |
| 57 |
steps: |
| 58 |
- uses: actions/[email protected] |
| 59 |
- uses: actions/setup-python@v6 |
| 60 |
with: |
| 61 |
python-version: "3.14" |
| 62 |
- run: python -m pip install tox |
| 63 |
- run: python -m tox -e lint |
| 64 |
publish-to-pypi: |
| 65 |
name: PyPI release |
| 66 |
if: startsWith(github.ref, 'refs/tags/') |
| 67 |
needs: [build, tests, lint-pre-release] |
| 68 |
runs-on: ubuntu-latest |
| 69 |
environment: |
| 70 |
name: pypi |
| 71 |
url: https://pypi.org/p/apispec |
| 72 |
permissions: |
| 73 |
id-token: write |
| 74 |
steps: |
| 75 |
- name: Download all the dists |
| 76 |
uses: actions/download-artifact@v8 |
| 77 |
with: |
| 78 |
name: python-package-distributions |
| 79 |
path: dist/ |
| 80 |
- name: Publish distribution to PyPI |
| 81 |
uses: pypa/gh-action-pypi-publish@release/v1 |