Mirror of https://github.com/roostorg/osprey
github.com/roostorg/osprey
1name: Code Quality Checks
2
3on:
4 pull_request:
5 branches: [main]
6 types: [opened, synchronize, reopened, ready_for_review]
7 push:
8 branches: [main]
9
10concurrency:
11 group: ${{ github.workflow }}-${{ github.ref }}
12 cancel-in-progress: true
13
14jobs:
15 python-quality:
16 runs-on: ubuntu-24.04
17 steps:
18 - name: Checkout code
19 uses: actions/checkout@v4
20
21 - name: Set up Python
22 uses: actions/setup-python@v6
23 with:
24 python-version-file: ".python-version"
25
26 - name: Install uv
27 uses: astral-sh/setup-uv@v7
28 with:
29 version: "latest"
30 enable-cache: true
31
32 - name: Install dependencies
33 run: uv sync --dev
34
35 - name: Set PY
36 run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
37 - uses: actions/cache@v4
38 with:
39 path: ~/.cache/pre-commit
40 key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
41
42 - name: Run pre-commit python checks
43 env:
44 SKIP: prettier-osprey-ui
45 run: |
46 uv run pre-commit install --install-hooks
47 uv run pre-commit run --show-diff-on-failure --color=always --all-files
48
49 ui-quality:
50 runs-on: ubuntu-24.04
51 steps:
52 - name: Checkout code
53 uses: actions/checkout@v4
54
55 - name: Set up Node.js
56 uses: actions/setup-node@v4
57 with:
58 node-version: "18"
59 cache: "npm"
60 cache-dependency-path: osprey_ui/package-lock.json
61
62 - name: Install UI dependencies
63 run: npm ci
64 working-directory: osprey_ui
65
66 - name: Run prettier check
67 run: npm run format:check
68 working-directory: osprey_ui
69
70 rust-quality:
71 runs-on: ubuntu-24.04
72 steps:
73 - name: Checkout code
74 uses: actions/checkout@v4
75
76 - name: Set up Rust
77 uses: actions-rs/toolchain@v1
78 with:
79 toolchain: stable
80 components: rustfmt, clippy
81 override: true
82
83 - name: Cache Rust dependencies
84 uses: actions/cache@v4
85 with:
86 path: |
87 ~/.cargo/bin/
88 ~/.cargo/registry/index/
89 ~/.cargo/registry/cache/
90 ~/.cargo/git/db/
91 osprey_coordinator/target/
92 key: ${{ runner.os }}-cargo-${{ hashFiles('osprey_coordinator/Cargo.lock', 'osprey_coordinator/Cargo.toml') }}
93 restore-keys: |
94 ${{ runner.os }}-cargo-
95
96 - name: Check Rust formatting
97 run: cargo fmt --check
98 working-directory: osprey_coordinator
99
100 - name: Run Clippy linting
101 run: cargo clippy -- -D warnings
102 working-directory: osprey_coordinator
103 continue-on-error: true
104
105 - name: Build Rust project
106 run: |
107 sudo apt-get install protobuf-compiler
108 cargo build --verbose
109 working-directory: osprey_coordinator
110
111 - name: Run Rust tests
112 run: cargo test --verbose
113 working-directory: osprey_coordinator
114 continue-on-error: true