Ensure that we check out full package in action #21
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_and_test | |
on: | |
push: | |
branches: | |
- main | |
- master | |
tags: | |
- "*" | |
pull_request: | |
jobs: | |
build_and_test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
cache-dependency-path: "setup.cfg" | |
- name: Update pip/wheel infrastructure | |
run: | | |
python -m pip install --upgrade pip | |
pip install wheel | |
- name: Install pytest packages | |
run: pip install pytest | |
- name: List installed packages | |
run: pip list -v | |
- name: Build and install | |
run: pip install -v -e . | |
- name: Run tests | |
run: | | |
pytest test_pal.py | |
pypi_sdist_build: | |
runs-on: ubuntu-latest | |
needs: [build_and_test] | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
# Full git history. | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
pip install --upgrade setuptools wheel build | |
- name: Build and create distribution | |
run: | | |
python -m build --sdist | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: dist/* | |
pypi_wheel_build: | |
strategy: | |
matrix: | |
os: ["ubuntu-latest", "macos-11"] | |
runs-on: ${{ matrix.os }} | |
needs: [build_and_test] | |
if: startsWith(github.ref, 'refs/tags/') | |
env: | |
CIBW_BUILD: "cp3{8,9,10,11}-{manylinux_x86_64,manylinux_aarch64,macosx_arm64,macosx_x86_64}" | |
CIBW_ARCHS_MACOS: "x86_64 arm64" | |
# use line below to enable aarch64 builds | |
# CIBW_ARCHS_LINUX: "auto aarch64" | |
CIBW_ARCHS_LINUX: "auto" | |
steps: | |
# uncomment when building aarch64 | |
# - name: Set up QEMU | |
# uses: docker/setup-qemu-action@v2 | |
# if: runner.os == 'Linux' | |
# with: | |
# platforms: arm64 | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
pip install --upgrade setuptools wheel cibuildwheel | |
- name: Build and create distribution | |
run: | | |
python -m cibuildwheel --output-dir dist | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: dist/* | |
pypi-publish: | |
name: Upload release to PyPI | |
needs: [pypi_sdist_build, pypi_wheel_build] | |
runs-on: ubuntu-latest | |
environment: release | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: dist | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |