Skip to content

Commit

Permalink
build: use own liter
Browse files Browse the repository at this point in the history
Signed-off-by: Lukáš Zapletal <[email protected]>
  • Loading branch information
lzap committed May 17, 2023
1 parent 52b4bc0 commit d7d03ba
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 28 deletions.
43 changes: 17 additions & 26 deletions .github/workflows/gotest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,26 @@ jobs:
working-directory: code
linting:
name: "🎯 Code format, imports and style"
name: "🎯 Code and OpenAPI validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_SVR }}
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
cache: true
- uses: actions/cache@v3
id: cache
with:
# https://github.com/golangci/golangci-lint-action/issues/535
version: v1.52.2
path: bin
key: bin-go${{ env.GO_SVR }}-tools-${{ hashFiles('mk/tools.mk') }}
- name: Install Go Tools
if: steps.cache.outputs.cache-hit != 'true'
run: make install-tools GO=go
- name: Generate and validate
run: |
touch config/_config.yaml
make check-system-go build lint check-fmt validate GO=go
testing:
name: "📎 Unit tests"
Expand All @@ -52,6 +60,8 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_SVR }}
# disabled until 'lookup-only' is implemented for setup-go
cache: false
- run: |
make check-system-go test GO=go
Expand Down Expand Up @@ -88,31 +98,12 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_SVR }}
# disabled until 'lookup-only' is implemented for setup-go
cache: false
- name: "Run tests"
env:
DATABASE_USER: postgres
DATABASE_PASSWORD: foobar
DATABASE_NAME: provisioning_test
WORKER_QUEUE: redis
run: make check-system-go integration-test check-migrations GO=go

openapi:
name: "🪆 Generated code diff check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_SVR }}
- uses: actions/cache@v3
id: cache
with:
path: bin
key: bin-go${{ env.GO_SVR }}-tools-${{ hashFiles('mk/tools.mk') }}
- name: Install Go Tools
if: steps.cache.outputs.cache-hit != 'true'
run: make install-tools GO=go
- name: Generate and validate
run: |
touch config/_config.yaml
make check-system-go validate GO=go
6 changes: 5 additions & 1 deletion mk/code.mk
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ check-commits: ## Check commit format
.PHONY: fmt ## Alias to perform all code formatting and linting
fmt: format imports lint

.PHONY: check ## Alias to perform all checking (commits, migrations)
.PHONY: check-fmt ## Reformat the code and check git diff
check-fmt: format imports
git diff --exit-code

.PHONY: check ## Alias to perform commit message and migration checking
check: check-commits check-migrations

1 change: 0 additions & 1 deletion mk/tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ install-go: ## Install required Go version
# Update GitHub Workflows when changing this
.PHONY: install-tools
install-tools: ## Install required Go commands into ./bin
@# NOTE: also update .github/workflows version
GOBIN=$(GOBIN) $(GO) install github.com/golangci/golangci-lint/cmd/[email protected]
GOBIN=$(GOBIN) $(GO) install golang.org/x/tools/cmd/[email protected]
GOBIN=$(GOBIN) $(GO) install github.com/jackc/tern/[email protected]
Expand Down

0 comments on commit d7d03ba

Please sign in to comment.