Update test.yml #16
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: Test | |
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: | |
build: | |
runs-on: ubuntu-latest | |
environment: test | |
permissions: | |
id-token: write | |
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 | |
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: python3 -m unittest discover python | |
- name: Publish to TestPyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ |