cache tools to speed up installs #47
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & Test | |
"on": | |
push: | |
branches: | |
- "*" | |
pull_request: | |
branches: | |
- "*" | |
schedule: | |
- cron: 01 13 * * SAT | |
jobs: | |
build: | |
name: Build & Test | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- macOS-latest | |
- windows-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@3b9b8c884f6b4bb4d5be2779c26374abadae0871 | |
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed | |
with: | |
go-version: stable | |
- uses: cue-lang/[email protected] | |
with: | |
version: latest | |
- uses: golangci/[email protected] | |
with: | |
version: latest | |
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 | |
with: | |
path: | | |
~/go/bin | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-tools-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go-tools- | |
compression-level: 0 | |
- name: Install Tools | |
run: | | |
go install golang.org/x/tools/cmd/goimports@latest | |
go install mvdan.cc/gofumpt@latest | |
go install github.com/segmentio/golines@latest | |
go install github.com/incu6us/goimports-reviser/v3@latest | |
- name: Set GOVERSION environment variable (Linux/macOS) | |
if: runner.os != 'Windows' | |
run: echo "GOVERSION=$(go version)" >> $GITHUB_ENV | |
- name: Set GOVERSION environment variable (Windows) | |
if: runner.os == 'Windows' | |
run: echo "GOVERSION=$(go version)" | Out-File -FilePath $env:GITHUB_ENV -Append | |
- name: Build and Test | |
run: | | |
make build | |
make test | |
- name: Run GoReleaser | |
if: runner.os == 'Linux' | |
uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf | |
with: | |
args: release --snapshot --skip=publish --clean | |
- name: Colored Output Test | |
if: runner.os == 'Linux' | |
shell: script -q -e -c "bash {0}" | |
run: go run main.go -- main.go |