-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from cashapp/gotip
Build and release gotip.
- Loading branch information
Showing
9 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
on: | ||
push: | ||
branches: | ||
- gotip | ||
schedule: | ||
# * is a special character in YAML so you have to quote this string | ||
- cron: '0 12 * * *' | ||
jobs: | ||
gotip: | ||
name: Build Go Tip | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
arch: [arm64, amd64] | ||
os: [linux, darwin] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Init Hermit | ||
run: ./bin/hermit env --raw >> $GITHUB_ENV | ||
- name: Build Go | ||
run: make GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} -C gotip | ||
- name: Upload Release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
tag: gotip | ||
allowUpdates: true | ||
artifacts: "gotip/go-*.tbz" | ||
token: ${{ secrets.GITHUB_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
gotip/goroot | ||
gotip/go-* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hermit |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hermit |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.go@latest.pkg |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/bin/bash | ||
# | ||
# | ||
# This script generates stub scripts for every Go "main" package in this | ||
# repository. These stubs execute the corresponding main package via "go run". | ||
# | ||
|
||
set -euo pipefail | ||
|
||
usage() { | ||
echo "$(basename $0) [-c] -- create or clean Go main stub scripts" | ||
exit 1 | ||
} | ||
|
||
bindir="$(dirname $0)" | ||
root="$(dirname "${bindir}")" | ||
|
||
clean() { | ||
grep -l "^# go-main-stubs stub script" "${bindir}"/* | grep -v bin/go-main-stubs | xargs rm || true | ||
} | ||
|
||
while getopts ":hc" arg; do | ||
case $arg in | ||
c) | ||
echo "Cleaning old stubs" | ||
clean | ||
exit 0 | ||
;; | ||
h | *) | ||
usage | ||
exit 0 | ||
;; | ||
esac | ||
done | ||
|
||
clean | ||
|
||
echo "Creating Go main stubs in ${bindir}" | ||
|
||
echo -n . | ||
|
||
for main in $(cd "${root}" && go list -f '{{if eq "main" .Name}}{{.ImportPath}}{{end}}' ./...); do | ||
stub_script="${bindir}/$(basename $main)" | ||
cat << EOF > ${stub_script} | ||
#!/bin/bash | ||
# go-main-stubs stub script | ||
exec "\$(dirname \$0)/go" run $main "\$@" | ||
EOF | ||
chmod +x "${stub_script}" | ||
echo -n . | ||
done | ||
echo |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.go@latest.pkg |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.make-4.3.pkg |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export GOOS ?= $(shell go env GOOS) | ||
export GOARCH ?= $(shell go env GOARCH) | ||
|
||
BOOTSTRAP = go-$(GOOS)-$(GOARCH)-bootstrap | ||
OUT = go-tip-$(GOOS)-$(GOARCH).tbz | ||
|
||
gotip: clean | ||
if test -d goroot; then \ | ||
cd goroot && git pull; \ | ||
else \ | ||
git clone --depth=1 https://go.googlesource.com/go goroot; \ | ||
fi | ||
cd goroot/src && ./bootstrap.bash | ||
mv $(BOOTSTRAP).tbz $(OUT) | ||
|
||
clean: | ||
rm -rf $(BOOTSTRAP).tbz $(BOOTSTRAP) |