Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: disable cache for golangci-lint #537

Merged
merged 1 commit into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
66 changes: 43 additions & 23 deletions .github/workflows/gotest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,51 @@ jobs:
make check-commits
working-directory: code

linting:
name: "🎯 Code format, imports and style"
build:
name: "🛠️ Go Build"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_SVR }}
cache: true
- name: Build all artifacts
run: |
make check-system-go build GO=go

lint:
name: "🎯 Code format & OpenAPI lint"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_SVR }}
# disabled until 'lookup-only' is implemented for setup-go or cache prefix is added
cache: false
- 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 check-fmt validate GO=go

golint:
name: "🎯 Go linter"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_SVR }}
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
Expand All @@ -52,6 +89,8 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_SVR }}
# disabled until 'lookup-only' is implemented for setup-go or cache prefix is added
cache: false
- run: |
make check-system-go test GO=go

Expand Down Expand Up @@ -88,31 +127,12 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_SVR }}
# disabled until 'lookup-only' is implemented for setup-go or cache prefix is added
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