Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

Commit

Permalink
use Makefile in github action
Browse files Browse the repository at this point in the history
Adds MacOS and Windows targets in Makefile from the github workflow
YAML.
  • Loading branch information
mixmasala committed Mar 8, 2022
1 parent 534ed60 commit 6abed12
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: actions/checkout@v2

- name: Build for linux
run: go build -trimpath -ldflags=-buildid=
run: sudo make docker-build-linux

- name: Upload binary artifact
uses: actions/upload-artifact@v2
Expand All @@ -44,7 +44,7 @@ jobs:
uses: actions/checkout@v2

- name: Build for windows
run: GOOS=windows go build -trimpath -ldflags="-H windowsgui -buildid="
run: sudo make docker-build-windows

- name: Upload binary artifact
uses: actions/upload-artifact@v2
Expand All @@ -68,11 +68,8 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Build for OSX (amd64)
run: GOARCH="amd64" go build -trimpath -ldflags=-buildid= && mv catchat catchat-macos-amd64

- name: Build for OSX (arm64)
run: CGO_ENABLED=1 GOOS="darwin" GOARCH="arm64" go build -trimpath -ldflags=-buildid= -tags dynamic && mv catchat catchat-macos-arm64
- name: Build for MacOS
run: sudo make docker-build-macos

- name: Upload binary artifact
uses: actions/upload-artifact@v2
Expand Down
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
docker-build-linux: docker-go-mod
docker run --rm -v "$(shell readlink -f .)":/go/catchat/ -it catchat/go_mod bash -c 'cd /go/catchat/; go build -trimpath -ldflags=-buildid='
docker run --rm -v "$(shell readlink -f .)":/go/catchat/ catchat/go_mod bash -c 'cd /go/catchat/; go build -trimpath -ldflags=-buildid='

docker-build-windows: docker-go-mod
docker run --rm -v "$(shell readlink -f .)":/go/catchat/ catchat/go_mod bash -c 'cd /go/catchat/; GOOS=windows go build -trimpath -ldflags="-H windowsgui -buildid=" -o catchat.exe'

docker-build-macos: docker-go-mod
docker run --rm -v "$(shell readlink -f .)":/go/catchat/ catchat/go_mod bash -c 'cd /go/catchat/; GOARCH="amd64" go build -trimpath -ldflags=-buildid= -o catchat-macos-amd64'
docker run --rm -v "$(shell readlink -f .)":/go/catchat/ catchat/go_mod bash -c 'cd /go/catchat/; CGO_ENABLED=1 GOOS="darwin" GOARCH="arm64" go build -trimpath -ldflags=-buildid= -tags dynamic -o catchat-macos-arm64'

docker-debian-base:
if ! docker images|grep catchat/debian_base; then \
Expand Down

0 comments on commit 6abed12

Please sign in to comment.