name: Test and Deploy
on:
pull_request:
push:
branches:
- '**'
tags:
- '*'
workflow_dispatch:
permissions:
contents: read
jobs:
windows-build-tests:
strategy:
fail-fast: false
matrix:
pyversion: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
runs-on: "windows-latest"
steps:
- uses: actions/checkout@v4
- name: Install latest stable Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.pyversion }}
architecture: x64
- name: Install deps
run: pip install numpy pandas seaborn xgboost=='1.7.1' 'scikit-learn<=1.8' toml
- name: Sync package metadata files
run: |
cp README.md py-forust/README.md
cp LICENSE py-forust/LICENSE
- name: Update TOML
run: python scripts/remove-optional-deps.py
- name: Build test data
run: python scripts/make_resources.py
- name: Run tests
run: cargo test --verbose
- name: Build Wheels with maturin
uses: PyO3/maturin-action@v1
with:
target: x86_64
command: build
args: --release --strip --interpreter python --manifest-path py-forust/Cargo.toml --out dist
- name: Install wheel
run: pip install forust --no-index --find-links dist --no-deps --force-reinstall
- name: Run Package Tests
run: |
pip install pytest pytest-cov 'black>=24.0.0,<25.0.0' ruff setuptools --upgrade
cd py-forust
ruff check .
black --check .
pytest --cov-fail-under=90 tests
cd ..
- name: Save Artifacts
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.pyversion }}
path: dist/*.whl
overwrite: true
macos-build-test:
strategy:
fail-fast: false
matrix:
pyversion: ["3.11", "3.12", "3.13", "3.14"]
runs-on: "macos-latest"
steps:
- uses: actions/checkout@v4
- name: Install latest stable Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.pyversion }}
architecture: x64
- name: Install deps
run: pip install numpy pandas seaborn xgboost=='1.7.1' 'scikit-learn==1.6.1' toml
- name: Sync package metadata files
run: |
cp README.md py-forust/README.md
cp LICENSE py-forust/LICENSE
- name: Update TOML
run: python scripts/remove-optional-deps.py
- name: Build test data
run: python scripts/make_resources.py
- name: Run tests
run: cargo test --verbose
- name: Build Wheels with maturin
uses: PyO3/maturin-action@v1
with:
target: x86_64
command: build
args: --release --strip --interpreter python --manifest-path py-forust/Cargo.toml --out dist
- name: Install wheel
run: cd py-forust; pip install --no-deps --force-reinstall -e .; cd ..
- name: Run Package Tests
run: |
pip install pytest pytest-cov 'black>=24.0.0,<25.0.0' ruff setuptools --upgrade
cd py-forust
ruff check .
black --check .
pytest --cov-fail-under=90 tests
cd ..
- name: Save Artifacts
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.pyversion }}
path: dist/*.whl
overwrite: true
macos-15-intel-build-test:
strategy:
fail-fast: false
matrix:
pyversion: ["3.9", "3.10"]
runs-on: "macos-15-intel"
steps:
- uses: actions/checkout@v4
- name: Install latest stable Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.pyversion }}
architecture: x64
- name: Install deps
run: pip install numpy pandas seaborn xgboost=='1.7.1' 'scikit-learn==1.6.1' toml
- name: Sync package metadata files
run: |
cp README.md py-forust/README.md
cp LICENSE py-forust/LICENSE
- name: Update TOML
run: python scripts/remove-optional-deps.py
- name: Build test data
run: python scripts/make_resources.py
- name: Run tests
run: cargo test --verbose
- name: Build Wheels with maturin
uses: PyO3/maturin-action@v1
with:
target: x86_64
command: build
args: --release --strip --interpreter python --manifest-path py-forust/Cargo.toml --out dist
- name: Install wheel
run: pip install forust --no-index --find-links dist --no-deps --force-reinstall
- name: Run Package Tests
run: |
pip install pytest pytest-cov 'black>=24.0.0,<25.0.0' ruff setuptools --upgrade
cd py-forust
ruff check .
black --check .
pytest --cov-fail-under=90 tests
cd ..
- name: Save Artifacts
uses: actions/upload-artifact@v4
with:
name: wheels-macos-15-intel-${{ matrix.pyversion }}
path: dist/*.whl
overwrite: true
linux-build-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
pyversion: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v4
- name: Install latest stable Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.pyversion }}
architecture: x64
- name: Install deps
run: pip install numpy pandas seaborn xgboost=='1.7.1' 'scikit-learn==1.6.1' toml
- name: Sync package metadata files
run: |
cp README.md py-forust/README.md
cp LICENSE py-forust/LICENSE
- name: Update TOML
run: python scripts/remove-optional-deps.py
- name: Build test data
run: python scripts/make_resources.py
- name: Run tests
run: cargo test --verbose
- name: Build Wheels with maturin
uses: PyO3/maturin-action@v1
with:
target: x86_64
manylinux: auto
command: build
args: --release --strip --interpreter python${{ matrix.pyversion }} --manifest-path py-forust/Cargo.toml --out dist
- name: Install wheel
run: pip install forust --no-index --find-links dist --no-deps --force-reinstall
- name: Run Package Tests
run: |
pip install pytest pytest-cov 'black>=24.0.0,<25.0.0' ruff setuptools --upgrade
cd py-forust
ruff check .
black --check .
pytest --cov-fail-under=90 tests
cd ..
- name: Save Artifacts
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.pyversion }}
path: dist/*.whl
overwrite: true
release-wheels:
if: startsWith(github.ref, 'refs/tags/')
needs: [windows-build-tests, macos-build-test, macos-15-intel-build-test, linux-build-test]
runs-on: ubuntu-latest
steps:
- name: Download wheel artifacts
uses: actions/download-artifact@v4
with:
pattern: wheels-*
path: dist
merge-multiple: true
- name: List downloaded wheels
run: ls -la dist
- name: Publish Wheels
uses: PyO3/maturin-action@v1
with:
command: upload
args: --username __token__ --password ${{ secrets.PYPI_TOKEN }} --skip-existing dist/*.whl
cargo-build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install latest stable Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: actions/setup-python@v5
with:
python-version: "3.10"
architecture: x64
- name: Install deps
run: pip install numpy pandas seaborn xgboost=='1.7.1' 'scikit-learn==1.6.1' toml
- name: Sync package metadata files
run: |
cp README.md py-forust/README.md
cp LICENSE py-forust/LICENSE
- name: Update TOML
run: python scripts/remove-optional-deps.py
- name: Build test data
run: python scripts/make_resources.py
- name: Run tests
run: cargo test --verbose
- if: "startsWith(github.ref, 'refs/tags/')"
name: Publish Crate
run: cargo publish --token ${CRATES_TOKEN} --allow-dirty
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}