Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
sesheffield committed Jul 25, 2024
1 parent 9a2b98a commit 27cbead
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 37 deletions.
41 changes: 4 additions & 37 deletions .github/workflows/ci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 27cbead

Please sign in to comment.