Update Makefile #7
  
    
      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: [ main, master ] | |
| pull_request: | |
| branches: [ "**" ] | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-test: | |
| name: Lint, unit tests, vuln scan | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| env: | |
| # Ensure we build with the repo’s Go; helpful if using toolchain directives. | |
| GOTOOLCHAIN: local | |
| # Default: run vuln scan in CI. | |
| SKIP_VULN: "0" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| cache: false # we’ll use explicit caches below | |
| - name: Cache Go modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/go/pkg/mod | |
| key: ${{ runner.os }}-gomod-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gomod- | |
| - name: Print Go env | |
| run: | | |
| go version | |
| go env | |
| - name: Clean Go build cache (defensive) | |
| run: go clean -cache -testcache | |
| - name: Install golangci-lint | |
| run: | | |
| golangci-lint cache clean || true | |
| GOBIN=$HOME/.local/bin GOTOOLCHAIN=local \ | |
| go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.2 | |
| echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| golangci-lint version | |
| - name: Make check (fmt, tidy, lint, unit tests, govulncheck) | |
| run: make check | |
| - name: Upload coverage (if produced) | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage.out | |
| path: coverage.out | |
| if-no-files-found: ignore | |
| e2e: | |
| name: E2E (WebSocket + metrics) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| needs: build-test | |
| env: | |
| GOTOOLCHAIN: local | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| cache: false | |
| - name: Cache Go modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/go/pkg/mod | |
| key: ${{ runner.os }}-gomod-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gomod- | |
| - name: Clean Go build cache (defensive) | |
| run: go clean -cache -testcache | |
| - name: Install golangci-lint | |
| run: | | |
| golangci-lint cache clean || true | |
| GOBIN=$HOME/.local/bin GOTOOLCHAIN=local \ | |
| go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.2 | |
| echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| golangci-lint version | |
| - name: Run E2E tests | |
| run: make test-e2e | |
| - name: Upload test logs on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: e2e-logs | |
| path: | | |
| **/*.test | |
| **/*.log | |
| **/testdata/** | |
| if-no-files-found: ignore |