-
Notifications
You must be signed in to change notification settings - Fork 62
142 lines (116 loc) · 4.16 KB
/
Copy pathcode-quality.yml
File metadata and controls
142 lines (116 loc) · 4.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version-file: ".python-version"
- name: Install uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
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: Run async worker unit tests
run: uv run pytest -q osprey_async_worker
- name: Check for unused and undeclared dependencies
run: uv tool run fawltydeps --pyenv .venv
ui-quality:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Rust
uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772 # 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