Merge pull request #62 from SnoopJ/feature/Unicode-15.1 #29
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build + Deploy | |
on: | |
push: | |
branches: [master] | |
tags: ["*"] | |
pull_request: | |
branches: [master] | |
env: | |
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 | |
CIBW_MANYLINUX_I686_IMAGE: manylinux2014 | |
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: manylinux2014 | |
CIBW_TEST_EXTRAS: testing | |
CIBW_TEST_COMMAND: pytest {project}/tests | |
jobs: | |
build_wheels: | |
runs-on: ${{ matrix.os }} | |
env: | |
CIBW_ARCHS: ${{ matrix.arch }} | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
arch: [auto64] | |
include: | |
- os: macos-latest | |
arch: universal2 | |
- os: windows-latest | |
arch: x86 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Set up Python 3.x | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.x" | |
- name: Install dependencies | |
run: pip install cibuildwheel | |
- name: Build and Test Wheels | |
run: python -m cibuildwheel --output-dir wheelhouse | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: unicodedata2-${{ matrix.os }}-${{ matrix.arch }} | |
path: wheelhouse/*.whl | |
build_aarch64_wheels: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# aarch64 uses qemu so it's slow, build each py version in parallel jobs | |
python: [37, 38, 39, 310] | |
arch: [aarch64] | |
env: | |
CIBW_BUILD: cp${{ matrix.python }}-* | |
CIBW_ARCHS: ${{ matrix.arch }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- uses: docker/setup-qemu-action@v1.2.0 | |
with: | |
platforms: all | |
- name: Install dependencies | |
run: pip install cibuildwheel | |
- name: Build and Test Wheels | |
run: python -m cibuildwheel --output-dir wheelhouse | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: unicodedata2-${{ matrix.python }}-linux-${{ matrix.arch }} | |
path: wheelhouse/*.whl | |
deploy: | |
# only run if the commit is tagged... | |
if: github.ref_type == 'tag' | |
# ... and all build jobs completed successfully | |
needs: [build_wheels, build_aarch64_wheels] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.x" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install --upgrade setuptools wheel twine | |
- name: Download artifacts from build jobs | |
uses: actions/download-artifact@v2 | |
with: | |
path: wheelhouse/ | |
- name: Move wheels to dist/ directory | |
run: | | |
ls wheelhouse/* | |
mkdir -p dist/ | |
for wheel_dir in wheelhouse/unicodedata2*/; do | |
mv "${wheel_dir}"/*.whl dist/ | |
done | |
- name: Extract release notes from annotated tag message | |
id: release_notes | |
run: | | |
# GH checkout action doesn't preserve tag annotations, we must fetch them | |
# https://github.com/actions/checkout/issues/290 | |
git fetch --tags --force | |
# strip leading 'refs/tags/' to get the tag name | |
TAG_NAME="${GITHUB_REF##*/}" | |
# Dump tag message to temporary .md file (excluding the PGP signature at the bottom) | |
TAG_MESSAGE=$(git tag -l --format='%(contents)' $TAG_NAME | sed -n '/-----BEGIN PGP SIGNATURE-----/q;p') | |
echo "$TAG_MESSAGE" > "${{ runner.temp }}/release_notes.md" | |
- name: Create GitHub release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
# This token is provided by Actions, you do not need to create your own token | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} | |
body_path: "${{ runner.temp }}/release_notes.md" | |
draft: false | |
prerelease: false | |
- name: Build and publish | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
python setup.py sdist | |
twine upload dist/* | |