Skip to content

Commit

Permalink
Refactor release workflow again
Browse files Browse the repository at this point in the history
  • Loading branch information
pemistahl committed Mar 5, 2024
1 parent 024963a commit e39a006
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 150 deletions.
141 changes: 0 additions & 141 deletions .github/workflows/python-release.yml

This file was deleted.

136 changes: 129 additions & 7 deletions .github/workflows/rust-release.yml → .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,36 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: Rust Release
name: Release

on:
push:
tags:
- v1.*

jobs:
rust-release:
rust-release-build:
name: ${{ matrix.name }}

runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
name: Linux Binaries
name: Rust Release Build on Linux
x86_64-target: x86_64-unknown-linux-musl
aarch64-target: aarch64-unknown-linux-musl

- os: macos-latest
name: MacOS Binaries
name: Rust Release Build on MacOS
x86_64-target: x86_64-apple-darwin
aarch64-target: aarch64-apple-darwin

- os: windows-latest
name: Windows Binaries
name: Rust Release Build on Windows
x86_64-target: x86_64-pc-windows-msvc
aarch64-target: aarch64-pc-windows-msvc

Expand Down Expand Up @@ -101,9 +102,130 @@ jobs:
file_glob: true
file: target/*/release/grex-${{ steps.get_version.outputs.version }}-*.{zip,tar.gz}

release-upload:
python-linux-release-build:
name: Python Release Build on Linux and target ${{ matrix.target }}
needs: rust-release-build

runs-on: ubuntu-latest

strategy:
matrix:
target: [ x86_64, x86, aarch64 ]

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'

- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9 pypy3.10
sccache: 'true'
manylinux: auto

- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels
path: dist

python-windows-release-build:
name: Python Release Build on Windows and target ${{ matrix.target }}
needs: rust-release-build

runs-on: windows-latest

strategy:
matrix:
target: [ x64, x86 ]

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
architecture: ${{ matrix.target }}
cache: 'pip'

- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12
sccache: 'true'

- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels
path: dist

python-macos-release-build:
name: Python Release Build on MacOS and target ${{ matrix.target }}
needs: rust-release-build

runs-on: macos-latest

strategy:
matrix:
target: [ x86_64, aarch64 ]

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'

- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9 pypy3.10
sccache: 'true'

- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels
path: dist

python-release-upload:
name: Publish wheels to PyPI
needs: [ python-linux-release-build, python-windows-release-build, python-macos-release-build ]

runs-on: ubuntu-latest

steps:
- name: Download wheels from previous jobs
uses: actions/download-artifact@v4
with:
name: wheels

- name: Upload to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
command: upload
args: --skip-existing *

rust-release-upload:
name: Upload to crates.io
needs: rust-release
needs: [ python-linux-release-build, python-windows-release-build, python-macos-release-build ]

runs-on: ubuntu-latest

Expand Down
8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ unic-ucd-category = "0.9.0"
unicode-segmentation = "1.11.0"

[target.'cfg(not(target_family = "wasm"))'.dependencies]
clap = { version = "4.5.1", features = ["derive", "wrap_help"], optional = true }
pyo3 = { version = "0.20.3", optional = true }
clap = {version = "4.5.1", features = ["derive", "wrap_help"], optional = true}
pyo3 = {version = "0.20.3", optional = true}

[target.'cfg(target_family = "wasm")'.dependencies]
wasm-bindgen = "0.2.92"
Expand All @@ -62,6 +62,10 @@ tempfile = "3.10.1"
[target.'cfg(target_family = "wasm")'.dev-dependencies]
wasm-bindgen-test = "0.3.42"

[target.aarch64-unknown-linux-musl]
linker = "aarch64-linux-gnu-gcc"
rustflags = ["-C", "target-feature=+crt-static", "-C", "link-arg=-lgcc"]

[features]
default = ["cli"]
cli = ["clap"]
Expand Down

0 comments on commit e39a006

Please sign in to comment.