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 1afa880
Show file tree
Hide file tree
Showing 3 changed files with 172 additions and 134 deletions.
169 changes: 35 additions & 134 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,51 @@ permissions:

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
os: ["ubuntu", "macos", "windows"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
defaults:
run:
shell: bash

- 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
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
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
python-version: ${{ matrix.python-version }}

- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
- name: Set up python environment
run: |
python -m pip install pipenv
python -m pipenv install -r requirements-dev.txt
env:
PIPENV_VENV_IN_PROJECT: 1

sdist:
name: Build sdist
runs-on: ubuntu-latest
needs: [quality]
steps:
- uses: actions/checkout@v3
- name: Lint
run: |
python -m pipenv run pre-commit run --all-files
- name: Build sdist
- name: Build
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
command: develop

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

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: |
cargo llvm-cov --lcov --output-path coverage.lcov
python -m 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 1afa880

Please sign in to comment.