From 27cbeadab4ae1f0d87dbaa9122366e77500fd27a Mon Sep 17 00:00:00 2001 From: Sam Sheffield Date: Thu, 25 Jul 2024 15:28:58 -0400 Subject: [PATCH] update --- .github/workflows/ci-lint.yml | 41 ++++------------------------------- Makefile | 5 +++++ 2 files changed, 9 insertions(+), 37 deletions(-) diff --git a/.github/workflows/ci-lint.yml b/.github/workflows/ci-lint.yml index b90e2c0512..347a33a905 100644 --- a/.github/workflows/ci-lint.yml +++ b/.github/workflows/ci-lint.yml @@ -12,6 +12,10 @@ jobs: uses: ./.github/workflows/proto.yml golangci-lint: runs-on: ubuntu-latest + permissions: + contents: read # to download code coverage results from unit_tests job + pull-requests: write # write permission needed to comment on PR + checks: write steps: - name: Checkout code uses: actions/checkout@v4 @@ -43,40 +47,3 @@ jobs: uses: cosmos/gosec@master with: args: ./... - golang-test: - runs-on: ubuntu-latest -# if: | -# contains(steps.changed-files.outputs.changed_files, '.go') || -# contains(steps.changed-files.outputs.changed_files, 'go.sum') || -# ( -# contains(steps.changed-files.outputs.changed_files, '.yml') || -# contains(steps.changed-files.outputs.changed_files, '.yaml') -# ) -# && -# ( -# contains(steps.changed-files.outputs.changed_files, 'app') || -# contains(steps.changed-files.outputs.changed_files, 'client') || -# contains(steps.changed-files.outputs.changed_files, 'cmd') || -# contains(steps.changed-files.outputs.changed_files, 'migrate') || -# contains(steps.changed-files.outputs.changed_files, 'tests') || -# contains(steps.changed-files.outputs.changed_files, 'x') -# ) - env: - COVERAGE_DIR: out/coverage/unit/go - COVERAGE_PATH: out/coverage/unit/go/cover.out - FORMATTED_REPORT: out/coverage/unit/go/go-unit-cover.out - HTML_REPORT: out/coverage/unit/go/go-unit-cover.html - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Install Go - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - cache-dependency-path: go.sum - - name: Go Test - run: | - mkdir -p ${{ env.COVERAGE_DIR }} - readarray -t test_dirs < <(find * -name "*_test.go" -exec dirname {} \; | sort | uniq | grep -v -e '^\.$') - half_nproc=$(( $(nproc --all) / 2 )) - printf '%s\0' "${test_dirs[@]}" | xargs -0 -P $half_nproc -n 1 -I {} go test "./{}" -race diff --git a/Makefile b/Makefile index 3ede6be40f..27195308c6 100644 --- a/Makefile +++ b/Makefile @@ -314,6 +314,11 @@ test-ibc: docker-build test: @$(GO_BIN) test $$($(GO_BIN) list ./... | grep -v 'contrib' | grep -v 'tests/e2e') +coverage: + @mkdir -p out + @$(GO_BIN) test -v -coverprofile=out/coverage.out $$($(GO_BIN) list ./... | grep -v 'contrib' | grep -v 'tests/e2e') + @$(GO_BIN) tool cover -html="out/coverage.out" + # Run cli integration tests # `-p 4` to use 4 cores, `-tags cli_test` to tell $(GO_BIN) not to ignore the cli package # These tests use the `kvd` or `kvcli` binaries in the build dir, or in `$BUILDDIR` if that env var is set.