fix(ci): install uv before building wheels #140
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: PR Checks | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| code-quality: | |
| name: Code Quality | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Set up Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy, rustfmt | |
| - name: Install clang-format | |
| uses: awalsh128/cache-apt-pkgs-action@v1 | |
| with: | |
| packages: clang-format | |
| version: 1.0 | |
| - name: Cache Rust dependencies and codegen artifacts | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: | | |
| codegen -> target | |
| - name: Set up Rust problem matchers | |
| uses: r7kamura/rust-problem-matchers@v1 | |
| - name: Set up Python | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version-file: targets/ptfkit-py/pyproject.toml | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v10.0.1 | |
| with: | |
| enable-cache: true | |
| - name: Check ptfkit-py uv.lock | |
| run: uv lock --project targets/ptfkit-py --check | |
| - name: Sync ptfkit-py | |
| run: uv sync --project targets/ptfkit-py --frozen --all-groups | |
| - name: Check generated files | |
| run: | | |
| cargo run --manifest-path codegen/Cargo.toml generate | |
| git diff --exit-code | |
| test -z "$(git status --porcelain)" | |
| - name: Check codegen formatting | |
| id: codegen-format | |
| continue-on-error: true | |
| run: cargo fmt --manifest-path codegen/Cargo.toml --all --check | |
| - name: Check codegen lint | |
| id: codegen-lint | |
| continue-on-error: true | |
| run: cargo clippy --manifest-path codegen/Cargo.toml --all-targets -- -D warnings | |
| - name: Check codegen tests | |
| id: codegen-tests | |
| continue-on-error: true | |
| run: cargo test --manifest-path codegen/Cargo.toml | |
| - name: Check ptfkit-py lint | |
| id: ptfkit-py-lint | |
| continue-on-error: true | |
| run: uv run --directory targets/ptfkit-py --no-sync ruff check --output-format=github | |
| - name: Check ptfkit-py formatting | |
| id: ptfkit-py-format | |
| continue-on-error: true | |
| run: uv run --directory targets/ptfkit-py --no-sync ruff format --check --output-format=github | |
| - name: Check ptfkit-py types | |
| id: ptfkit-py-typescheck | |
| continue-on-error: true | |
| run: uv run --directory targets/ptfkit-py --no-sync ty check --output-format=github | |
| - name: Check ptfkit-rs formatting | |
| id: ptfkit-rs-format | |
| continue-on-error: true | |
| run: cargo fmt --manifest-path targets/ptfkit-rs/Cargo.toml --all --check | |
| - name: Check C and C++ formatting | |
| id: c-family-format | |
| continue-on-error: true | |
| run: > | |
| git ls-files -z -- '*.c' '*.h' '*.cc' '*.cpp' '*.cppm' '*.cxx' '*.hpp' | |
| | xargs -0 --no-run-if-empty clang-format --style=file --dry-run --Werror | |
| - name: Check ptfkit-rs lint | |
| id: ptfkit-rs-lint | |
| continue-on-error: true | |
| run: cargo clippy --manifest-path targets/ptfkit-rs/Cargo.toml --all-targets -- -D warnings | |
| - name: Check ptfkit-rs tests | |
| id: ptfkit-rs-tests | |
| continue-on-error: true | |
| run: cargo test --manifest-path targets/ptfkit-rs/Cargo.toml | |
| - name: Fail if any step failed | |
| if: | | |
| steps.codegen-format.outcome == 'failure' || | |
| steps.codegen-lint.outcome == 'failure' || | |
| steps.codegen-tests.outcome == 'failure' || | |
| steps.ptfkit-py-lint.outcome == 'failure' || | |
| steps.ptfkit-py-format.outcome == 'failure' || | |
| steps.ptfkit-py-typescheck.outcome == 'failure' || | |
| steps.ptfkit-rs-format.outcome == 'failure' || | |
| steps.c-family-format.outcome == 'failure' || | |
| steps.ptfkit-rs-lint.outcome == 'failure' || | |
| steps.ptfkit-rs-tests.outcome == 'failure' | |
| run: exit 1 | |
| pytest: | |
| name: Tests Python ${{ matrix.python-version }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ['3.11', '3.12', '3.13', '3.14', '3.14t'] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - uses: actions/setup-python@v7 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v10.0.1 | |
| with: | |
| enable-cache: true | |
| - name: Run pytest | |
| run: uv run --directory targets/ptfkit-py pytest --no-cov | |
| native: | |
| name: Tests Native | |
| runs-on: ubuntu-26.04 | |
| env: | |
| CC: clang | |
| CXX: clang++ | |
| CMAKE_GENERATOR: Ninja | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Configure ptfkit-native | |
| run: > | |
| cmake -S targets/ptfkit-native -B targets/ptfkit-native/build | |
| -DBUILD_TESTING=ON -DPTFKIT_BUILD_CPP_MODULES=ON | |
| - name: Build ptfkit-native | |
| run: cmake --build targets/ptfkit-native/build | |
| - name: Test ptfkit-native | |
| run: ctest --test-dir targets/ptfkit-native/build --output-on-failure | |
| docs: | |
| name: Build Documentation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v10.0.1 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: | | |
| docs/pyproject.toml | |
| docs/uv.lock | |
| - name: Check documentation lock | |
| run: uv lock --project docs --check | |
| - name: Sync documentation environment | |
| run: uv sync --project docs --frozen | |
| - name: Build documentation | |
| run: uv --directory=docs run mkdocs build --strict --config-file mkdocs.yml | |
| summary: | |
| name: PR Checks Summary | |
| runs-on: ubuntu-latest | |
| if: always() | |
| needs: [code-quality, docs, native, pytest] | |
| steps: | |
| - run: > | |
| test | |
| "${{ needs.code-quality.result }}" = "success" -a | |
| "${{ needs.docs.result }}" = "success" -a | |
| "${{ needs.native.result }}" = "success" -a | |
| "${{ needs.pytest.result }}" = "success" |