From 68d4fb454f00bd04dd0389d48b42aa3dd68411b1 Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Mon, 24 Jan 2022 19:06:14 -0700 Subject: [PATCH] actions(test): fix caching, run tests with race detector --- .github/workflows/build-test.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index c6a2ec0..b3e7c67 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -32,17 +32,20 @@ jobs: go env printf "\n\nSystem Environment:\n\n" env - + printf "Git Version: $(git version)\n\n" echo "::set-output name=version_tag::${GITHUB_REF/refs\/tags\//}" echo "::set-output name=short_sha::$(git rev-parse --short HEAD)" echo "::set-output name=go_cache::$(go env GOCACHE)" + echo "::set-output name=go_mod_cache::$(go env GOMODCACHE)" - name: Build Cache uses: actions/cache@v2 with: - path: ${{ steps.env.outputs.go_cache }} - key: ${{ runner.os }}-${{ matrix.go }}-go-${{ hashFiles('**/go.sum') }} + key: ${{ runner.os }}-go${{ matrix.go }}-${{ hashFiles('**/go.sum') }} restore-keys: | - ${{ runner.os }}-${{ matrix.go }}-go + ${{ runner.os }}-go${{ matrix.go }}- + path: | + ${{ steps.env.outputs.go_cache }} + ${{ steps.env.outputs.go_mod_cache }} - name: Get Dependencies run: | go get -v -t -d ./... @@ -56,8 +59,10 @@ jobs: go build -v -trimpath -ldflags="-s -w -X ${SRC_PATH}/system.Version=dev-${GIT_COMMIT:0:7}" -o build/wings_${{ matrix.goos }}_${{ matrix.goarch }} wings.go upx build/wings_${{ matrix.goos }}_${{ matrix.goarch }} chmod +x build/wings_${{ matrix.goos }}_${{ matrix.goarch }} - - name: Test + - name: Tests run: go test ./... + - name: Tests (Race) + run: go test -race ./... - name: Upload Artifact uses: actions/upload-artifact@v2 if: ${{ github.ref == 'refs/heads/develop' || github.event_name == 'pull_request' }}