actions(test): fix caching, run tests with race detector

This commit is contained in:
Matthew Penner 2022-01-24 19:06:14 -07:00
parent 136540111d
commit 68d4fb454f
No known key found for this signature in database
GPG Key ID: 31311906AD4CF6D6

View File

@ -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' }}