reduce potential lock contention; avoid goroutine leak #420
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: Go CI | |
on: | |
- push | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 3 | |
- name: Setup Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ^1 | |
- run: go test ./... | |
- name: Release | |
run: | | |
DATE=$(date --rfc-3339=seconds) | |
GOVERSION=$(go version) | |
VERSION=$(git describe --abbrev=8 --dirty --always --long) | |
COMMIT_TITLE=$(git log -1 --pretty=format:%s) | |
PREFIX="github.com/hexops/wrench/internal/wrench" | |
LDFLAGS="-X '$PREFIX.Version=$VERSION'" | |
LDFLAGS="$LDFLAGS -X '$PREFIX.CommitTitle=$COMMIT_TITLE'" | |
LDFLAGS="$LDFLAGS -X '$PREFIX.Date=$DATE'" | |
LDFLAGS="$LDFLAGS -X '$PREFIX.GoVersion=$GOVERSION'" | |
RELEASE_NAME="release-$(git rev-parse --short HEAD)" | |
CGO_ENABLED=0 GOARCH="amd64" GOOS="linux" go build -ldflags "$LDFLAGS" -o wrench_linux_amd64 . | |
CGO_ENABLED=0 GOARCH="arm64" GOOS="linux" go build -ldflags "$LDFLAGS" -o wrench_linux_arm64 . | |
GOARCH="amd64" GOOS="windows" go build -ldflags "$LDFLAGS" -o wrench_windows_amd64 . | |
GOARCH="arm64" GOOS="windows" go build -ldflags "$LDFLAGS" -o wrench_windows_arm64 . | |
GOARCH="amd64" GOOS="darwin" go build -ldflags "$LDFLAGS" -o wrench_darwin_amd64 . | |
GOARCH="arm64" GOOS="darwin" go build -ldflags "$LDFLAGS" -o wrench_darwin_arm64 . | |
gh release create "$RELEASE_NAME" --title "Automatic release of main @ $(git rev-parse --short HEAD)" | |
gh release upload "$RELEASE_NAME" "wrench_linux_amd64" | |
gh release upload "$RELEASE_NAME" "wrench_linux_arm64" | |
gh release upload "$RELEASE_NAME" "wrench_windows_amd64" | |
gh release upload "$RELEASE_NAME" "wrench_windows_arm64" | |
gh release upload "$RELEASE_NAME" "wrench_darwin_amd64" | |
gh release upload "$RELEASE_NAME" "wrench_darwin_arm64" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |