Skip to content

Commit

Permalink
Refactor release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
pemistahl committed Mar 29, 2024
1 parent 2dd1698 commit 0bc16ac
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,67 +13,55 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: Python Release
name: Release

on:
push:
tags:
- v1.*

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

runs-on: ubuntu-latest

strategy:
matrix:
target: [x86_64, x86, aarch64]
target: [ x86_64, x86, aarch64 ]
linux: [ auto, musllinux_1_2 ]

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
manylinux: ${{ matrix.linux }}

- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels
name: linux-${{ matrix.linux }}-${{ matrix.target }}-wheels
path: dist

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

runs-on: windows-latest

strategy:
matrix:
target: [x64, x86]
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:
Expand All @@ -84,28 +72,22 @@ jobs:
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels
name: windows-${{ matrix.target }}-wheels
path: dist

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

runs-on: macos-latest

strategy:
matrix:
target: [x86_64, aarch64]
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:
Expand All @@ -116,26 +98,41 @@ jobs:
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels
name: macos-${{ matrix.target }}-wheels
path: dist

release:
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

needs: [linux, windows, macos]

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

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

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

runs-on: ubuntu-latest

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

- name: Upload release to crates.io
uses: katyo/publish-crates@v2
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
42 changes: 26 additions & 16 deletions .github/workflows/rust-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,18 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
name: Linux Binary 64-Bit
name: Linux 64-Bit

- os: macos-latest
name: MacOS Binary 64-Bit
name: MacOS 64-Bit

- os: windows-latest
name: Windows Binary 64-Bit
name: Windows 64-Bit

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

- name: Install wasm-pack
if: ${{ matrix.os == 'macos-latest' }}
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Enable Safari web driver
if: ${{ matrix.os == 'macos-latest' }}
run: sudo safaridriver --enable

- name: Store or retrieve cargo caches
uses: actions/cache@v4
with:
Expand All @@ -87,20 +79,32 @@ jobs:
- name: Test in debug mode
run: cargo test

wasm-build:
name: WASM Build
needs: rust-build

runs-on: macos-latest

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

- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Enable Safari web driver
run: sudo safaridriver --enable

- name: Run WASM integration tests on NodeJS
if: ${{ matrix.os == 'macos-latest' }}
run: wasm-pack test --node

- name: Run WASM integration tests in Chrome
if: ${{ matrix.os == 'macos-latest' }}
run: wasm-pack test --headless --chrome

- name: Run WASM integration tests in Firefox
if: ${{ matrix.os == 'macos-latest' }}
run: wasm-pack test --headless --firefox

- name: Run WASM integration tests in Safari
if: ${{ matrix.os == 'macos-latest' }}
run: wasm-pack test --headless --safari

coverage-report:
Expand All @@ -121,5 +125,11 @@ jobs:
- name: Generate coverage report
run: cargo +nightly tarpaulin --lib --ignore-config --ignore-panics --ignore-tests --exclude-files src/python.rs src/script.rs src/wasm.rs src/bin/accuracy_reports.rs --verbose --timeout 120 --out xml

- name: Workaround for codecov/feedback#263
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

- name: Upload coverage report
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
43 changes: 0 additions & 43 deletions .github/workflows/rust-release.yml

This file was deleted.

0 comments on commit 0bc16ac

Please sign in to comment.