diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..541aba9 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,36 @@ +name: Lint + +on: + push: + branches: [ master ] + pull_request: + +env: + GOLANGCI_LINT_VERSION: v1.61.0 + +jobs: + lint: + name: lint + strategy: + matrix: + os: [ ubuntu-latest ] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version-file: ./go.mod + cache: true # caching and restoring go modules and build outputs + + - name: Check that 'go mod tidy' was called before commit + run: go mod tidy && git diff --exit-code + + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: ${{ env.GOLANGCI_LINT_VERSION }} + skip-cache: true # cache/restore is done by actions/setup-go@v3 step + args: -v diff --git a/.github/workflows/on-pull-request.yml b/.github/workflows/on-pull-request.yml new file mode 100644 index 0000000..01ab56d --- /dev/null +++ b/.github/workflows/on-pull-request.yml @@ -0,0 +1,46 @@ +name: On Pull Request + +on: + push: + branches: + - master + - main + pull_request: + branches: + - master + - main + +jobs: + test: + name: test + strategy: + matrix: + go-version: + - 1.23.x + os: [ ubuntu-latest ] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Fetch git tags + run: git fetch --tags + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go-version }} + + - name: Cache deps + uses: actions/cache@v4 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Install deps + run: go mod download + + - name: Test + run: go test -timeout 10m -v -p=1 -count=1 -race -tags clock_mutex \ No newline at end of file diff --git a/Makefile b/Makefile index 4d0d581..edc157b 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ .DEFAULT_GOAL := build LINT = $(GOPATH)/bin/golangci-lint -LINT_VERSION = 1.56.2 +LINT_VERSION = v1.61.0 $(LINT): ## Download Go linter curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin $(LINT_VERSION)