Skip to content

Commit 8c3d707

Browse files
authored
fix: make command warning & CI pre-commit error (#569)
1 parent 0fc81e6 commit 8c3d707

File tree

6 files changed

+123
-111
lines changed

6 files changed

+123
-111
lines changed

.github/workflows/pre-commit.yml

Lines changed: 99 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -2,109 +2,110 @@ name: Pre-commit
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
pull_request:
7-
branches: [ main ]
8-
workflow_dispatch: # Allow manual triggering
7+
branches: [main]
8+
workflow_dispatch: # Allow manual triggering
99

1010
jobs:
1111
pre-commit:
1212
runs-on: ubuntu-latest
1313
name: Run pre-commit hooks check file lint
1414

1515
steps:
16-
- name: Check out the repo
17-
uses: actions/checkout@v4
18-
with:
19-
fetch-depth: 0 # Fetch full history for pre-commit
20-
21-
- name: Set up Python
22-
uses: actions/setup-python@v5
23-
with:
24-
python-version: '3.11'
25-
26-
- name: Set up Go
27-
uses: actions/setup-go@v5
28-
with:
29-
go-version: '1.24'
30-
31-
- name: Set up Node
32-
uses: actions/setup-node@v5
33-
with:
34-
node-version: 23
35-
36-
- name: Set up Rust
37-
uses: dtolnay/rust-toolchain@stable
38-
with:
39-
toolchain: 1.90
40-
components: rustfmt, clippy
41-
42-
- name: Install system dependencies
43-
run: |
44-
sudo apt-get update
45-
sudo apt-get install -y \
46-
make \
47-
build-essential \
48-
pkg-config
49-
npm install -g markdownlint-cli
50-
pip install --user yamllint codespell
51-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.5.0
52-
53-
- name: Cache Rust dependencies
54-
uses: actions/cache@v4
55-
with:
56-
path: |
57-
~/.cargo/bin/
58-
~/.cargo/registry/index/
59-
~/.cargo/registry/cache/
60-
~/.cargo/git/db/
61-
candle-binding/target/
62-
key: ${{ runner.os }}-cargo-precommit-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
63-
restore-keys: |
64-
${{ runner.os }}-cargo-precommit-
65-
66-
- name: Cache Go dependencies
67-
uses: actions/cache@v4
68-
with:
69-
path: |
70-
~/go/pkg/mod
71-
key: ${{ runner.os }}-go-precommit-${{ hashFiles('**/go.sum') }}
72-
restore-keys: |
73-
${{ runner.os }}-go-precommit-
74-
75-
- name: Cache Node dependencies
76-
uses: actions/cache@v4
77-
with:
78-
path: |
79-
~/.npm
80-
key: ${{ runner.os }}-node-precommit-${{ hashFiles('website/package-lock.json') }}
81-
restore-keys: |
82-
${{ runner.os }}-node-precommit-
83-
84-
- name: Cache pre-commit environments
85-
uses: actions/cache@v4
86-
with:
87-
path: ~/.cache/pre-commit
88-
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
89-
restore-keys: |
90-
${{ runner.os }}-precommit-
91-
92-
- name: Install pre-commit
93-
run: make precommit-install
94-
95-
- name: Run Code Spell Check
96-
run: make codespell
97-
98-
- name: Run pre-commit check
99-
run: make precommit-check
100-
env:
101-
CI: true
102-
103-
- name: Show pre-commit results
104-
if: failure()
105-
run: |
106-
echo "::error::Pre-commit hooks failed. Please fix the issues and commit again."
107-
echo "To run pre-commit locally:"
108-
echo " pip install pre-commit"
109-
echo " pre-commit install"
110-
echo " pre-commit run --all-files"
16+
- name: Check out the repo
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0 # Fetch full history for pre-commit
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.11"
25+
26+
- name: Set up Go
27+
uses: actions/setup-go@v5
28+
with:
29+
go-version: "1.24"
30+
31+
- name: Set up Node
32+
uses: actions/setup-node@v5
33+
with:
34+
node-version: 23
35+
36+
- name: Set up Rust
37+
uses: dtolnay/rust-toolchain@stable
38+
with:
39+
toolchain: 1.90
40+
components: rustfmt, clippy
41+
42+
- name: Install system dependencies
43+
run: |
44+
sudo apt-get update
45+
sudo apt-get install -y \
46+
make \
47+
build-essential \
48+
pkg-config \
49+
shellcheck
50+
npm install -g markdownlint-cli
51+
pip install --user yamllint codespell
52+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.5.0
53+
54+
- name: Cache Rust dependencies
55+
uses: actions/cache@v4
56+
with:
57+
path: |
58+
~/.cargo/bin/
59+
~/.cargo/registry/index/
60+
~/.cargo/registry/cache/
61+
~/.cargo/git/db/
62+
candle-binding/target/
63+
key: ${{ runner.os }}-cargo-precommit-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
64+
restore-keys: |
65+
${{ runner.os }}-cargo-precommit-
66+
67+
- name: Cache Go dependencies
68+
uses: actions/cache@v4
69+
with:
70+
path: |
71+
~/go/pkg/mod
72+
key: ${{ runner.os }}-go-precommit-${{ hashFiles('**/go.sum') }}
73+
restore-keys: |
74+
${{ runner.os }}-go-precommit-
75+
76+
- name: Cache Node dependencies
77+
uses: actions/cache@v4
78+
with:
79+
path: |
80+
~/.npm
81+
key: ${{ runner.os }}-node-precommit-${{ hashFiles('website/package-lock.json') }}
82+
restore-keys: |
83+
${{ runner.os }}-node-precommit-
84+
85+
- name: Cache pre-commit environments
86+
uses: actions/cache@v4
87+
with:
88+
path: ~/.cache/pre-commit
89+
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
90+
restore-keys: |
91+
${{ runner.os }}-precommit-
92+
93+
- name: Install pre-commit
94+
run: make precommit-install
95+
96+
- name: Run Code Spell Check
97+
run: make codespell
98+
99+
- name: Run pre-commit check
100+
run: make precommit-check
101+
env:
102+
CI: true
103+
104+
- name: Show pre-commit results
105+
if: failure()
106+
run: |
107+
echo "::error::Pre-commit hooks failed. Please fix the issues and commit again."
108+
echo "To run pre-commit locally:"
109+
echo " pip install pre-commit"
110+
echo " pre-commit install"
111+
echo " pre-commit run --all-files"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
An **Mixture-of-Models** (MoM) router that intelligently directs OpenAI API requests to the most suitable models from a defined pool based on **Semantic Understanding** of the request's intent (Complexity, Task, Tools).
4040

41-
![](./website/static/img/mom-overview.png)
41+
![mom-overview](./website/static/img/mom-overview.png)
4242

4343
Conceptually similar to Mixture-of-Experts (MoE) which lives *within* a model, this system selects the best *entire model* for the nature of the task.
4444

scripts/quickstart.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ typewriter() {
5252
# Function to show ASCII art with animation
5353
show_ascii_art() {
5454
# Skip clear in CI environments (no proper terminal)
55-
[ -z "${CI:-}" ] && clear || true
55+
if [ -z "${CI:-}" ]; then
56+
clear || true
57+
fi
5658
echo
5759
echo
5860
print_color "$CYAN" " ██╗ ██╗██╗ ██╗ ███╗ ███╗"

tools/make/envs.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
# = Environment Makefile, refer for other makefile =
33
# ====================== envs.mk ======================
44

5+
# CI environment flag (set by CI/CD systems like GitHub Actions)
6+
# Can be overridden: CI=true make build
7+
CI ?=
8+
59
# Container runtime (docker or podman)
610
CONTAINER_RUNTIME ?= docker
711

tools/make/linter.mk

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@
44

55
##@ Linter
66

7-
docs-lint: docs-install ## Lint documentation in website/
8-
@$(LOG_TARGET)
9-
cd website && npm run lint
10-
11-
docs-lint-fix: docs-install ## Auto-fix documentation lint issues in website/
12-
@$(LOG_TARGET)
13-
cd website && npm run lint:fix
14-
157
markdown-lint: ## Lint all markdown files in the project
168
@$(LOG_TARGET)
179
markdownlint -c tools/linter/markdown/markdownlint.yaml "**/*.md" \
@@ -40,4 +32,17 @@ codespell: ## Check for common misspellings in code and docs
4032

4133
shellcheck: ## Lint all shell scripts in the project
4234
@$(LOG_TARGET)
43-
shellcheck --rcfile=tools/linter/shellcheck/.shellcheckrc $(shell find . -type f -name "*.sh" -not -path "./node_modules/*" -not -path "./website/node_modules/*" -not -path "./dashboard/frontend/node_modules/*" -not -path "./models/*" -not -path "./.venv/*")
35+
@if ! command -v shellcheck >/dev/null 2>&1; then \
36+
echo "❌ Error: shellcheck is not installed"; \
37+
echo ""; \
38+
echo "To install shellcheck:"; \
39+
echo " macOS: brew install shellcheck"; \
40+
echo " Ubuntu: sudo apt-get install shellcheck"; \
41+
echo " Fedora: sudo dnf install shellcheck"; \
42+
echo ""; \
43+
echo "Or skip shellcheck in pre-commit by running:"; \
44+
echo " SKIP=shellcheck pre-commit run --all-files"; \
45+
exit 1; \
46+
fi
47+
@echo "Running shellcheck with config from tools/linter/shellcheck/.shellcheckrc"
48+
@shellcheck -e SC2155,SC2034,SC1091 $(shell find . -type f -name "*.sh" -not -path "./node_modules/*" -not -path "./website/node_modules/*" -not -path "./dashboard/frontend/node_modules/*" -not -path "./models/*" -not -path "./.venv/*")

tools/make/pre-commit.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ precommit-install:
88

99
precommit-check: ## Run pre-commit checks on all relevant files
1010
precommit-check:
11-
@FILES=$$(find . -type f \( -name "*.go" -o -name "*.rs" -o -name "*.py" -o -name "*.js" -o -name "*.md" -o -name "*.yaml" -o -name "*.yml" \) \
11+
@FILES=$$(find . -type f \( -name "*.go" -o -name "*.rs" -o -name "*.py" -o -name "*.js" -o -name "*.sh" -o -name "*.md" -o -name "*.yaml" -o -name "*.yml" \) \
1212
! -path "./target/*" \
1313
! -path "./candle-binding/target/*" \
1414
! -path "./website/node_modules/*" \
@@ -24,7 +24,7 @@ precommit-check:
2424
echo "Running pre-commit on files: $$FILES"; \
2525
pre-commit run --files $$FILES; \
2626
else \
27-
echo "No Go, Rust, JavaScript, Markdown, Yaml, or Python files found to check"; \
27+
echo "No Go, Rust, JavaScript, Shell, Markdown, Yaml, or Python files found to check"; \
2828
fi
2929

3030
# Run pre-commit hooks in a Docker container,

0 commit comments

Comments
 (0)