Skip to content

Commit

Permalink
Skip building the linter runner analysis cache if the cache was succe…
Browse files Browse the repository at this point in the history
…ssfully restored

Signed-off-by: Alper Rifat Ulucinar <[email protected]>
  • Loading branch information
ulucinar committed Mar 6, 2024
1 parent 513ebf1 commit f80f0fe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ jobs:

- name: Cache Linter Analysis
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3
id: cache-analysis
with:
path: ${{ steps.go_cache.outputs.analysis_cache }}
key: ${{ steps.go_cache.outputs.analysis_cache_key }}
Expand All @@ -85,6 +86,5 @@ jobs:
- name: Lint
env:
GOLANGCI_LINT_CACHE: ${{ steps.go_cache.outputs.analysis_cache }}
run: |
echo ${GOLANGCI_LINT_CACHE} && \
make lint
SKIP_LINTER_ANALSIS: ${{ steps.cache-analysis.outputs.cache-hit }}
run: make lint
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ go.mod.cachedir:
@go env GOMODCACHE

go.lint.analysiskey-interval:
@echo golangci-lint.cache-$$(( $$(date +%s) / 604800 ))-
@echo -n golangci-lint.cache-$$(( $$(date +%s) / 604800 ))-

go.lint.analysiskey:
@echo $$(make go.lint.analysiskey-interval)$$(sha1sum go.mod | cut -d' ' -f1)
Expand All @@ -340,5 +340,8 @@ checkout-to-old-api:
lint.init: build-lint-cache

build-lint-cache: $(GOLANGCILINT)
./scripts/tag.sh && \
$(GOLANGCILINT) run -v --build-tags ec2,configregistry,configprovider,linter_run -v --concurrency 1
@$(INFO) Running golangci-lint with the analysis cache building phase.
@(./scripts/tag.sh && \
(([[ "${SKIP_LINTER_ANALSIS}" == "true" ]] && echo "Skipping analysis cache build phase because it's already been populated") && \
[[ "${SKIP_LINTER_ANALSIS}" == "true" ]] || $(GOLANGCILINT) run -v --build-tags ec2,configregistry,configprovider,linter_run -v --concurrency 1)) || $(FAIL)
@$(OK) Running golangci-lint with the analysis cache building phase.

0 comments on commit f80f0fe

Please sign in to comment.