Add caching to build-test workflow
This commit is contained in:
parent
3f2ce59766
commit
c01a39d881
31
.github/workflows/build-test.yml
vendored
31
.github/workflows/build-test.yml
vendored
|
@ -13,7 +13,7 @@ jobs:
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
os: [ ubuntu-20.04 ]
|
os: [ ubuntu-20.04 ]
|
||||||
go: [ 1.15.5 ]
|
go: [ 1.15.6 ]
|
||||||
goos: [ linux ]
|
goos: [ linux ]
|
||||||
goarch: [ amd64, arm, arm64 ]
|
goarch: [ amd64, arm, arm64 ]
|
||||||
|
|
||||||
|
@ -26,13 +26,40 @@ jobs:
|
||||||
with:
|
with:
|
||||||
go-version: ${{ matrix.go }}
|
go-version: ${{ matrix.go }}
|
||||||
|
|
||||||
|
- name: Print Environment
|
||||||
|
id: env
|
||||||
|
run: |
|
||||||
|
printf "Go Executable Path: $(which go)\n"
|
||||||
|
printf "Go Version: $(go version)\n"
|
||||||
|
printf "\n\nGo Environment:\n\n"
|
||||||
|
go env
|
||||||
|
printf "\n\nSystem Environment:\n\n"
|
||||||
|
env
|
||||||
|
|
||||||
|
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)"
|
||||||
|
|
||||||
|
- name: Build Cache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.env.outputs.go_cache }}
|
||||||
|
key: ${{ runner.os }}-${{ matrix.go }}-go-${{ hashFiles('**/go.sum') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-${{ matrix.go }}-go
|
||||||
|
|
||||||
|
- name: Get Dependencies
|
||||||
|
run: |
|
||||||
|
go get -v -t -d ./...
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
env:
|
env:
|
||||||
GOOS: ${{ matrix.goos }}
|
GOOS: ${{ matrix.goos }}
|
||||||
GOARCH: ${{ matrix.goarch }}
|
GOARCH: ${{ matrix.goarch }}
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
|
SRC_PATH: github.com/pterodactyl/wings
|
||||||
run: |
|
run: |
|
||||||
go build -v -ldflags="-s -w -X github.com/pterodactyl/wings/system.Version=dev-${GIT_COMMIT:0:7}" -o build/wings_${{ matrix.goos }}_${{ matrix.goarch }} wings.go
|
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
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: go test ./...
|
run: go test ./...
|
||||||
|
|
Loading…
Reference in New Issue
Block a user