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 254f01f
Show file tree
Hide file tree
Showing 3 changed files with 171 additions and 137 deletions.
171 changes: 34 additions & 137 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,162 +1,59 @@
name: CI
name: ci
on:
push:
branches:
- main
tags:
- '*'
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
quality:
name: Quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

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

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

- 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
needs: [quality]
name: ${{ matrix.os }} / ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
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
os: ["ubuntu", "macos", "windows"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
defaults:
run:
shell: bash

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
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
name: wheels
path: dist
python-version: ${{ matrix.python-version }}

sdist:
name: Build sdist
runs-on: ubuntu-latest
needs: [quality]
steps:
- uses: actions/checkout@v3
- name: Set up python environment
run: |
pip install pipenv
pipenv install -r requirements-dev.txt
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- name: Lint
run: |
pipenv run pre-commit run --all-files
- name: Upload sdist
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
- name: Build
run: |
pipenv run maturin develop
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: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov

- 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: |
cargo llvm-cov --lcov --output-path coverage.lcov
pipenv run 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 *
11 changes: 11 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]

[dev-packages]

[requires]
python_version = "3.11"

0 comments on commit 254f01f

Please sign in to comment.