Skip to content

Add envs and groups to deploy #189

Add envs and groups to deploy

Add envs and groups to deploy #189

Workflow file for this run

name: Build and publish pre release
concurrency: staging
on:
push:
branches:
- master
- release/**
tags-ignore:
- v**
permissions:
contents: read
jobs:
test:
name: Test
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-latest
- macos-latest
- windows-latest
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v4
- 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 -r requirements/base.txt -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 on ${{ matrix.platform }}
needs: [coverage]
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-latest
python-version: ["3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v4
- 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 -r requirements/build.txt
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
build-mypyc:
name: Build using Mypyc source on ${{ matrix.platform }}
continue-on-error: true
needs: [coverage]
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-latest
python-version: ["3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Compiles Python modules to C extensions with Mypyc
env:
MYPYC_ENABLE: 1
run: |
set -e
sudo apt install python3-dev
python -m pip install -r requirements/base.txt -r requirements/cbuild.txt
python setup.py bdist_wheel --dist-dir mypyc-dist-${{ matrix.platform }}-${{ matrix.python-version }}
- name: Tar build and wheel distributions files
run: |
tar -cvf mypyc-dist-${{ matrix.platform }}-${{ matrix.python-version }}.tar mypyc-dist-${{ matrix.platform }}-${{ matrix.python-version }}
- name: Upload build and wheel distributions files
uses: actions/upload-artifact@v4
with:
name: pre-release-cbuild-${{ matrix.platform }}-${{ matrix.python-version }}
path: |
mypyc-dist-${{ matrix.platform }}-${{ matrix.python-version }}.tar
build-wheels:
name: Build wheels on ${{ matrix.platform }}
needs: [coverage]
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-latest
- macos-13 # intel
- macos-latest # apple silicon
- windows-latest
python-version: ["3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Prepare build
run: |
python -m pip install tomlkit
python bin/cibw-before-build.py
- name: Build wheels
uses: pypa/[email protected]
with:
package-dir: .
output-dir: wheelhouse
- uses: actions/upload-artifact@v4
with:
name: pre-release-cibw-wheels-${{ matrix.platform }}-${{ matrix.python-version }}
path: ./wheelhouse/*.whl
publish-testpypi:
name: Publish to TestPyPI
needs: [build, build-wheels]
runs-on: ${{ matrix.platform }}
environment: staging
permissions:
contents: write
id-token: write
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-latest
python-version: ["3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v4
- 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: Download cibw wheels distributions files
uses: actions/download-artifact@v4
with:
path: pre-release-cibw-wheels
pattern: pre-release-cibw-wheels-*
merge-multiple: true
- name: Build source and wheel distributions to version ${{ github.ref_name }}
run: |
python -m pip install -r requirements/build.txt twine
tar -xvf dist-${{ matrix.platform }}-${{ matrix.python-version }}.tar
mv pre-release-cibw-wheels/* dist-${{ matrix.platform }}-${{ matrix.python-version }}/
twine check --strict dist-${{ matrix.platform }}-${{ matrix.python-version }}/*
- name: Publish distribution to TestPyPI
continue-on-error: true
uses: pypa/[email protected]
with:
repository-url: https://test.pypi.org/legacy/
packages-dir: dist-${{ matrix.platform }}-${{ matrix.python-version }}/
skip-existing: true