diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..a58a42b --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,35 @@ +name: Go + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + workflow_dispatch: + +jobs: + + build: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.21' + architecture: x64 + + - name: Set up task + uses: pnorton5432/setup-task@v1 + + - name: Install build dependencies + run: go install github.com/gonutz/rsrc@latest + + - name: Install UPX + uses: crazy-max/ghaction-upx@v3 + with: + install-only: true + + - name: Build and pack binaries + run: task pack \ No newline at end of file diff --git a/Taskfile.yml b/Taskfile.yml index 8186e34..9eb83ab 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -29,7 +29,7 @@ tasks: debug: desc: Builds artifacts for release - deps: [install-deps, resources] + deps: [test, install-deps, resources] cmds: - go generate ./... - go build -trimpath -ldflags "-s -w -X github.com/shivas/abyss-blackbox/internal/version.RecorderVersion={{.GIT_VERSION}} -X github.com/shivas/abyss-blackbox/internal/version.GoVersion={{.GO_VERSION}}" -o abyss-blackbox.exe ./cmd/abyss-blackbox @@ -42,7 +42,7 @@ tasks: release: desc: Builds artifacts for release - deps: [install-deps, resources] + deps: [test, install-deps, resources] cmds: - go generate ./... - go build -trimpath -ldflags="-H windowsgui -s -w -X github.com/shivas/abyss-blackbox/internal/version.RecorderVersion={{.GIT_VERSION}} -X github.com/shivas/abyss-blackbox/internal/version.GoVersion={{.GO_VERSION}}" -o abyss-blackbox.exe ./cmd/abyss-blackbox @@ -53,23 +53,10 @@ tasks: GO_VERSION: sh: go env GOVERSION - win7: - desc: Builds artifacts for release - deps: [install-deps, resources] - env: - GOARCH: 386 - cmds: - - go generate ./... - - go build -trimpath -ldflags="-H windowsgui -s -w -X github.com/shivas/abyss-blackbox/internal/version.RecorderVersion={{.GIT_VERSION}} -X github.com/shivas/abyss-blackbox/internal/version.GoVersion={{.GO_VERSION}}" -o abyss-blackbox32.exe ./cmd/abyss-blackbox - - go build -trimpath -ldflags="-s -w" ./cmd/extract/ - vars: - GIT_VERSION: - sh: git describe --tags --always - GO_VERSION: - sh: go env GOVERSION - pack: desc: Compress executables with UPX + deps: + - release cmds: - upx abyss-blackbox.exe - - upx abyss-blackbox32.exe + - upx extract.exe