Last active
March 7, 2020 09:00
-
-
Save markbates/e8824c5648edcf6f23c16b95960eef19 to your computer and use it in GitHub Desktop.
Run Go tests in Windows, Mac, Linux. Go version 1.12/1.13 both with Modules and GOPATH.
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: Release | |
on: | |
release: | |
types: | |
- published | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Set up Go 1.13 | |
uses: actions/setup-go@v1 | |
with: | |
go-version: 1.13 | |
id: go | |
- | |
name: Checkout | |
uses: actions/checkout@master | |
- | |
name: Run GoReleaser | |
env: | |
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }} | |
uses: goreleaser/goreleaser-action@v1 | |
with: | |
version: latest | |
args: release --rm-dist |
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: Tests | |
on: [push] | |
jobs: | |
tests-on: | |
name: ${{matrix.go-version}} ${{matrix.os}} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
go-version: [1.12.x, 1.13.x] | |
os: [macos-latest, windows-latest, ubuntu-latest] | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v1 | |
with: | |
fetch-depth: 1 | |
- name: Test | |
run: | | |
go mod tidy -v | |
go test -race ./... | |
tests-off: | |
name: (GOPATH) ${{matrix.go-version}} ${{matrix.os}} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
go-version: [1.12.x, 1.13.x] | |
os: [macos-latest, windows-latest, ubuntu-latest] | |
env: | |
GO111MODULE: off | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v1 | |
with: | |
fetch-depth: 1 | |
path: src/github.com/${{ github.repository }} | |
- name: Test | |
env: | |
GOPATH: ${{runner.workspace}} | |
run: | | |
go get -t -v ./... | |
go test -race ./... |
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
builds: | |
- | |
main: ./cmd/widget/main.go | |
env: | |
- CGO_ENABLED=0 | |
ldflags: | |
- -s -w -X "github.com/markbates/widget.Version={{.Tag}}" | |
goos: | |
- darwin | |
- linux | |
- windows | |
goarch: | |
- amd64 | |
- 386 | |
- arm | |
- arm64 | |
goarm: | |
- 6 | |
- 7 | |
archives: | |
- | |
replacements: | |
'386': i386 | |
darwin: Darwin | |
linux: Linux | |
windows: Windows | |
amd64: x86_64 | |
checksum: | |
name_template: checksums.txt | |
snapshot: | |
name_template: '{{ .Tag }}-next' | |
changelog: | |
sort: asc | |
filters: | |
exclude: | |
- '^docs:' | |
- '^test:' | |
brews: | |
- | |
name: 'widget' | |
github: | |
owner: 'markbates' | |
name: 'homebrew-tap' | |
install: | | |
bin.install "widget" |
Just what I was looking for. Thanks.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
GITHUB_TOKEN
included by default only works with the current repo. If you're publishing home-brew, or something else, to a different repo you need a better token. Create one and then set it in theSecrets
part of your project and set the envGORELEASER_GITHUB_TOKEN
to the stronger token.