diff --git a/.github/workflows/static-analysis.yaml b/.github/workflows/static-analysis.yaml index e1faa91bc..a6dcdb612 100644 --- a/.github/workflows/static-analysis.yaml +++ b/.github/workflows/static-analysis.yaml @@ -3,11 +3,6 @@ on: [push, pull_request] jobs: run: runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - target: - - linux-amd64-fmt steps: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 @@ -17,17 +12,4 @@ jobs: uses: golangci/golangci-lint-action@v3 with: version: v1.49.0 - - run: date - - env: - TARGET: ${{ matrix.target }} - run: | - echo "${TARGET}" - case "${TARGET}" in - linux-amd64-fmt) - GOARCH=amd64 PASSES='fmt bom dep' ./scripts/test.sh - ;; - *) - echo "Failed to find target" - exit 1 - ;; - esac + - run: make verify \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7d84fed9a..8a22d5266 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -64,10 +64,11 @@ Setup environment: etcd code should follow coding style suggested by the Golang community. See the [style doc](https://github.com/golang/go/wiki/CodeReviewComments) for details. -Please ensure that your change passes static analysis: -- `make test-fmt` to format code. -- `make lint` to run linter (requires [golangci-lint](https://golangci-lint.run/usage/install/)) -- `make lint-fix` to fix linter errors (requires [golangci-lint](https://golangci-lint.run/usage/install/)) +Please ensure that your change passes static analysis (requires [golangci-lint](https://golangci-lint.run/usage/install/)): +- `make verify` to verify if all checks pass. +- `make verify-*` to verify a single check, for example `make verify-bom` to verify if bill-of-materials.json file is up-to-date. +- `make update` to fix all checks. +- `make update-*` to fix a single checks, for example `make update-bom` to update bill-of-materials.json. Please ensure that your change passes tests. - `make test-unit` to run unit tests. diff --git a/Makefile b/Makefile index 5a1b95a28..330aca737 100644 --- a/Makefile +++ b/Makefile @@ -5,13 +5,11 @@ build: ./bin/etcdctl version ./bin/etcdutl version -.PHONY: test-fmt -test-fmt: - PASSES="fmt" ./scripts/test.sh +# Tests -.PHONY: test-bom -test-bom: - PASSES="bom" ./scripts/test.sh +.PHONY: test +test: + PASSES="unit integration release e2e" ./scripts/test.sh .PHONY: test-unit test-unit: @@ -29,16 +27,45 @@ test-e2e: build test-e2e-release: build PASSES="release e2e" ./scripts/test.sh -.PHONY: test-all -test-all: - PASSES="fmt bom dep unit integration release e2e" ./scripts/test.sh +# Static analysis -lint: +verify: verify-fmt verify-bom verify-lint verify-dep +update: update-bom update-lint update-dep update-fix + +.PHONY: verify-fmt +verify-fmt: + PASSES="fmt" ./scripts/test.sh + +.PHONY: verify-bom +verify-bom: + PASSES="bom" ./scripts/test.sh + +.PHONY: update-bom +update-bom: + ./scripts/updatebom.sh + +.PHONY: verify-dep +verify-dep: + PASSES="dep" ./scripts/test.sh + +.PHONY: update-dep +update-dep: + ./scripts/update_dep.sh + +.PHONY: verify-lint +verify-lint: golangci-lint run -lint-fix: +.PHONY: update-lint +update-lint: golangci-lint run --fix +.PHONY: update-fix +update-fix: + ./scripts/fix.sh + +# Cleanup + clean: rm -f ./codecov rm -rf ./covdir