Skip to content

Commit

Permalink
Decouple and reuse jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
vaultah committed Oct 27, 2023
1 parent 1d9bcf9 commit 8b827d0
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 172 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build and test wheels
on:
workflow_call:
inputs:
include-pre-release-pythons:
required: true
type: string
jobs:
build-wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ARCHS: "auto64"
CIBW_BUILD: "cp*"
CIBW_TEST_EXTRAS: "test"
CIBW_TEST_COMMAND: "python -m pytest --pyargs replicat.tests"
CIBW_PRERELEASE_PYTHONS: ${{ inputs.include-pre-release-pythons }}
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
25 changes: 5 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- run: ./scripts/lint --check-only --install

build_wheels:
build-wheels:
needs: lint
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ARCHS: "auto64"
CIBW_BUILD: "cp*"
CIBW_TEST_EXTRAS: "test"
CIBW_TEST_COMMAND: "python -m pytest --pyargs replicat.tests"
CIBW_PRERELEASE_PYTHONS: true
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
uses: ./.github/workflows/build-wheels.yml
with:
include-pre-release-pythons: "true"
82 changes: 6 additions & 76 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,75 +3,16 @@ on:
workflow_dispatch:

jobs:
# 3.8 builds
build-38-windows:
uses: ./.github/workflows/build-windows.yml
build-wheels:
uses: ./.github/workflows/build-wheels.yml
with:
python-version: '3.8'

build-38-linux:
uses: ./.github/workflows/build-linux.yml
with:
python-version: '3.8'

build-38-macos:
uses: ./.github/workflows/build-macos.yml
with:
python-version: '3.8'

# 3.9 builds
build-39-windows:
uses: ./.github/workflows/build-windows.yml
with:
python-version: '3.9'

build-39-linux:
uses: ./.github/workflows/build-linux.yml
with:
python-version: '3.9'

build-39-macos:
uses: ./.github/workflows/build-macos.yml
with:
python-version: '3.9'

# 3.10 builds
build-310-windows:
uses: ./.github/workflows/build-windows.yml
with:
python-version: '3.10'

build-310-linux:
uses: ./.github/workflows/build-linux.yml
with:
python-version: '3.10'

build-310-macos:
uses: ./.github/workflows/build-macos.yml
with:
python-version: '3.10'

# 3.11 builds
build-311-windows:
uses: ./.github/workflows/build-windows.yml
with:
python-version: '3.11'

build-311-linux:
uses: ./.github/workflows/build-linux.yml
with:
python-version: '3.11'

build-311-macos:
uses: ./.github/workflows/build-macos.yml
with:
python-version: '3.11'
include-pre-release-pythons: "false"

build-sdist:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- run: python -m pip install build
- run: python -m build --sdist
- run: echo "SDIST_NAME=$(basename $(ls dist/*.tar.gz))" >> $GITHUB_ENV
Expand All @@ -82,22 +23,11 @@ jobs:

upload:
needs:
- build-38-windows
- build-38-linux
- build-38-macos
- build-39-windows
- build-39-linux
- build-39-macos
- build-310-windows
- build-310-linux
- build-310-macos
- build-311-windows
- build-311-linux
- build-311-macos
- build-wheels
- build-sdist
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
- name: Artifacts tree structure
run: ls -R
- run: python -m pip install twine
Expand Down
82 changes: 6 additions & 76 deletions .github/workflows/test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,75 +3,16 @@ on:
workflow_dispatch:

jobs:
# 3.8 builds
build-38-windows:
uses: ./.github/workflows/build-windows.yml
build-wheels:
uses: ./.github/workflows/build-wheels.yml
with:
python-version: '3.8'

build-38-linux:
uses: ./.github/workflows/build-linux.yml
with:
python-version: '3.8'

build-38-macos:
uses: ./.github/workflows/build-macos.yml
with:
python-version: '3.8'

# 3.9 builds
build-39-windows:
uses: ./.github/workflows/build-windows.yml
with:
python-version: '3.9'

build-39-linux:
uses: ./.github/workflows/build-linux.yml
with:
python-version: '3.9'

build-39-macos:
uses: ./.github/workflows/build-macos.yml
with:
python-version: '3.9'

# 3.10 builds
build-310-windows:
uses: ./.github/workflows/build-windows.yml
with:
python-version: '3.10'

build-310-linux:
uses: ./.github/workflows/build-linux.yml
with:
python-version: '3.10'

build-310-macos:
uses: ./.github/workflows/build-macos.yml
with:
python-version: '3.10'

# 3.11 builds
build-311-windows:
uses: ./.github/workflows/build-windows.yml
with:
python-version: '3.11'

build-311-linux:
uses: ./.github/workflows/build-linux.yml
with:
python-version: '3.11'

build-311-macos:
uses: ./.github/workflows/build-macos.yml
with:
python-version: '3.11'
include-pre-release-pythons: "false"

build-sdist:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- run: python -m pip install build
- run: python -m build --sdist
- run: echo "SDIST_NAME=$(basename $(ls dist/*.tar.gz))" >> $GITHUB_ENV
Expand All @@ -82,22 +23,11 @@ jobs:

upload:
needs:
- build-38-windows
- build-38-linux
- build-38-macos
- build-39-windows
- build-39-linux
- build-39-macos
- build-310-windows
- build-310-linux
- build-310-macos
- build-311-windows
- build-311-linux
- build-311-macos
- build-wheels
- build-sdist
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
- name: Artifacts tree structure
run: ls -R
- run: python -m pip install twine
Expand Down

0 comments on commit 8b827d0

Please sign in to comment.