name: CI on: push: branches: [main] paths: - '**.go' - 'go.mod' - 'go.sum' - '.golangci.yml' - 'Makefile' - '.github/workflows/**' - '!**.md' - '!docs/**' - '!LICENSE' pull_request: paths: - '**.go' - 'go.mod' - 'go.sum' - '.golangci.yml' - 'Makefile' - '.github/workflows/**' - '!**.md' - '!docs/**' - '!LICENSE' jobs: lint: name: Lint runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version: stable - name: Cache Go modules uses: actions/cache@v4 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go-mod- - name: Run golangci-lint uses: golangci/golangci-lint-action@v7 with: version: latest test: name: Test runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version: stable - name: Cache Go modules uses: actions/cache@v4 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go-mod- - name: Cache Go build cache uses: actions/cache@v4 with: path: ~/.cache/go-build key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go-build- - name: Run tests run: go test -race -v ./...