Skip to content

Commit

Permalink
fix(ci): Run "build", "vet", and "mod tidy" for all submodules (#577)
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyo committed Feb 7, 2023
1 parent edd4aa2 commit f03b31a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Expand Up @@ -42,11 +42,11 @@ jobs:
${{ runner.os }}-go-${{ matrix.go }}-
${{ runner.os }}-go-
- name: Build
run: go build ./...
run: make build
- name: Vet
run: go vet ./...
run: make vet
- name: Check go.mod Tidiness
run: go mod tidy -go=1.19 -compat=1.17 && git diff --exit-code
run: make mod-tidy
if: ${{ matrix.go == '1.19' }}
- name: Test
run: make test
Expand Down
21 changes: 19 additions & 2 deletions Makefile
Expand Up @@ -12,7 +12,11 @@ help: ## Show help
.PHONY: help

build: ## Build everything
go build ./...
for dir in $(ALL_GO_MOD_DIRS); do \
cd "$${dir}"; \
echo ">>> Running 'go build' for module: $${dir}"; \
go build ./...; \
done;
.PHONY: build

### Tests (inspired by https://github.com/open-telemetry/opentelemetry-go/blob/main/Makefile)
Expand Down Expand Up @@ -50,8 +54,21 @@ test-coverage: $(COVERAGE_REPORT_DIR) clean-report-dir ## Test with coverage en
done;
.PHONY: test-coverage clean-report-dir

mod-tidy: ## Check go.mod tidiness
for dir in $(ALL_GO_MOD_DIRS); do \
cd "$${dir}"; \
echo ">>> Running 'go mod tidy' for module: $${dir}"; \
go mod tidy -go=1.19 -compat=1.17; \
done; \
git diff --exit-code;
.PHONY: mod-tidy

vet: ## Run "go vet"
go vet ./...
for dir in $(ALL_GO_MOD_DIRS); do \
cd "$${dir}"; \
echo ">>> Running 'go vet' for module: $${dir}"; \
go vet ./...; \
done;
.PHONY: vet

lint: ## Lint (using "golangci-lint")
Expand Down

0 comments on commit f03b31a

Please sign in to comment.