Skip to content

Commit

Permalink
ci: publish to pypi, remove macos and windows
Browse files Browse the repository at this point in the history
  • Loading branch information
kabouzeid committed Jul 28, 2024
1 parent 505e6a9 commit 1edfb2d
Showing 1 changed file with 77 additions and 30 deletions.
107 changes: 77 additions & 30 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: short
RUSTUP_MAX_RETRIES: 10
MACOSX_DEPLOYMENT_TARGET: 10.7

jobs:
# Update release PR
Expand Down Expand Up @@ -59,19 +58,6 @@ jobs:
os: ubuntu-latest
name: turm-arm-unknown-linux-musleabihf.tar.gz

- target: x86_64-apple-darwin
os: macos-latest
name: turm-x86_64-apple-darwin.zip

- target: aarch64-apple-darwin
os: macos-latest
name: turm-aarch64-apple-darwin.zip

- target: x86_64-pc-windows-msvc
os: windows-latest
name: turm-x86_64-pc-windows-msvc.zip
rustflags: -C target-feature=+crt-static

runs-on: ${{ matrix.os }}
env:
RUSTFLAGS: ${{ matrix.rustflags || '' }}
Expand All @@ -94,27 +80,12 @@ jobs:
args: --release --locked --target ${{ matrix.target }}
use-cross: ${{ matrix.os == 'ubuntu-latest' }}

- name: Post Build | Prepare artifacts [-nix]
if: matrix.os != 'windows-latest' && matrix.os != 'macos-latest'
- name: Post Build | Prepare artifacts
run: |
cd target/${{ matrix.target }}/release
tar czvf ../../../${{ matrix.name }} turm
cd -
- name: Post Build | Prepare artifacts [macOS]
if: matrix.os == 'macos-latest'
run: |
cd target/${{ matrix.target }}/release
zip ../../../${{ matrix.name }} turm
cd -
- name: Post Build | Prepare artifacts [Windows]
if: matrix.os == 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
7z a ../../../${{ matrix.name }} turm.exe
cd -
- name: Release | Upload artifacts
uses: actions/upload-artifact@v3
with:
Expand All @@ -141,6 +112,68 @@ jobs:
files: turm-*/turm-*
tag_name: ${{ needs.release_please.outputs.tag_name }}

maturin_linux:
if: ${{ needs.release_please.outputs.release_created == 'true' }}
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: x86
- runner: ubuntu-latest
target: aarch64
- runner: ubuntu-latest
target: armv7
- runner: ubuntu-latest
target: s390x
- runner: ubuntu-latest
target: ppc64le
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist
sccache: 'true'
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.platform.target }}
path: dist

maturin_musllinux:
if: ${{ needs.release_please.outputs.release_created == 'true' }}
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: x86
- runner: ubuntu-latest
target: aarch64
- runner: ubuntu-latest
target: armv7
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist
sccache: 'true'
manylinux: musllinux_1_2
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-musllinux-${{ matrix.platform.target }}
path: dist

cargo_publish:
name: Publish to crates.io
needs: [upload_artifacts] # only publish if everything else worked
Expand All @@ -151,3 +184,17 @@ jobs:
- uses: actions/checkout@v4
- name: Publish
run: cargo publish

maturin_release:
name: Maturin | Release
runs-on: ubuntu-latest
needs: [upload_artifacts, maturin_linux, maturin_musllinux] # only publish if everything else worked
steps:
- uses: actions/download-artifact@v4
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
command: upload
args: --non-interactive --skip-existing wheels-*/*

0 comments on commit 1edfb2d

Please sign in to comment.