File tree Expand file tree Collapse file tree 3 files changed +91
-0
lines changed
Expand file tree Collapse file tree 3 files changed +91
-0
lines changed Original file line number Diff line number Diff line change 1+ name : CI
2+
3+ on :
4+ push :
5+ branches : [ main ]
6+ pull_request :
7+ branches : [ main ]
8+
9+ env :
10+ CARGO_TERM_COLOR : always
11+
12+ jobs :
13+ test :
14+ name : Test
15+ runs-on : ubuntu-latest
16+ steps :
17+ - uses : actions/checkout@v4
18+
19+ - name : Install Rust
20+ uses : dtolnay/rust-toolchain@stable
21+ with :
22+ toolchain : 1.88.0
23+ components : rustfmt, clippy
24+
25+ - name : Cache cargo registry
26+ uses : actions/cache@v4
27+ with :
28+ path : ~/.cargo/registry
29+ key : ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
30+
31+ - name : Cache cargo index
32+ uses : actions/cache@v4
33+ with :
34+ path : ~/.cargo/git
35+ key : ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
36+
37+ - name : Cache cargo build
38+ uses : actions/cache@v4
39+ with :
40+ path : target
41+ key : ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
42+
43+ - name : Check formatting
44+ run : cargo fmt -- --check
45+
46+ - name : Run clippy
47+ run : cargo clippy -- -D warnings
48+
49+ - name : Run tests
50+ run : cargo test --verbose
51+
52+ - name : Build
53+ run : cargo build --verbose
Original file line number Diff line number Diff line change @@ -13,6 +13,17 @@ pre-commit:
1313 test :
1414 glob : " *.rs"
1515 run : cargo test
16+ actionlint :
17+ glob : " .github/workflows/*.{yml,yaml}"
18+ run : |
19+ if ! command -v actionlint &> /dev/null; then
20+ echo "actionlint not found. Please install it:"
21+ echo " brew install actionlint"
22+ echo " or"
23+ echo " go install github.com/rhysd/actionlint/cmd/actionlint@latest"
24+ exit 1
25+ fi
26+ actionlint {staged_files}
1627
1728pre-push :
1829 parallel : true
Original file line number Diff line number Diff line change 3737 echo " ✅ Lefthook is already installed ($( lefthook version) )"
3838fi
3939
40+ # Install actionlint
41+ if ! command -v actionlint & > /dev/null; then
42+ echo " 📦 Installing actionlint (GitHub Actions linter)..."
43+
44+ # Check if homebrew is available
45+ if command -v brew & > /dev/null; then
46+ echo " Using Homebrew..."
47+ brew install actionlint
48+ elif command -v go & > /dev/null; then
49+ echo " Using Go..."
50+ go install github.com/rhysd/actionlint/cmd/actionlint@latest
51+ else
52+ echo " ❌ Neither Homebrew nor Go is available. Please install actionlint manually:"
53+ echo " brew install actionlint"
54+ echo " or"
55+ echo " go install github.com/rhysd/actionlint/cmd/actionlint@latest"
56+ echo " "
57+ echo " Note: actionlint is optional but recommended for linting GitHub Actions workflows"
58+ fi
59+
60+ if command -v actionlint & > /dev/null; then
61+ echo " ✅ actionlint installed successfully"
62+ fi
63+ else
64+ echo " ✅ actionlint is already installed ($( actionlint -version 2>&1 | head -n1) )"
65+ fi
66+
4067# Install Lefthook git hooks
4168echo " 🔗 Installing git hooks..."
4269lefthook install
You can’t perform that action at this time.
0 commit comments