Skip to content

Commit

Permalink
ci: split ci and build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
u8slvn committed Feb 9, 2024
1 parent ff440d7 commit b5f9c09
Show file tree
Hide file tree
Showing 2 changed files with 153 additions and 129 deletions.
156 changes: 27 additions & 129 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: ci
on:
push:
branches:
Expand All @@ -13,150 +13,48 @@ permissions:

jobs:
quality:
name: Quality
runs-on: ubuntu-latest
name: CI ${{ matrix.os }} - ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: ["ubuntu", "macos", "windows"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: ${{ matrix.python-version }}

- name: Setup python environment
run: |
python -m venv .venv
source .venv/bin/activate
python -m pip install pre-commit
python -m pip install -r requirements-dev.txt
- name: Check quality
run: |
source .venv/bin/activate
make lint
- name: Check tests
- name: Lint
run: |
source .venv/bin/activate
make dev
make test
linux:
name: Build linux
runs-on: ubuntu-latest
needs: [quality]
strategy:
matrix:
target: [x86_64, x86, aarch64, armv7, s390x, ppc64le]

steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: '3.10'
pre-commit run --all-files
- name: Build wheels
- name: Build
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
manylinux: auto
command: develop

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

windows:
name: Build windows
runs-on: windows-latest
needs: [quality]
strategy:
matrix:
target: [x64, x86]
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: '3.10'
architecture: ${{ matrix.target }}

- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: 'true'

- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov

macos:
name: Build macos
runs-on: macos-latest
needs: [quality]
strategy:
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: 'true'

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

sdist:
name: Build sdist
runs-on: ubuntu-latest
needs: [quality]
steps:
- uses: actions/checkout@v3

- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist

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

release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [linux, windows, macos, sdist]
steps:
- uses: actions/download-artifact@v3
with:
name: wheels

- 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 *
- name: Test with coverage
run: |
source .venv/bin/activate
cargo llvm-cov --lcov --output-path coverage.lcov
pytest --cov=bionic_writer --cov-report xml
- name: Publish Coverage
uses: codecov/codecov-action@v1
if: |
matrix.os == 'ubuntu-latest' &&
matrix.python-version == '3.10'
126 changes: 126 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: build
on:
push:
tags:
- '*'

permissions:
contents: read

jobs:
linux:
name: Build linux
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64, x86, aarch64, armv7, s390x, ppc64le]

steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
manylinux: auto

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

windows:
name: Build windows
runs-on: windows-latest
strategy:
matrix:
target: [x64, x86]
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: '3.10'
architecture: ${{ matrix.target }}

- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: 'true'

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

macos:
name: Build macos
runs-on: macos-latest
strategy:
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: 'true'

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

sdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist

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

release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [linux, windows, macos, sdist]
steps:
- uses: actions/download-artifact@v3
with:
name: wheels

- 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 *

0 comments on commit b5f9c09

Please sign in to comment.