name: Code Quality Checks on: pull_request: branches: [main] types: [opened, synchronize, reopened, ready_for_review] push: branches: [main] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true permissions: contents: read jobs: python-quality: runs-on: ubuntu-24.04 steps: - name: Checkout code uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - name: Set up Python uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 with: python-version-file: ".python-version" - name: Install uv uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2 with: version: "latest" enable-cache: true - name: Install dependencies run: uv sync --dev - name: Set PY run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: ~/.cache/pre-commit key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} - name: Run pre-commit python checks (ruff, mypy, etc.) env: SKIP: prettier-osprey-ui,eslint-osprey-ui run: | uv run pre-commit install --install-hooks uv run pre-commit run --show-diff-on-failure --color=always --all-files - name: Check for unused dependencies run: uv tool run fawltydeps --check-unused --pyenv .venv ui-quality: runs-on: ubuntu-24.04 steps: - name: Checkout code uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - name: Set up Node.js uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: node-version: "22.22" - name: Enable Corepack run: npm install -g corepack@0.33.0 && corepack enable - name: Install UI dependencies run: corepack pnpm install --frozen-lockfile working-directory: osprey_ui - name: Run prettier check run: corepack pnpm run format:check working-directory: osprey_ui - name: Run eslint check run: corepack pnpm run lint working-directory: osprey_ui - name: Typecheck run: corepack pnpm run typecheck working-directory: osprey_ui - name: Build run: corepack pnpm run build working-directory: osprey_ui rust-quality: runs-on: ubuntu-24.04 steps: - name: Checkout code uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - name: Set up Rust uses: dtolnay/rust-toolchain@2c7215f132e9ebf062739d9130488b56d53c060c # master with: toolchain: stable components: rustfmt, clippy - name: Cache Rust dependencies uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: | ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ osprey_coordinator/target/ key: ${{ runner.os }}-cargo-${{ hashFiles('osprey_coordinator/Cargo.lock', 'osprey_coordinator/Cargo.toml') }} restore-keys: | ${{ runner.os }}-cargo- - name: Check Rust formatting run: cargo fmt --check working-directory: osprey_coordinator - name: Run Clippy linting run: cargo clippy -- -D warnings working-directory: osprey_coordinator continue-on-error: true - name: Build Rust project run: | sudo apt-get update sudo apt-get install -y protobuf-compiler cargo build --verbose working-directory: osprey_coordinator - name: Run Rust tests run: cargo test --verbose working-directory: osprey_coordinator continue-on-error: true