Skip to content

Commit

Permalink
fix: split workflows into pr checks and release
Browse files Browse the repository at this point in the history
  • Loading branch information
cedrictq committed Nov 1, 2024
1 parent 62d21aa commit 82256e8
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 124 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: PR checks

on:
pull_request:
branches:
- main
types: [opened, synchronize, reopened]

permissions:
contents: read

jobs:
build:
name: ${{ matrix.platform.runner }} ${{ matrix.platform.target }} ${{ matrix.platform.manylinux }}
runs-on: ${{ matrix.platform.runner }}
strategy:
fail-fast: true
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
before: 'yum install --assumeyes perl-core'
manylinux: 'auto'
- runner: ubuntu-latest
target: x86_64
before: 'apt update && apt install -y libssl-dev'
manylinux: 'musllinux_1_2'
- runner: ubuntu-latest
target: x64
before: 'yum install --assumeyes perl-core'
manylinux: 'auto'
- runner: ubuntu-latest
target: x86
before: 'apt update && apt install -y libssl-dev'
manylinux: 'musllinux_1_2'
- runner: ubuntu-latest
target: aarch64
before: 'apt update && apt install -y libssl-dev'
- runner: ubuntu-latest
target: aarch64
before: 'apt update && apt install -y libssl-dev'
manylinux: 'auto'
- runner: ubuntu-latest
target: aarch64
before: 'apt update && apt install -y libssl-dev'
manylinux: 'musllinux_1_2'
- runner: ubuntu-latest
target: armv7
before: 'apt update && apt install -y libssl-dev'
manylinux: 'auto'
- runner: ubuntu-latest
target: armv7
before: 'apt update && apt install -y libssl-dev'
manylinux: 'musllinux_1_2'
- runner: windows-latest
target: x64
- runner: windows-latest
target: x86
- runner: macos-latest
target: x86_64
- runner: macos-latest
target: aarch64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
if: runner.os == 'Windows'
with:
python-version: 3.*
architecture: ${{ matrix.platform.target }}
- uses: actions/setup-python@v5
if: runner.os != 'Windows'
with:
python-version: 3.*
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
manylinux: ${{ matrix.platform.manylinux }}
before-script-linux: ${{ matrix.platform.before }}

sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
117 changes: 31 additions & 86 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ permissions:
contents: read

jobs:
linux:
build:
name: ${{ matrix.platform.runner }} ${{ matrix.platform.target }} ${{ matrix.platform.manylinux }}
runs-on: ${{ matrix.platform.runner }}
strategy:
fail-fast: true
Expand All @@ -18,112 +19,55 @@ jobs:
- runner: ubuntu-latest
target: x86_64
before: 'yum install --assumeyes perl-core'
manylinux: 'auto'
- runner: ubuntu-latest
target: x86_64
before: 'apt update && apt install -y libssl-dev'
manylinux: 'musllinux_1_2'
- runner: ubuntu-latest
target: x64
before: 'yum install --assumeyes perl-core'
manylinux: 'auto'
- runner: ubuntu-latest
target: aarch64
target: x86
before: 'apt update && apt install -y libssl-dev'
manylinux: 'musllinux_1_2'
- runner: ubuntu-latest
target: armv7
target: aarch64
before: 'apt update && apt install -y libssl-dev'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.*
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
manylinux: 'auto'
before-script-linux: ${{ matrix.platform.before }}
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.platform.target }}
path: dist

musllinux:
runs-on: ${{ matrix.platform.runner }}
strategy:
fail-fast: true
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
target: aarch64
before: 'apt update && apt install -y libssl-dev'
manylinux: 'auto'
- runner: ubuntu-latest
target: x86
target: aarch64
before: 'apt update && apt install -y libssl-dev'
manylinux: 'musllinux_1_2'
- runner: ubuntu-latest
target: aarch64
target: armv7
before: 'apt update && apt install -y libssl-dev'
manylinux: 'auto'
- runner: ubuntu-latest
target: armv7
before: 'apt update && apt install -y libssl-dev'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.*
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
manylinux: musllinux_1_2
before-script-linux: ${{ matrix.platform.before }}
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-musllinux-${{ matrix.platform.target }}
path: dist

windows:
runs-on: ${{ matrix.platform.runner }}
strategy:
fail-fast: true
matrix:
platform:
manylinux: 'musllinux_1_2'
- runner: windows-latest
target: x64
- runner: windows-latest
target: x86
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.*
architecture: ${{ matrix.platform.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.platform.target }}
path: dist

macos:
runs-on: ${{ matrix.platform.runner }}
strategy:
fail-fast: true
matrix:
platform:
- runner: macos-latest
target: x86_64
- runner: macos-latest
target: aarch64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
if: runner.os == 'Windows'
with:
python-version: 3.*
architecture: ${{ matrix.platform.target }}
- uses: actions/setup-python@v5
if: runner.os != 'Windows'
with:
python-version: 3.*
- name: Build wheels
Expand All @@ -132,10 +76,13 @@ jobs:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
manylinux: ${{ matrix.platform.manylinux }}
before-script-linux: ${{ matrix.platform.before }}
- name: Upload wheels
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.platform.target }}
name: wheels-${{ matrix.platform.target }}
path: dist

sdist:
Expand All @@ -148,6 +95,7 @@ jobs:
command: sdist
args: --out dist
- name: Upload sdist
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
Expand All @@ -157,13 +105,10 @@ jobs:
name: Release
runs-on: ubuntu-latest
if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
needs: [linux, musllinux, windows, macos, sdist]
needs: [build, sdist]
permissions:
# Use to sign the release artifacts
id-token: write
# Used to upload release artifacts
contents: write
# Used to generate artifact attestation
attestations: write
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -208,4 +153,4 @@ jobs:
uses: softprops/action-gh-release@v2
with:
body: ${{ steps.build_changelog.outputs.changelog }}
tag_name: ${{ steps.pyproject_version.outputs.version }}
tag_name: ${{ steps.pyproject_version.outputs.version }}
38 changes: 0 additions & 38 deletions .github/workflows/test.yml

This file was deleted.

0 comments on commit 82256e8

Please sign in to comment.