File tree Expand file tree Collapse file tree 7 files changed +180
-4
lines changed
Expand file tree Collapse file tree 7 files changed +180
-4
lines changed Original file line number Diff line number Diff line change 1+ name : pre-commit
2+
3+ on :
4+ push :
5+ branches : [main]
6+ pull_request :
7+
8+ jobs :
9+ pre-commit :
10+ runs-on : ubuntu-latest
11+
12+ steps :
13+ - name : Checkout code
14+ uses : actions/checkout@v4
15+
16+ - name : Install dependencies
17+ run : |
18+ sudo apt-get update
19+ sudo apt-get install -y protobuf-compiler
20+ protoc --version
21+
22+ - name : Set up Python
23+ uses : actions/setup-python@v5
24+ with :
25+ python-version : " 3.13"
26+
27+ - name : Install uv
28+ run : curl -LsSf https://astral.sh/uv/install.sh | sh
29+
30+ - name : Cache uv environments
31+ uses : actions/cache@v4
32+ with :
33+ path : |
34+ ~/.cache/uv
35+ .venv
36+ key : uv-${{ runner.os }}-${{ hashFiles('uv.lock', 'pyproject.toml') }}
37+ restore-keys : |
38+ uv-${{ runner.os }}-
39+
40+ - name : Set up Rust
41+ uses : actions-rust-lang/setup-rust-toolchain@v1
42+
43+ - name : Cache cargo
44+ uses : actions/cache@v4
45+ with :
46+ path : |
47+ ~/.cargo/bin
48+ ~/.cargo/registry
49+ ~/.cargo/git
50+ target
51+ key : cargo-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}
52+ restore-keys : |
53+ cargo-${{ runner.os }}-
54+
55+ - name : Install pre-commit
56+ run : pip install pre-commit detect-secrets
57+
58+ - name : Cache pre-commit environments
59+ uses : actions/cache@v4
60+ with :
61+ path : ~/.cache/pre-commit
62+ key : pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
63+ restore-keys : |
64+ pre-commit-${{ runner.os }}-
65+
66+ - name : Run project setup
67+ run : make setup
68+
69+ - name : Generate dummy env file
70+ run : uv run -m encoderbuild.utils.create_dummy_env_file > .env
71+
72+ - name : Run pre-commit
73+ run : uv run --dev pre-commit run --all-files
Original file line number Diff line number Diff line change 1+ repos :
2+ - repo : local
3+ hooks :
4+ - id : cargo-fmt
5+ name : cargo fmt
6+ entry : bash -c 'cargo fmt --all -- --check'
7+ language : system
8+ types : [rust]
9+ - id : cargo-clippy
10+ name : cargo clippy
11+ entry : bash -c 'cargo clippy --fix --allow-dirty -- -D warnings'
12+ language : system
13+ types : [rust]
14+ - repo : https://github.com/astral-sh/ruff-pre-commit
15+ rev : v0.6.9 # use the latest release tag
16+ hooks :
17+ - id : ruff
18+ name : ruff check
19+ args : [--fix] # optional: auto-fix issues
20+ - id : ruff-format
21+ name : ruff format
Original file line number Diff line number Diff line change @@ -18,3 +18,7 @@ format:
1818licenses :
1919 @echo " Generating licenses..."
2020 @cargo bundle-licenses --format yaml --output THIRDPARTY.yml
21+
22+ .PHONY : pre-commit
23+ pre-commit :
24+ @uv run pre-commit run --all-files
Original file line number Diff line number Diff line change @@ -81,9 +81,7 @@ pub fn get_banner() -> String {
8181
8282 let spaces = " " . repeat ( remaining_len) ;
8383
84- format ! (
85- "{BANNER}\n Model ID: {MODEL_ID}{spaces}{signature}\n "
86- )
84+ format ! ( "{BANNER}\n Model ID: {MODEL_ID}{spaces}{signature}\n " )
8785}
8886
8987pub fn get_model_id ( ) -> String {
Original file line number Diff line number Diff line change @@ -17,5 +17,6 @@ dependencies = [
1717
1818[dependency-groups ]
1919dev = [
20+ " pre-commit>=4.3.0" ,
2021 " ruff>=0.14.2" ,
2122]
You can’t perform that action at this time.
0 commit comments