From b74b9c2bf48aab225c9ca6041f9696a9ce34414e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zapletal?= Date: Wed, 17 May 2023 13:19:23 +0200 Subject: [PATCH] build: disable cache for golangci-lint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lukáš Zapletal --- .github/workflows/gotest.yml | 66 +++++++++++++++++++++++------------- mk/code.mk | 6 +++- 2 files changed, 48 insertions(+), 24 deletions(-) diff --git a/.github/workflows/gotest.yml b/.github/workflows/gotest.yml index 3b0f4407..fddcd08f 100644 --- a/.github/workflows/gotest.yml +++ b/.github/workflows/gotest.yml @@ -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: @@ -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 @@ -88,6 +127,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 - name: "Run tests" env: DATABASE_USER: postgres @@ -95,24 +136,3 @@ jobs: 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 diff --git a/mk/code.mk b/mk/code.mk index 2d47a06a..5cb6bb38 100644 --- a/mk/code.mk +++ b/mk/code.mk @@ -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