Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(workflows): separate build from test #7

Merged
merged 7 commits into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 51 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ on:
permissions:
contents: read

defaults:
run:
shell: bash

jobs:
build:
test:
name: Test on ${{ matrix.os }} with Python ${{ matrix.python-version }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
Expand Down Expand Up @@ -53,7 +57,7 @@ jobs:
run: cargo clippy --all-targets --all-features

- name: Run Cargo Test 🧪
run: cargo nextest run --all-features --workspace
run: cargo nextest run --all-features --workspace --release
env:
PROPTEST_CASES: 5000

Expand All @@ -69,8 +73,22 @@ jobs:
cache: true
python-version: ${{ matrix.python-version }}

- name: Install Python Dependencies 📦
run: pdm install
- name: Install uv 🌞
id: setup-uv
run: |
pipx install uv
printf "cache-dir=%s\n" "$(uv cache dir)" >> $GITHUB_OUTPUT

- name: Setup uv cache 🌞
uses: actions/cache@v4
with:
path: ${{ steps.setup-uv.outputs.cache-dir }}
key: uv-cache-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/pdm.lock') }}

- name: Install Python Dependencies (using uv) 📦
run: |
pdm export > requirements.txt
uv pip install -r requirements.txt --editable .

- name: Check Python Formatting 🖌️
run: pdm run ruff check .
Expand All @@ -89,7 +107,29 @@ jobs:
parallel: true
flag-name: run-${{ matrix.os }}-python-${{ matrix.python-version }}

- name: Install uv installer 🌞
build-wheels:
name: Build Wheels on ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository 👁️
uses: actions/checkout@v4

- name: Install mold linker 🔗
if: ${{ matrix.os != 'windows-latest' }}
uses: rui314/setup-mold@v1

- name: Install Rust 🦀
uses: dtolnay/rust-toolchain@stable

- name: Setup Rust Cache 🗄️
uses: Swatinem/rust-cache@v2

- name: Install uv
run: pipx install uv

- name: Build wheels 🛞
Expand All @@ -100,11 +140,13 @@ jobs:
- name: Upload wheel artifacts 🫖
uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-py${{ matrix.python-version }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: |
./wheelhouse/*.whl

finish-coverage:
needs: [build]
name: Finish Coverage Report
needs: [test]
runs-on: ubuntu-latest

steps:
Expand Down
15 changes: 15 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@
name = "pynanoid"
version = "0.1.0"
edition = "2021"
license-file = "LICENSE"
readme = "README.md"
# only the listed files are included in the source distribution (sdist)
include = [
"/pyproject.toml",
"/README.md",
"/LICENSE",
"/src",
"/rust",
"/benches",
"!__pycache__",
"!tests/.hypothesis",
"!tests/.pytest_cache",
"!*.so",
]

[dependencies]
getrandom = "0.2.15"
Expand Down