Skip to content

Merge pull request #97 from exarkun/96.decoder-crash #195

Merge pull request #97 from exarkun/96.decoder-crash

Merge pull request #97 from exarkun/96.decoder-crash #195

Workflow file for this run

# Build sdist+wheel packages using GitHub Actions. Mostly adopted
# from https://cibuildwheel.readthedocs.io/en/stable/setup/
name: "Packages"
on:
push:
branches:
# Do build on pushes to master.
- "master"
tags:
# Do build on pushes to any release tag See
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
# for documentation about how patterns are matched.
- "zfec-*"
# Do build on pushes to any branch with an open pull request.
pull_request:
# Do build on different release events
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release
release:
types: [published, created, edited]
jobs:
build_wheels:
name: "${{ matrix.wheel-selector }} wheel on ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
# NOTE: when updating the matrix below, be sure to keep OS and
# Python versions in sync with the ones in test.yml.
matrix:
os:
- "macos-11"
- "ubuntu-22.04"
- "windows-2022"
wheel-selector:
- "cp37-*"
- "cp38-*"
- "cp39-*"
- "cp310-*"
- "cp311-*"
- "pp37-*"
- "pp38-*"
- "pp39-*"
steps:
- name: Check out zfec sources
uses: actions/checkout@v3
with:
# Check out the full history, including tags. This is necessary to
# construct non-release version numbers.
fetch-depth: 0
- name: Build wheels
uses: pypa/[email protected]
with:
output-dir: wheelhouse
env:
# Configure cibuildwheel to build just some of the total wheels we
# could build for this architecture. This yields better parallelism
# on GitHub Actions execution.
CIBW_BUILD: "${{ matrix.wheel-selector }}"
# Just make sure that Python can use zfec package.
CIBW_TEST_COMMAND: python -c "import zfec; print(zfec.__version__)"
- uses: actions/upload-artifact@v3
name: Upload artifacts
with:
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: Check out zfec sources
with:
# Check out the full history, including tags. This is necessary to
# construct non-release version numbers.
fetch-depth: 0
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.11'
- name: Build sdist
run: |
python3 setup.py sdist
- uses: actions/upload-artifact@v3
name: Upload artifacts
with:
path: dist/*.tar.gz
upload_pypi:
needs:
- "build_wheels"
- "build_sdist"
# It only needs to run once. It will fetch all of the other build
# artifacts created by the other jobs and then upload them.
runs-on: "ubuntu-latest"
# Select the GitHub Actions environment that contains the PyPI tokens
# necessary to perform uploads. This was configured manually using the
# GitHub web interface.
environment: "release"
steps:
# Download all artifacts previously built by this workflow to the dist
# directory where the publish step can find them. These are the sdist
# and all of the wheels build by the other jobs.
- uses: "actions/download-artifact@v3"
with:
name: "artifact"
path: "dist"
# Define a conditional step to upload packages to the testing instance
# of PyPI.
#
# The overall workflow is already restricted so that it runs for:
# 1) pushes to master
# 2) pushes to release tags
# 3) pushes to branches with associated PRs
#
# The conditional in this step should cause it to run only for case (3).
- name: "Publish to TEST PyPI"
uses: "pypa/[email protected]"
if: >-
github.event_name == 'pull_request'
with:
# Authenticate using a token from a PyPI account with upload
# permission to the project. See https://pypi.org/help/#apitoken
user: "__token__"
# Read it from a GitHub Actions "environment" secret. See
# https://docs.github.com/en/actions/security-guides/encrypted-secrets
password: "${{ secrets.testpypi_token }}"
# Override the default in order to upload it to the testing
# deployment.
repository_url: "https://test.pypi.org/legacy/"
# Now define a conditional step to upload packages to the production
# instance of PyPI.
#
# The cases to consider are the same as for the upload to the testing
# instance. This time, we have a conditional that runs only for case
# (2).
- name: "Publish to LIVE PyPI"
uses: "pypa/[email protected]"
if: >-
github.event_name == 'push' &&
startsWith(github.event.ref, 'refs/tags/zfec-')
with:
user: "__token__"
password: "${{ secrets.pypi_token }}"