Use package manager to install dependencies #2146
Workflow file for this run
This file contains hidden or 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: Testing | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| RUSTFLAGS: "-D warnings" | |
| WORKING_DIR: "my-project" | |
| MIN_PYTHON_VERSION: "3.10" | |
| CI: true # For insta | |
| jobs: | |
| clippy: | |
| name: Clippy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy | |
| - name: Cache dependencies | |
| uses: Swatinem/[email protected] | |
| - name: Run cargo clippy | |
| run: cargo clippy --all-targets -- --deny warnings | |
| clippy-fastapi: | |
| name: clippy-fastapi | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy | |
| - name: Cache dependencies | |
| uses: Swatinem/[email protected] | |
| - name: Run cargo clippy | |
| run: cargo clippy --all-targets -F fastapi -- --deny warnings | |
| fmt: | |
| name: Rustfmt | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: install Rust | |
| with: | |
| components: rustfmt | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache dependencies | |
| uses: Swatinem/[email protected] | |
| - name: Run cargo fmt | |
| run: cargo fmt --all -- --check | |
| test: | |
| name: Tests | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache dependencies | |
| uses: Swatinem/[email protected] | |
| - name: Run cargo test | |
| run: cargo test --locked | |
| test-fastapi: | |
| name: test-fastapi | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache dependencies | |
| uses: Swatinem/[email protected] | |
| - name: Run cargo test | |
| run: cargo test --locked -F fastapi | |
| uv-linting: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| project_type: ["application", "lib"] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/[email protected] | |
| - name: Install uv on Linux | |
| if: runner.os != 'Windows' | |
| run: curl -LsSf https://astral.sh/uv/install.sh | sh | |
| - name: Install uv on Windows | |
| if: runner.os == 'Windows' | |
| run: powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "${{ env.MIN_PYTHON_VERSION }}" | |
| - name: Build package | |
| run: cargo build --release | |
| - name: Run creation | |
| run: ./scripts/ci_run.sh ${{ matrix.project_type }} 1 | |
| - name: MyPy | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: uv run mypy . | |
| - name: ruff check | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: uv run ruff check . | |
| - name: ruff format | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: uv run ruff format --check . | |
| uv-test: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| project_type: ["application", "lib"] | |
| os: [ubuntu-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/[email protected] | |
| - name: Install uv on Linux | |
| if: runner.os != 'Windows' | |
| run: curl -LsSf https://astral.sh/uv/install.sh | sh | |
| - name: Install uv on Windows | |
| if: runner.os == 'Windows' | |
| run: powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| - name: Build package | |
| run: cargo build --release | |
| - name: Run creation | |
| run: ./scripts/ci_run.sh ${{ matrix.project_type }} 1 | |
| shell: bash | |
| - name: Pre-commit check | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: | | |
| git add . | |
| uv run pre-commit run --all-files | |
| - name: Test with pytest | |
| working-directory: ${{ env.WORKING_DIR }} | |
| if: matrix.project_type == 'application' | |
| run: uv run pytest | |
| poetry-linting: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| project_type: ["application", "lib"] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/[email protected] | |
| - name: Install Poetry | |
| run: pipx install poetry | |
| - name: Configure poetry | |
| run: | | |
| poetry config virtualenvs.create true | |
| poetry config virtualenvs.in-project true | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "${{ env.MIN_PYTHON_VERSION }}" | |
| - name: Build package | |
| run: cargo build --release | |
| - name: Run creation | |
| run: ./scripts/ci_run.sh ${{ matrix.project_type }} 2 | |
| - name: MyPy | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: poetry run mypy . | |
| - name: ruff check | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: poetry run ruff check . | |
| - name: ruff format | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: poetry run ruff format --check . | |
| poetry-test: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| project_type: ["application", "lib"] | |
| os: [ubuntu-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/[email protected] | |
| - name: Install Poetry | |
| run: pipx install poetry | |
| - name: Configure poetry | |
| run: | | |
| poetry config virtualenvs.create true | |
| poetry config virtualenvs.in-project true | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| - name: Build package | |
| run: cargo build --release | |
| - name: Run creation | |
| run: ./scripts/ci_run.sh ${{ matrix.project_type }} 2 | |
| shell: bash | |
| - name: Pre-commit check | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: | | |
| git add . | |
| poetry run pre-commit run --all-files | |
| - name: Test with pytest | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: poetry run pytest | |
| pyo3-linting: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| project_type: ["application", "lib"] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install Just | |
| uses: taiki-e/install-action@just | |
| - name: install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy, rustfmt | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/[email protected] | |
| - name: Install uv on Linux | |
| if: runner.os != 'Windows' | |
| run: curl -LsSf https://astral.sh/uv/install.sh | sh | |
| - name: Install uv on Windows | |
| if: runner.os == 'Windows' | |
| run: powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "${{ env.MIN_PYTHON_VERSION }}" | |
| - name: Build package | |
| run: cargo build --release | |
| - name: Run creation | |
| run: ./scripts/ci_run.sh ${{ matrix.project_type }} 3 | |
| - name: MyPy | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: just mypy | |
| - name: ruff check | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: just ruff-check | |
| - name: ruff format | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: uv run ruff format --check . | |
| - name: Generated Project Clippy | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: just clippy | |
| - name: Generated Project Fmt | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: just fmt | |
| pyo3-python-test: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| project_type: ["application", "lib"] | |
| os: [ubuntu-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/[email protected] | |
| - name: Install uv on Linux | |
| if: runner.os != 'Windows' | |
| run: curl -LsSf https://astral.sh/uv/install.sh | sh | |
| - name: Install uv on Windows | |
| if: runner.os == 'Windows' | |
| run: powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| - name: Build package | |
| run: cargo build --release | |
| - name: Run creation | |
| run: ./scripts/ci_run.sh ${{ matrix.project_type }} 3 | |
| shell: bash | |
| - name: Install Dependencies | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: | | |
| uv run maturin build | |
| - name: Pre-commit check | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: | | |
| git add . | |
| uv run pre-commit run --all-files | |
| - name: Test with pytest | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: uv run pytest | |
| setuptools-linting: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| project_type: ["application", "lib"] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/[email protected] | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "${{ env.MIN_PYTHON_VERSION }}" | |
| - name: Build package | |
| run: cargo build --release | |
| - name: Run creation | |
| run: | | |
| ./scripts/ci_run.sh ${{ matrix.project_type }} 4 | |
| - name: MyPy | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: mypy . | |
| - name: ruff check | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: ruff check . | |
| - name: ruff format | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: ruff format --check . | |
| setuptools-test: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| project_type: ["application", "lib"] | |
| os: [ubuntu-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/[email protected] | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "${{ env.MIN_PYTHON_VERSION }}" | |
| - name: Build package | |
| run: cargo build --release | |
| - name: Run creation | |
| run: ./scripts/ci_run.sh ${{ matrix.project_type }} 4 | |
| shell: bash | |
| - name: Pre-commit check | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: | | |
| git add . | |
| pre-commit run --all-files | |
| - name: Test with pytest | |
| working-directory: ${{ env.WORKING_DIR }} | |
| if: matrix.project_type == 'application' | |
| run: python -m pytest | |
| pixi-linting: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| project_type: ["application", "lib"] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/[email protected] | |
| - name: Build package | |
| run: cargo build --release | |
| - name: Run creation | |
| run: ./scripts/ci_run.sh ${{ matrix.project_type }} 5 | |
| shell: bash | |
| - name: Install Pixi | |
| uses: prefix-dev/[email protected] | |
| with: | |
| manifest-path: ${{ env.WORKING_DIR }}/pyproject.toml | |
| pixi-version: v0.57.0 | |
| - name: Set up Python | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: pixi add python=="${{ env.MIN_PYTHON_VERSION }}.*" | |
| - name: MyPy | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: pixi run -e dev mypy . | |
| - name: ruff check | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: pixi run -e dev ruff check . | |
| - name: ruff format | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: pixi run -e dev ruff format --check . | |
| pixi-test: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| project_type: ["application", "lib"] | |
| os: [ubuntu-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/[email protected] | |
| - name: Build package | |
| run: cargo build --release | |
| - name: Run creation | |
| run: ./scripts/ci_run.sh ${{ matrix.project_type }} 5 | |
| shell: bash | |
| - name: Install Pixi | |
| uses: prefix-dev/[email protected] | |
| with: | |
| manifest-path: ${{ env.WORKING_DIR }}/pyproject.toml | |
| pixi-version: v0.57.0 | |
| - name: Set up Python | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: pixi add python=="${{ env.MIN_PYTHON_VERSION }}.*" | |
| - name: Pre-commit check | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: | | |
| git add . | |
| pixi run -e dev pre-commit run --all-files | |
| - name: Test with pytest | |
| working-directory: ${{ env.WORKING_DIR }} | |
| if: matrix.project_type == 'application' | |
| run: pixi run -e dev pytest |