Skip to content

Commit 09d8f9e

Browse files
committed
Align prebuild cache flags
1 parent 65081e2 commit 09d8f9e

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

.github/actions/prepare-go/action.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,32 @@ runs:
7979
key: go-${{ runner.os }}${{ runner.arch }}-${{ steps.setup-go.outputs.go-version }}-build-${{ env.COMMIT }}
8080
restore-keys: |
8181
go-${{ runner.os }}${{ runner.arch }}-${{ steps.setup-go.outputs.go-version }}-build-
82+
83+
- name: Print cache status
84+
shell: bash
85+
env:
86+
BUILD_CACHE_HIT: ${{ steps.restore-build.outputs.cache-hit }}
87+
BUILD_CACHE_MATCHED_KEY: ${{ steps.restore-build.outputs.cache-matched-key }}
88+
BUILD_CACHE_PRIMARY_KEY: ${{ steps.restore-build.outputs.cache-primary-key }}
89+
DEPENDENCY_CACHE_HIT: ${{ steps.restore-deps.outputs.cache-hit }}
90+
DEPENDENCY_CACHE_MATCHED_KEY: ${{ steps.restore-deps.outputs.cache-matched-key }}
91+
DEPENDENCY_CACHE_PRIMARY_KEY: ${{ steps.restore-deps.outputs.cache-primary-key }}
92+
TOOLS_CACHE_HIT: ${{ steps.restore-tools.outputs.cache-hit }}
93+
TOOLS_CACHE_MATCHED_KEY: ${{ steps.restore-tools.outputs.cache-matched-key }}
94+
TOOLS_CACHE_PRIMARY_KEY: ${{ steps.restore-tools.outputs.cache-primary-key }}
95+
run: |
96+
cache_status() {
97+
local hit="$1"
98+
local matched_key="$2"
99+
if [[ "$hit" == "true" ]]; then
100+
printf "exact"
101+
elif [[ -n "$matched_key" ]]; then
102+
printf "partial"
103+
else
104+
printf "miss"
105+
fi
106+
}
107+
108+
echo "::notice::Go dependency cache $(cache_status "$DEPENDENCY_CACHE_HIT" "$DEPENDENCY_CACHE_MATCHED_KEY") (key: $DEPENDENCY_CACHE_PRIMARY_KEY, matched: ${DEPENDENCY_CACHE_MATCHED_KEY:-none})"
109+
echo "::notice::Go tools cache $(cache_status "$TOOLS_CACHE_HIT" "$TOOLS_CACHE_MATCHED_KEY") (key: $TOOLS_CACHE_PRIMARY_KEY, matched: ${TOOLS_CACHE_MATCHED_KEY:-none})"
110+
echo "::notice::Go build cache $(cache_status "$BUILD_CACHE_HIT" "$BUILD_CACHE_MATCHED_KEY") (key: $BUILD_CACHE_PRIMARY_KEY, matched: ${BUILD_CACHE_MATCHED_KEY:-none})"

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ integration-test-coverage: prepare-coverage-test
533533

534534
# This should use the same build flags as functional-test-coverage and functional-test-{xdc,ndc}-coverage for best build caching.
535535
pre-build-functional-test-coverage: prepare-coverage-test
536-
go test -c -cover -o /dev/null $(FUNCTIONAL_TEST_ROOT) $(TEST_ARGS) $(TEST_TAG_FLAG) $(COVERPKG_FLAG)
536+
go test -c -cover -o /dev/null $(COMPILED_TEST_ARGS) $(COVERPKG_FLAG) $(FUNCTIONAL_TEST_ROOT)
537537

538538
functional-test-coverage: prepare-coverage-test
539539
@printf $(COLOR) "Run functional tests with coverage with $(PERSISTENCE_DRIVER) driver..."

0 commit comments

Comments
 (0)