Update test.yml #8
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" ] | |
env: | |
CARGO_TERM_COLOR: always | |
DO_NOT_TRACK: 1 | |
PIP_DISABLE_PIP_VERSION_CHECK: 1 | |
jobs: | |
build: | |
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: Build | |
run: cargo build --verbose | |
- name: Run tests (Rust) | |
run: cargo test --verbose | |
- uses: PyO3/maturin-action@v1 | |
with: | |
command: build | |
args: --release | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- 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 |