Improve hooks even more #25
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: Test and Lint | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| env: | |
| GO_VERSION: '1.24.5' | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| go: ['1.24.5'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ matrix.go }} | |
| - name: Cache Go modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/go/pkg/mod | |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go- | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Run tests | |
| run: | | |
| go test -v -race -coverprofile=coverage.out -covermode=atomic ./... | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: ./coverage.out | |
| flags: unittests | |
| name: codecov-umbrella | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Run golangci-lint | |
| uses: golangci/golangci-lint-action@v6 | |
| with: | |
| version: latest | |
| args: --timeout=5m | |
| - name: Install deadcode | |
| run: go install golang.org/x/tools/cmd/deadcode@latest | |
| - name: Run deadcode | |
| run: deadcode -test ./... | |
| build: | |
| name: Build | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| arch: [amd64, arm64] | |
| exclude: | |
| # Exclude arm64 on Linux for CI speed | |
| - os: ubuntu-latest | |
| arch: arm64 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Build binaries | |
| run: | | |
| GOOS=$(go env GOOS) GOARCH=${{ matrix.arch }} go build -v -o smart-lint-$(go env GOOS)-${{ matrix.arch }} ./cmd/smart-lint | |
| GOOS=$(go env GOOS) GOARCH=${{ matrix.arch }} go build -v -o smart-test-$(go env GOOS)-${{ matrix.arch }} ./cmd/smart-test | |
| GOOS=$(go env GOOS) GOARCH=${{ matrix.arch }} go build -v -o statusline-$(go env GOOS)-${{ matrix.arch }} ./cmd/statusline | |
| - name: Test binaries | |
| if: matrix.arch == 'amd64' # Only test on native architecture | |
| run: | | |
| ./smart-lint-$(go env GOOS)-${{ matrix.arch }} || true | |
| ./smart-test-$(go env GOOS)-${{ matrix.arch }} || true | |
| ./statusline-$(go env GOOS)-${{ matrix.arch }} || true | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cc-tools-${{ runner.os }}-${{ matrix.arch }} | |
| path: | | |
| smart-lint-* | |
| smart-test-* | |
| statusline-* |