Skip to content

Commit

Permalink
CI&CD: upgrading publish workflow logic to best ever
Browse files Browse the repository at this point in the history
  • Loading branch information
bigcat88 committed Jan 19, 2023
1 parent 8c4bb58 commit 8a2586b
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 32 deletions.
21 changes: 9 additions & 12 deletions .github/workflows/publish-pypi-pi_heif.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@ name: Publish • Pi-Heif
# This action build `pi-heif` which is `pillow-heif` but without `aom` and `x265` libraries.

on:
workflow_run:
workflows: [Publish • Pillow-Heif]
types:
- completed
workflow_call:

jobs:
wheels_macos_arm:
if: ${{ github.event.workflow_run.conclusion == 'success'}}
name: macosx • aarch64
runs-on: ubuntu-20.04

Expand All @@ -35,7 +31,6 @@ jobs:
if-no-files-found: error

wheels_windows:
if: ${{ github.event.workflow_run.conclusion == 'success'}}
name: windows • x86_64
runs-on: windows-2019
env:
Expand Down Expand Up @@ -89,7 +84,6 @@ jobs:
if-no-files-found: error

wheels_macos:
if: ${{ github.event.workflow_run.conclusion == 'success'}}
name: macosx • x86_64
runs-on: macos-11

Expand Down Expand Up @@ -121,7 +115,6 @@ jobs:
if-no-files-found: error

wheels_linux_cpython:
if: ${{ github.event.workflow_run.conclusion == 'success'}}
strategy:
fail-fast: true
matrix:
Expand Down Expand Up @@ -152,6 +145,10 @@ jobs:
env:
OS_PACKAGES: "fribidi-dev harfbuzz-dev jpeg-dev lcms2-dev openjpeg-dev"

- name: Only minimal testing on aarch64
if: matrix.cibw_arch == 'aarch64'
run: echo CIBW_TEST_EXTRAS="tests-min" >> $GITHUB_ENV

- name: Run cibuildwheel
run: |
python3 -m pip install cibuildwheel==2.11.4
Expand All @@ -175,7 +172,6 @@ jobs:
if-no-files-found: error

wheels_linux_pypy:
if: ${{ github.event.workflow_run.conclusion == 'success'}}
strategy:
fail-fast: true
matrix:
Expand All @@ -201,6 +197,10 @@ jobs:
with:
platforms: arm64

- name: Only minimal testing on aarch64
if: matrix.cibw_arch == 'aarch64'
run: echo CIBW_TEST_EXTRAS="tests-min" >> $GITHUB_ENV

- name: Run cibuildwheel
run: |
python3 -m pip install cibuildwheel==2.11.4
Expand All @@ -224,7 +224,6 @@ jobs:
if-no-files-found: error

wheels_armv7l:
if: ${{ github.event.workflow_run.conclusion == 'success'}}
name: ${{ matrix.i['name'] }} • ARMv7l • CPython
runs-on: ubuntu-20.04
strategy:
Expand Down Expand Up @@ -267,7 +266,6 @@ jobs:
if-no-files-found: error

sdist:
if: ${{ github.event.workflow_run.conclusion == 'success'}}
name: Source distribution
runs-on: macos-12

Expand Down Expand Up @@ -311,7 +309,6 @@ jobs:
path: wheelhouse/*.tar.gz

publish_release:
if: ${{ github.event.workflow_run.conclusion == 'success'}}
needs: [wheels_windows, wheels_macos, wheels_macos_arm, wheels_linux_cpython, wheels_linux_pypy, sdist, wheels_armv7l]
name: Publish release
runs-on: ubuntu-20.04
Expand Down
13 changes: 1 addition & 12 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
name: Publish • Pillow-Heif

on:
workflow_run:
workflows: [Publish]
types:
- completed
workflow_call:

jobs:
wheels_macos_arm:
Expand Down Expand Up @@ -232,10 +229,6 @@ jobs:
env:
OS_PACKAGES: "fribidi-dev harfbuzz-dev jpeg-dev lcms2-dev openjpeg-dev"

- name: Only minimal testing on aarch64
if: matrix.cibw_arch == 'aarch64'
run: echo CIBW_TEST_EXTRAS="tests-min" >> $GITHUB_ENV

- uses: actions/cache@v3
with:
path: ${{ env.BUILD_DIR_PREFIX }}/build-stuff
Expand Down Expand Up @@ -348,10 +341,6 @@ jobs:
with:
platforms: arm64

- name: Only minimal testing on aarch64
if: matrix.cibw_arch == 'aarch64'
run: echo CIBW_TEST_EXTRAS="tests-min" >> $GITHUB_ENV

- uses: actions/cache@v3
with:
path: ${{ env.BUILD_DIR_PREFIX }}/build-stuff
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/publish-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ on:
branches: [ master ]

jobs:
publish_wheels:
name: Publish triggered
trigger_pillow_heif_build:
if: "contains(github.event.head_commit.message, '[publish]')"
runs-on: ubuntu-20.04
name: Pillow-Heif
uses: ./.github/workflows/publish-pypi.yml

steps:
- run: echo "Publish triggered"
trigger_pi_heif_build:
needs: [trigger_pillow_heif_build]
if: "contains(github.event.head_commit.message, '[publish]')"
name: Pi-Heif
uses: ./.github/workflows/publish-pypi-pi_heif.yml
4 changes: 2 additions & 2 deletions .github/workflows/test-wheels-pi_heif.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Wheels test(Pi-Heif)
name: Wheels testPi-Heif

on:
workflow_dispatch:
workflow_run:
workflows: [Publish • Pi-Heif]
workflows: [Publish]
types:
- completed

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Wheels test
on:
workflow_dispatch:
workflow_run:
workflows: [Publish • Pillow-Heif]
workflows: [Publish]
types:
- completed

Expand Down

0 comments on commit 8a2586b

Please sign in to comment.