Add agent-agnostic hook installation #49
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| jobs: | |
| test: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Install ALSA headers | |
| if: runner.os == 'Linux' | |
| run: sudo apt-get update && sudo apt-get install -y libasound2-dev | |
| - name: Vet | |
| run: go vet ./... | |
| - name: Test | |
| run: go test ./... -v -count=1 | |
| - name: Build | |
| run: go build -o claudio ./cmd/claudio | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Install ALSA headers | |
| run: sudo apt-get update && sudo apt-get install -y libasound2-dev | |
| - uses: golangci/golangci-lint-action@v6 | |
| build-nocgo: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Build without CGO | |
| env: | |
| CGO_ENABLED: "0" | |
| run: go build ./... | |
| coverage: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| # These packages have no cgo dependency, so no ALSA headers are needed. | |
| - name: Enforce coverage floor | |
| run: | | |
| THRESHOLD=91.0 | |
| status=0 | |
| for pkg in ./internal/hooks ./internal/install; do | |
| line=$(go test "$pkg" -count=1 -cover) | |
| pct=$(echo "$line" | grep -oE 'coverage: [0-9.]+%' | grep -oE '[0-9.]+') | |
| if [ -z "$pct" ]; then | |
| echo "FAIL: could not parse coverage for $pkg" | |
| echo "$line" | |
| status=1 | |
| continue | |
| fi | |
| if awk -v p="$pct" -v t="$THRESHOLD" 'BEGIN { exit !(p+0 >= t+0) }'; then | |
| echo "OK: $pkg coverage ${pct}% (floor ${THRESHOLD}%)" | |
| else | |
| echo "FAIL: $pkg coverage ${pct}% below floor ${THRESHOLD}%" | |
| status=1 | |
| fi | |
| done | |
| exit $status |