Skip to content

Commit

Permalink
CI/CD: Try a reusable workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
bnjmnp committed Oct 5, 2024
1 parent 2efe0c8 commit 53e5ff2
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 56 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build wheels and sdist

on:
workflow_call:

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-14]

steps:
- uses: actions/checkout@v4

- name: Build wheels
uses: pypa/[email protected]

- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Build sdist
run: pipx run build --sdist

- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: ./dist/*.tar.gz
28 changes: 5 additions & 23 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,9 @@
# This is a basic workflow that is manually triggered

name: Manual workflow
name: Manual build

# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
# This workflow can only be manually triggered using the GitHub web UI.
on: workflow_dispatch

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2019]

steps:
- uses: actions/checkout@v3

- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ARCHS_WINDOWS: AMD64

- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
jobs:
build:
uses: ./.github/workflows/build.yml
42 changes: 9 additions & 33 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,27 @@
name: Build wheels and sdist and upload everything to testPyPI

# This is triggerd upon creating a release on GitHub.
on:
release:
types: [published]

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-2019]

steps:
- uses: actions/checkout@v3

- name: Build wheels
uses: pypa/[email protected]

- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Build sdist
run: pipx run build --sdist

- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
build:
uses: ./.github/workflows/build.yml

upload_pypi:
needs: [build_wheels, build_sdist]
needs: [build]
runs-on: ubuntu-latest

steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: artifact
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true

- uses: pypa/gh-action-pypi-publish@v1.5.0
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_PYSNDBXBNJMNP_ACCESS_TOKEN }}
Expand Down

0 comments on commit 53e5ff2

Please sign in to comment.