Merge pull request #529 from mritd/master

chore(go-task): support freebsd & windows build
This commit is contained in:
mritd 2022-12-09 18:03:30 +08:00 committed by GitHub
commit a95dcf0e39
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 109 additions and 7 deletions

3
.gitignore vendored
View file

@ -184,5 +184,6 @@ hy_linux
.vscode
/build/
/dist/
config*.json
config*.json

View file

@ -5,19 +5,25 @@ tasks:
cmds:
- rm -rf dist
- mkdir -p dist
hash:
dir: ./dist
cmds:
- sha256sum hysteria-* > hashes.txt
build-hysteria:
label: build-{{.TASK}}
vars:
BUILD_VERSION:
sh: git describe --tags
BUILD_COMMIT:
sh: git rev-parse HEAD
BUILD_DATE:
sh: date "+%Y%m%d%H%M%S"
sh: date -u '+%F %T'
dir: ./app/cmd/
cmds:
- |
GOOS={{.GOOS}} GOARCH={{.GOARCH}} GOARM={{.GOARM}} GOMIPS={{.GOMIPS}} \
GOOS={{.GOOS}} GOARCH={{.GOARCH}} GOARM={{.GOARM}} GOAMD64={{.GOAMD64}} GOMIPS={{.GOMIPS}} \
go build -trimpath -o ../../dist/hysteria-{{.TASK}} -ldflags \
"-w -s -X main.appCommit={{.BUILD_COMMIT}} -X main.appDate={{.BUILD_DATE}}"
"-w -s -X 'main.appVersion={{.BUILD_VERSION}}' -X 'main.appCommit={{.BUILD_COMMIT}}' -X 'main.appDate={{.BUILD_DATE}}'"
linux-386:
cmds:
- task: build-hysteria
@ -34,14 +40,14 @@ tasks:
GOOS: linux,
GOARCH: amd64
}
linux-amd64-v3:
linux-amd64-v4:
cmds:
- task: build-hysteria
vars: {
TASK: "{{.TASK}}",
GOOS: linux,
GOARCH: amd64,
GOAMD64: v3
GOAMD64: v4
}
linux-armv5:
cmds:
@ -129,6 +135,15 @@ tasks:
GOOS: darwin,
GOARCH: amd64
}
darwin-amd64-v4:
cmds:
- task: build-hysteria
vars: {
TASK: "{{.TASK}}",
GOOS: darwin,
GOARCH: amd64,
GOAMD64: v4
}
darwin-arm64:
cmds:
- task: build-hysteria
@ -137,12 +152,86 @@ tasks:
GOOS: darwin,
GOARCH: arm64
}
freebsd-386:
cmds:
- task: build-hysteria
vars: {
TASK: "{{.TASK}}",
GOOS: freebsd,
GOARCH: 386
}
freebsd-amd64:
cmds:
- task: build-hysteria
vars: {
TASK: "{{.TASK}}",
GOOS: freebsd,
GOARCH: amd64
}
freebsd-amd64-v4:
cmds:
- task: build-hysteria
vars: {
TASK: "{{.TASK}}",
GOOS: freebsd,
GOARCH: amd64,
GOAMD64: v4
}
freebsd-arm:
cmds:
- task: build-hysteria
vars: {
TASK: "{{.TASK}}",
GOOS: freebsd,
GOARCH: arm
}
freebsd-arm64:
cmds:
- task: build-hysteria
vars: {
TASK: "{{.TASK}}",
GOOS: freebsd,
GOARCH: arm64
}
windows-386:
cmds:
- task: build-hysteria
vars: {
TASK: "{{.TASK}}.exe",
GOOS: windows,
GOARCH: 386
}
windows-amd64:
cmds:
- task: build-hysteria
vars: {
TASK: "{{.TASK}}.exe",
GOOS: windows,
GOARCH: amd64
}
windows-amd64-v4:
cmds:
- task: build-hysteria
vars: {
TASK: "{{.TASK}}.exe",
GOOS: windows,
GOARCH: amd64,
GOAMD64: v4
}
windows-arm64:
cmds:
- task: build-hysteria
vars: {
TASK: "{{.TASK}}.exe",
GOOS: windows,
GOARCH: arm64
}
default:
cmds:
- task: clean
- task: linux-386
- task: linux-amd64
- task: linux-amd64-v3
- task: linux-amd64-v4
- task: linux-armv5
- task: linux-armv6
- task: linux-armv7
@ -153,4 +242,16 @@ tasks:
- task: linux-mips64
- task: linux-mips64le
- task: darwin-amd64
- task: darwin-amd64-v4
- task: darwin-arm64
- task: freebsd-386
- task: freebsd-amd64
- task: freebsd-amd64-v4
- task: freebsd-arm
- task: freebsd-arm64
- task: windows-386
- task: windows-amd64
- task: windows-amd64-v4
- task: windows-arm64
- task: hash