Skip to content

Version 3.0.0 (#434) #83

Version 3.0.0 (#434)

Version 3.0.0 (#434) #83

Workflow file for this run

name: Build and publish pre release
on:
push:
branches:
- master
- release/**
tags-ignore:
- v**
permissions:
contents: read
jobs:
run-tox:
name: Tox | Test, Style, Lint, Typing, Pytype, Security and Docs
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-latest
python-version: ["3.11", "3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip tox
- name: Run tox
if: ${{ matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.12' }}
run: |
tox -e py,py-async,style,typing,security,docs
- name: Run tox (Pytype)
if: ${{ matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.11' }}
run: |
tox -e pytype
test:
name: Test
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-latest
- macos-latest
- windows-latest
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'requirements/*.txt'
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements/base.txt
pip install -r requirements/tests.txt
- name: Test and and run coverage with PyTest
run: |
py.test
- name: Upload coverage JUint report
if: ${{ matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.12' }}
uses: actions/upload-artifact@v4
with:
name: test-n-coverage-report
path: |
.coverage
coverage.lcov
junit/
htmlcov/
coverage:
name: Coverage
needs: test
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-latest
python-version: ["3.12"]
steps:
- name: Download a coverage artifact
uses: actions/download-artifact@v4
with:
name: test-n-coverage-report
- name: Send coverage stats to Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
format: lcov
file: coverage.lcov
allow-empty: true
build:
name: Build source
needs: [run-tox, coverage]
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-latest
- macos-latest
- windows-latest
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Build source and wheel distributions
run: |
python -m pip install build
python -m build --outdir dist-${{ matrix.platform }}-${{ matrix.python-version }}
- name: Tar build and wheel distributions files
run: |
tar -cvf dist-${{ matrix.platform }}-${{ matrix.python-version }}.tar dist-${{ matrix.platform }}-${{ matrix.python-version }}
- name: Upload build and wheel distributions files
uses: actions/upload-artifact@v4
with:
name: pre-release-build-${{ matrix.platform }}-${{ matrix.python-version }}
path: dist-${{ matrix.platform }}-${{ matrix.python-version }}.tar
publish-testpypi:
name: Publish to TestPyPI
needs: build
runs-on: ${{ matrix.platform }}
permissions:
contents: write
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-latest
python-version: ["3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Download build and wheel distributions files
uses: actions/download-artifact@v4
with:
name: pre-release-build-${{ matrix.platform }}-${{ matrix.python-version }}
- name: Build source and wheel distributions to version ${{ github.ref_name }}
run: |
python -m pip install twine
tar -xvf dist-${{ matrix.platform }}-${{ matrix.python-version }}.tar
twine check --strict dist-${{ matrix.platform }}-${{ matrix.python-version }}/*
- name: Publish distribution to TestPyPI
uses: pypa/gh-action-pypi-publish@v1.8.11
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
packages-dir: dist-${{ matrix.platform }}-${{ matrix.python-version }}/
skip-existing: true