ci: make the CI simpler for both, release and tests
This commit is contained in:
parent
22adbdf1a1
commit
a4ed00b02d
2 changed files with 33 additions and 95 deletions
114
.github/workflows/ci.yaml
vendored
114
.github/workflows/ci.yaml
vendored
|
|
@ -8,16 +8,20 @@ on:
|
|||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash -leo pipefail {0}
|
||||
|
||||
permissions:
|
||||
contents: 'read'
|
||||
|
||||
jobs:
|
||||
linux:
|
||||
runs-on: ubuntu-latest
|
||||
testing:
|
||||
strategy:
|
||||
matrix:
|
||||
target: [x86_64, aarch64]
|
||||
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
|
||||
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: mamba-org/setup-micromamba@v1
|
||||
|
|
@ -31,80 +35,21 @@ jobs:
|
|||
post-cleanup: 'all'
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
- name: Generate lockfile
|
||||
run: cargo generate-lockfile
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/
|
||||
~/.cargo/registry/index/
|
||||
~/.cargo/registry/cache/
|
||||
~/.cargo/git/db/
|
||||
target/
|
||||
key: ${{ runner.os }}-${{ matrix.target }}-py${{ matrix.python-version }}-cargo-${{ hashFiles('Cargo.lock') }}
|
||||
- name: Build
|
||||
shell: bash -el {0}
|
||||
run: cargo build --release
|
||||
- name: Rust Tests
|
||||
shell: bash -el {0}
|
||||
run: cargo test --release
|
||||
- name: Build wheels
|
||||
shell: bash -el {0}
|
||||
run: maturin develop --release --manifest-path pyargus/Cargo.toml
|
||||
- name: Python Tests
|
||||
if: matrix.target == 'x86_64'
|
||||
shell: bash -el {0}
|
||||
run: pytest pyargus
|
||||
|
||||
windows:
|
||||
runs-on: windows-latest
|
||||
linting:
|
||||
strategy:
|
||||
matrix:
|
||||
target: [x64]
|
||||
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: mamba-org/setup-micromamba@v1
|
||||
with:
|
||||
environment-name: ci
|
||||
environment-file: environment.yaml
|
||||
create-args: >-
|
||||
python==${{ matrix.python-version }}
|
||||
init-shell: powershell
|
||||
cache-environment: true
|
||||
post-cleanup: 'all'
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
- name: Generate lockfile
|
||||
run: cargo generate-lockfile
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/
|
||||
~/.cargo/registry/index/
|
||||
~/.cargo/registry/cache/
|
||||
~/.cargo/git/db/
|
||||
target/
|
||||
key: ${{ runner.os }}-${{ matrix.target }}-py${{ matrix.python-version }}-cargo-${{ hashFiles('Cargo.lock') }}
|
||||
- name: Build
|
||||
shell: pwsh
|
||||
run: cargo build --release
|
||||
- name: Rust Tests
|
||||
shell: pwsh
|
||||
run: cargo test --release
|
||||
- name: Build wheels
|
||||
shell: pwsh
|
||||
run: maturin develop --release --manifest-path pyargus/Cargo.toml
|
||||
- name: Python Tests
|
||||
shell: pwsh
|
||||
run: pytest pyargus
|
||||
|
||||
macos:
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
matrix:
|
||||
target: [x86_64, aarch64]
|
||||
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
|
||||
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
|
||||
python-version: ['3.10']
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: mamba-org/setup-micromamba@v1
|
||||
|
|
@ -119,27 +64,22 @@ jobs:
|
|||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: ${{ matrix.target }}-apple-darwin
|
||||
- name: Generate lockfile
|
||||
run: cargo generate-lockfile
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/
|
||||
~/.cargo/registry/index/
|
||||
~/.cargo/registry/cache/
|
||||
~/.cargo/git/db/
|
||||
target/
|
||||
key: ${{ runner.os }}-${{ matrix.target }}-py${{ matrix.python-version }}-cargo-${{ hashFiles('Cargo.lock') }}
|
||||
- name: Build
|
||||
shell: bash -el {0}
|
||||
run: cargo build --release
|
||||
- name: Rust Tests
|
||||
shell: bash -el {0}
|
||||
run: cargo test --release
|
||||
- name: Build wheels
|
||||
shell: bash -el {0}
|
||||
toolchain: nightly
|
||||
components: "clippy"
|
||||
- name: Rust lints
|
||||
run: |
|
||||
cargo +nightly fmt --all --check
|
||||
cargo +nightly check --workspace
|
||||
cargo +nightly clippy --workspace
|
||||
- name: Build Python package
|
||||
run: maturin develop --release --manifest-path pyargus/Cargo.toml
|
||||
- name: Python checks
|
||||
working-directory: pyargus
|
||||
run: |
|
||||
black .
|
||||
isort .
|
||||
flake8
|
||||
ruff check .
|
||||
mypy .
|
||||
- name: Python Tests
|
||||
shell: bash -el {0}
|
||||
run: pytest pyargus
|
||||
|
|
|
|||
14
.github/workflows/release.yaml
vendored
14
.github/workflows/release.yaml
vendored
|
|
@ -115,14 +115,12 @@ jobs:
|
|||
id-token: write # IMPORTANT: mandatory for trusted publishing
|
||||
needs: [linux, windows, macos, sdist]
|
||||
steps:
|
||||
- uses: actions/download-artifact@v3
|
||||
- name: Download all dists
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: wheels
|
||||
path: dist
|
||||
- name: Publish to PyPI
|
||||
uses: PyO3/maturin-action@v1
|
||||
env:
|
||||
MATURIN_REPOSITORY_URL: "https://test.pypi.org"
|
||||
path: dist/
|
||||
- name: Publish distribution 📦 to TestPyPI
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
with:
|
||||
command: upload
|
||||
args: --non-interactive dist/*
|
||||
repository-url: https://test.pypi.org/legacy/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue