Merge pull request #14470 from serathius/verify-update

makefile: Make static analysis commands easier to use
dependabot/go_modules/go.uber.org/atomic-1.10.0
Sahdev Zala 2022-09-16 12:02:37 -04:00 committed by GitHub
commit 72912fbc20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 34 deletions

View File

@ -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

View File

@ -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.

View File

@ -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