Skip to content

Commit

Permalink
split workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinjqliu committed Feb 2, 2025
1 parent fa78256 commit b013176
Show file tree
Hide file tree
Showing 3 changed files with 174 additions and 140 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/pypi-build-artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: "Build PyPI Artifacts"

on:
workflow_call:
inputs:
VERSION:
required: true
type: string
RC:
required: true
type: number

jobs:
pypi-build-artifacts:
name: Build artifacts for PyPi on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-22.04, windows-2022, macos-13, macos-14, macos-15 ]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1

- uses: actions/setup-python@v5
with:
python-version: |
3.9
3.10
3.11
3.12
- name: Install poetry
run: make install-poetry

- name: Set version with RC
env:
VERSION: ${{ inputs.VERSION }}
RC: ${{ inputs.RC }}
run: python -m poetry version "${{ env.VERSION }}rc${{ env.RC }}" # e.g., 0.8.0rc1

# Publish the source distribution with the version that's in
# the repository, otherwise the tests will fail
- name: Compile source distribution
run: python3 -m poetry build --format=sdist
if: startsWith(matrix.os, 'ubuntu')

- name: Build wheels
uses: pypa/[email protected]
with:
output-dir: wheelhouse
config-file: "pyproject.toml"
env:
# Ignore 32 bit architectures
CIBW_ARCHS: "auto64"
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9,<3.13"
CIBW_TEST_REQUIRES: "pytest==7.4.2 moto==5.0.1"
CIBW_TEST_EXTRAS: "s3fs,glue"
CIBW_TEST_COMMAND: "pytest {project}/tests/avro/test_decoder.py"
# There is an upstream issue with installing on MacOSX
# https://github.com/pypa/cibuildwheel/issues/1603
# Ignore tests for pypy since not all dependencies are compiled for it
# and would require a local rust build chain
CIBW_TEST_SKIP: "pp* *macosx*"

- name: Add source distribution
if: startsWith(matrix.os, 'ubuntu')
run: ls -lah dist/* && cp dist/* wheelhouse/

- uses: actions/upload-artifact@v4
with:
name: "pypi-release-candidate-${{ matrix.os }}"
path: ./wheelhouse/*

pypi-merge-artifacts:
runs-on: ubuntu-latest
needs:
- pypi-build-artifacts
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: "pypi-release-candidate-${{ inputs.VERSION }}rc${{ inputs.RC }}"
pattern: pypi-release-candidate*
delete-merged: true
148 changes: 8 additions & 140 deletions .github/workflows/python-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,152 +116,20 @@ jobs:
# SVN
svn-build-artifacts:
name: Build artifacts for SVN on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs:
- validate-inputs
- validate-library-version
strategy:
matrix:
os: [ ubuntu-22.04, windows-2022, macos-13, macos-14, macos-15 ]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1

- uses: actions/setup-python@v5
with:
python-version: |
3.9
3.10
3.11
3.12
- name: Install poetry
run: make install-poetry

# Publish the source distribution with the version that's in
# the repository, otherwise the tests will fail
- name: Compile source distribution
run: python3 -m poetry build --format=sdist
if: startsWith(matrix.os, 'ubuntu')

- name: Build wheels
uses: pypa/[email protected]
with:
output-dir: wheelhouse
config-file: "pyproject.toml"
env:
# Ignore 32 bit architectures
CIBW_ARCHS: "auto64"
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9,<3.13"
CIBW_TEST_REQUIRES: "pytest==7.4.2 moto==5.0.1"
CIBW_TEST_EXTRAS: "s3fs,glue"
CIBW_TEST_COMMAND: "pytest {project}/tests/avro/test_decoder.py"
# There is an upstream issue with installing on MacOSX
# https://github.com/pypa/cibuildwheel/issues/1603
# Ignore tests for pypy since not all dependencies are compiled for it
# and would require a local rust build chain
CIBW_TEST_SKIP: "pp* *macosx*"

- name: Add source distribution
if: startsWith(matrix.os, 'ubuntu')
run: ls -lah dist/* && cp dist/* wheelhouse/

- uses: actions/upload-artifact@v4
with:
name: "svn-release-candidate-${{ matrix.os }}"
path: ./wheelhouse/*

svn-merge-artifacts:
runs-on: ubuntu-latest
needs:
- validate-inputs
- svn-build-artifacts
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: "svn-release-candidate-${{ needs.validate-inputs.outputs.VERSION }}rc${{ needs.validate-inputs.outputs.RC }}"
pattern: svn-release-candidate*
delete-merged: true
uses: ./.github/workflows/svn-build-artifacts.yml
with:
version: ${{ needs.validate-inputs.outputs.VERSION }}
rc: ${{ needs.validate-inputs.outputs.RC }}

# PyPi
pypi-build-artifacts:
name: Build artifacts for PyPi on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs:
- validate-inputs
- validate-library-version
strategy:
matrix:
os: [ ubuntu-22.04, windows-2022, macos-13, macos-14, macos-15 ]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1

- uses: actions/setup-python@v5
with:
python-version: |
3.9
3.10
3.11
3.12
- name: Install poetry
run: make install-poetry

- name: Set version with RC
env:
VERSION: ${{ needs.validate-inputs.outputs.VERSION }}
RC: ${{ needs.validate-inputs.outputs.RC }}
run: python -m poetry version "${{ env.VERSION }}rc${{ env.RC }}" # e.g., 0.8.0rc1

# Publish the source distribution with the version that's in
# the repository, otherwise the tests will fail
- name: Compile source distribution
run: python3 -m poetry build --format=sdist
if: startsWith(matrix.os, 'ubuntu')

- name: Build wheels
uses: pypa/[email protected]
with:
output-dir: wheelhouse
config-file: "pyproject.toml"
env:
# Ignore 32 bit architectures
CIBW_ARCHS: "auto64"
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9,<3.13"
CIBW_TEST_REQUIRES: "pytest==7.4.2 moto==5.0.1"
CIBW_TEST_EXTRAS: "s3fs,glue"
CIBW_TEST_COMMAND: "pytest {project}/tests/avro/test_decoder.py"
# There is an upstream issue with installing on MacOSX
# https://github.com/pypa/cibuildwheel/issues/1603
# Ignore tests for pypy since not all dependencies are compiled for it
# and would require a local rust build chain
CIBW_TEST_SKIP: "pp* *macosx*"

- name: Add source distribution
if: startsWith(matrix.os, 'ubuntu')
run: ls -lah dist/* && cp dist/* wheelhouse/

- uses: actions/upload-artifact@v4
with:
name: "pypi-release-candidate-${{ matrix.os }}"
path: ./wheelhouse/*

pypi-merge-artifacts:
runs-on: ubuntu-latest
needs:
- validate-inputs
- pypi-build-artifacts
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: "pypi-release-candidate-${{ needs.validate-inputs.outputs.VERSION }}rc${{ needs.validate-inputs.outputs.RC }}"
pattern: pypi-release-candidate*
delete-merged: true
uses: ./.github/workflows/pypi-build-artifacts.yml
with:
version: ${{ needs.validate-inputs.outputs.VERSION }}
rc: ${{ needs.validate-inputs.outputs.RC }}
80 changes: 80 additions & 0 deletions .github/workflows/svn-build-artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: "Build SVN Artifacts"

on:
workflow_call:
inputs:
VERSION:
required: true
type: string
RC:
required: true
type: number

jobs:
svn-build-artifacts:
name: Build artifacts for SVN on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-22.04, windows-2022, macos-13, macos-14, macos-15 ]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1

- uses: actions/setup-python@v5
with:
python-version: |
3.9
3.10
3.11
3.12
- name: Install poetry
run: make install-poetry

# Publish the source distribution with the version that's in
# the repository, otherwise the tests will fail
- name: Compile source distribution
run: python3 -m poetry build --format=sdist
if: startsWith(matrix.os, 'ubuntu')

- name: Build wheels
uses: pypa/[email protected]
with:
output-dir: wheelhouse
config-file: "pyproject.toml"
env:
# Ignore 32 bit architectures
CIBW_ARCHS: "auto64"
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9,<3.13"
CIBW_TEST_REQUIRES: "pytest==7.4.2 moto==5.0.1"
CIBW_TEST_EXTRAS: "s3fs,glue"
CIBW_TEST_COMMAND: "pytest {project}/tests/avro/test_decoder.py"
# There is an upstream issue with installing on MacOSX
# https://github.com/pypa/cibuildwheel/issues/1603
# Ignore tests for pypy since not all dependencies are compiled for it
# and would require a local rust build chain
CIBW_TEST_SKIP: "pp* *macosx*"

- name: Add source distribution
if: startsWith(matrix.os, 'ubuntu')
run: ls -lah dist/* && cp dist/* wheelhouse/

- uses: actions/upload-artifact@v4
with:
name: "svn-release-candidate-${{ matrix.os }}"
path: ./wheelhouse/*

svn-merge-artifacts:
runs-on: ubuntu-latest
needs:
- svn-build-artifacts
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: "svn-release-candidate-${{ inputs.VERSION }}rc${{ inputs.RC }}"
pattern: svn-release-candidate*
delete-merged: true

0 comments on commit b013176

Please sign in to comment.