The first usable API #65
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
DO_NOT_TRACK: 1 | |
PIP_DISABLE_PIP_VERSION_CHECK: 1 | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
# Cargo.lock is in .gitignore, so we use Cargo.toml | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Build | |
run: cargo build --verbose | |
- name: Run tests (Rust) | |
run: cargo test --verbose | |
- name: Create virtual environment | |
run: | | |
curl -LsSf https://astral.sh/uv/install.sh | sh | |
uv venv --system | |
echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH | |
echo "VIRTUAL_ENV=$GITHUB_WORKSPACE/.venv" >> $GITHUB_ENV | |
- name: Set up Maturin | |
run: | | |
uv pip install maturin | |
maturin develop --uv --extras dev | |
- name: Lint with Ruff | |
run: ruff check | |
- name: Lint with Mypy | |
run: mypy . | |
- name: Run tests (Python) | |
run: pytest | |
- name: Lint Jupyter with Ruff | |
run: nbqa ruff *.ipynb | |
- name: Lint Jupyter with Mypy | |
run: nbqa mypy *.ipynb | |
- name: Run Jupyter | |
run: | | |
mkdir jupyter | |
jupyter nbconvert --to html --output jupyter/Tutorial.html --execute Tutorial.ipynb | |
- name: Build with Maturin | |
run: maturin build --release --out=dist/ | |
- name: Check with Twine | |
run: twine check --strict dist/* | |
- name: Upload Jupyter | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./jupyter |