From 25d25ca722f1adc93d458834d7400a350c8793e0 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Thu, 15 Feb 2024 20:29:09 +0530 Subject: [PATCH] no longer need to run the linter in Docker --- .github/workflows/lint.yml | 68 ++++++++++++++++++++++++-------------- Makefile | 47 -------------------------- 2 files changed, 43 insertions(+), 72 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1db229d..2e99142 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,37 +1,55 @@ -name: Lint +name: golangci-lint on: push: branches: + - master - main pull_request: - merge_group: + +permissions: + contents: read + # Optional: allow read access to pull request. Use with `only-new-issues` option. + # pull-requests: read jobs: golangci: - # We need to run the linter on the same image we use for building, since it - # needs the C libraries installed for the dependencies to typecheck. + name: lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Set up Docker Build - uses: docker/setup-buildx-action@v3.0.0 - with: - driver: docker - - - name: Build Docker image - uses: docker/build-push-action@v5 - with: - context: ./tools - file: ./tools/Dockerfile - tags: "cometbft/cometbft-db-testing:latest" - load: true - - - - name: Run golangci-lint - run: make docker-lint + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version: '1.22' + cache: false + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + # Require: The version of golangci-lint to use. + # When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version. + # When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit. + version: v1.56 + + # Optional: working directory, useful for monorepos + # working-directory: somedir + + # Optional: golangci-lint command line arguments. + # + # Note: By default, the `.golangci.yml` file should be at the root of the repository. + # The location of the configuration file can be changed by using `--config=` + # args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0 + + # Optional: show only new issues if it's a pull request. The default value is `false`. + # only-new-issues: true + + # Optional: if set to true, then all caching functionality will be completely disabled, + # takes precedence over all other caching options. + # skip-cache: true + + # Optional: if set to true, then the action won't cache or restore ~/go/pkg. + # skip-pkg-cache: true + # Optional: if set to true, then the action won't cache or restore ~/.cache/go-build. + # skip-build-cache: true + # Optional: The mode to install golangci-lint. It can be 'binary' or 'goinstall'. + # install-mode: "goinstall" \ No newline at end of file diff --git a/Makefile b/Makefile index 2a38065..759e834 100644 --- a/Makefile +++ b/Makefile @@ -19,34 +19,6 @@ test: @go test $(PACKAGES) -v .PHONY: test -test-cleveldb: - @echo "--> Running go test" - @go test $(PACKAGES) -tags cleveldb -v -.PHONY: test-cleveldb - -test-rocksdb: - @echo "--> Running go test" - @go test $(PACKAGES) -tags rocksdb -v -.PHONY: test-rocksdb - -test-boltdb: - @echo "--> Running go test" - @go test $(PACKAGES) -tags boltdb -v -.PHONY: test-boltdb - -test-badgerdb: - @echo "--> Running go test" - @go test $(PACKAGES) -tags badgerdb -v -.PHONY: test-badgerdb - -test-pebble: - @echo "--> Running go test" - @go test $(PACKAGES) -tags pebbledb -v - -test-all: - @echo "--> Running go test" - @go test $(PACKAGES) -tags cleveldb,boltdb,rocksdb,grocksdb_clean_link,badgerdb,pebbledb -v -.PHONY: test-all test-all-with-coverage: @echo "--> Running go test for all databases, with coverage" @@ -56,7 +28,6 @@ test-all-with-coverage: -race \ -coverprofile=coverage.txt \ -covermode=atomic \ - -tags=memdb,goleveldb,cleveldb,boltdb,rocksdb,grocksdb_clean_link,badgerdb,pebbledb \ -v .PHONY: test-all-with-coverage @@ -78,25 +49,7 @@ docker-test-image: .PHONY: docker-test-image # Runs the same test as is executed in CI, but locally. -docker-test: - @echo "--> Running all tests with all databases with Docker (interactive flags: \"$(DOCKER_TEST_INTERACTIVE_FLAGS)\")" - @docker run $(DOCKER_TEST_INTERACTIVE_FLAGS) --rm --name cometbft-db-test \ - -v `pwd`:/cometbft \ - -w /cometbft \ - --entrypoint "" \ - $(DOCKER_TEST_IMAGE):$(DOCKER_TEST_IMAGE_VERSION) \ - make test-all-with-coverage -.PHONY: docker-test -docker-lint: - @echo "--> Running all tests with all databases with Docker (interactive flags: \"$(DOCKER_TEST_INTERACTIVE_FLAGS)\")" - @docker run $(DOCKER_TEST_INTERACTIVE_FLAGS) --rm --name cometbft-db-test \ - -v `pwd`:/cometbft \ - -w /cometbft \ - --entrypoint "" \ - $(DOCKER_TEST_IMAGE):$(DOCKER_TEST_IMAGE_VERSION) \ - golangci-lint run ./... -.PHONY: docker-test tools: go get -v $(GOTOOLS)