Skip to content

Bump GH Actions

Bump GH Actions #151

Workflow file for this run

name: pygohcl python package
on:
push:
tags:
- v*
pull_request:
branches:
- master
jobs:
tests:
name: tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: dev-requirements.txt
check-latest: true
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.22.7"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r dev-requirements.txt
- name: Install package
run: |
pip install -e .
- name: Test with pytest for Python ${{ matrix.python-version }}
run: |
pytest --doctest-modules -o junit_family=xunit2 --junitxml=junit/test-results-${{ matrix.python-version }}.xml
- name: Upload pytest test results
uses: actions/upload-artifact@v4
with:
name: pytest-results-${{ matrix.python-version }}
path: junit/test-results-${{ matrix.python-version }}.xml
if: ${{ always() }}
build-wheels:
name: Build wheel for ${{ matrix.python }}-${{ matrix.buildplat[1] }}-${{ matrix.buildplat[2] }}
needs: [tests]
runs-on: ${{ matrix.buildplat[0] }}
strategy:
fail-fast: false
matrix:
buildplat:
- [ubuntu-latest, manylinux, "x86_64 aarch64"]
- [macos-13, macosx, x86_64]
- [macos-14, macosx, arm64]
python: ["cp38", "cp39", "cp310", "cp311", "cp312"]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Build wheels on linux
if: ${{ matrix.buildplat[1] == 'manylinux' }}
uses: pypa/[email protected]
env:
CIBW_ENVIRONMENT: PATH=$(pwd)/go/bin:$PATH
CIBW_BEFORE_BUILD: sh pre-build-command.sh
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}*
CIBW_SKIP: "pp* *-musllinux*"
CIBW_ARCHS_LINUX: ${{ matrix.buildplat[2] }}
- name: Build wheels on macos
if: ${{ matrix.buildplat[1] == 'macosx' }}
uses: pypa/[email protected]
env:
CIBW_ENVIRONMENT: PATH=$(pwd)/go/bin:$PATH
CIBW_BEFORE_BUILD: sh pre-build-command.sh
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}*
CIBW_SKIP: "pp* *-musllinux*"
CIBW_ARCHS_MACOS: ${{ matrix.buildplat[2] }}
- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.python }}-${{ matrix.buildplat[1] }}-${{ matrix.buildplat[2] }}
path: ./wheelhouse/*.whl
upload:
name: upload
if: startsWith(github.ref, 'refs/tags/')
needs: [build-wheels]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
path: dist
- name: Display structure of downloaded files
run: ls -lh dist
- uses: pypa/gh-action-pypi-publish@release/v1
if: startsWith(github.ref, 'refs/tags/')
with:
skip-existing: true
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_PASSWORD }}