ci: copy over check for commit metadata #24
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
| # Copyright lowRISC contributors (OpenTitan project). | |
| # Licensed under the Apache License, Version 2.0, see LICENSE for details. | |
| # SPDX-License-Identifier: Apache-2.0 | |
| name: Python application | |
| on: | |
| push: | |
| branches: [ "master" ] | |
| pull_request: | |
| branches: [ "master" ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: DeterminateSystems/nix-installer-action@main | |
| - uses: DeterminateSystems/magic-nix-cache-action@main | |
| - uses: DeterminateSystems/flake-checker-action@main | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| - name: Nix Format Check | |
| run: nix fmt -- . --check | |
| - name: Set up Python | |
| run: uv python install 3.13 | |
| - name: Commit metadata | |
| run: | | |
| merge_base="$(git merge-base origin/$GITHUB_BASE_REF HEAD)" || { | |
| echo >&2 "Failed to find fork point for origin/$GITHUB_BASE_REF." | |
| exit 1 | |
| } | |
| echo "Checking commit messages since $merge_base" | |
| # Notes: | |
| # * Merge commits are not checked. We always use rebases instead of | |
| # merges to keep a linear history, which makes merge commits disappear | |
| # ultimately, making them only a CI artifact which should not be | |
| # checked. | |
| scripts/lint_commits.py \ | |
| --no-merges \ | |
| --error-msg-prefix="::error::" \ | |
| --warning-msg-prefix="::warning::" \ | |
| "$merge_base"..HEAD | |
| if: ${{ github.event_name == 'pull_request' }} | |
| - name: Install the project | |
| run: | | |
| uv sync --all-extras | |
| source .venv/bin/activate | |
| echo PATH=$PATH >> $GITHUB_ENV | |
| - name: License header check | |
| run: scripts/license_check.py | |
| - name: Lint with Ruff | |
| run: | | |
| ruff format --check | |
| - name: Check with Ruff (All rules) | |
| run: | | |
| ruff check --statistics | |
| continue-on-error: true | |
| - name: Check with Ruff | |
| run: | | |
| ruff check --config=ruff-ci.toml --output-format=github | |
| - name: Type check with pyright | |
| run: | | |
| pyright | |
| continue-on-error: true | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: | |
| - "3.10" | |
| - "3.11" | |
| - "3.12" | |
| - "3.13" | |
| - "3.14" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| run: uv python install ${{ matrix.python-version }} | |
| - name: Install the project | |
| run: | | |
| uv sync --all-extras | |
| source .venv/bin/activate | |
| echo PATH=$PATH >> $GITHUB_ENV | |
| - name: Test with pytest | |
| run: | | |
| pytest | |