mirror of
https://github.com/tuna/tunasync.git
synced 2025-04-20 20:22:46 +00:00
Add support for multiarch builds
This commit is contained in:
parent
b578237df8
commit
8ebace4d9a
24
.github/workflows/release.yml
vendored
24
.github/workflows/release.yml
vendored
@ -21,16 +21,12 @@ jobs:
|
|||||||
- name: Check out code into the Go module directory
|
- name: Check out code into the Go module directory
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Get dependencies
|
|
||||||
run: |
|
|
||||||
go get -v -t -d ./cmd/tunasync
|
|
||||||
go get -v -t -d ./cmd/tunasynctl
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
make tunasync
|
for i in linux-amd64 linux-arm64; do
|
||||||
make tunasynctl
|
make ARCH=$i all
|
||||||
tar -jcf build/tunasync-linux-bin.tar.bz2 -C build tunasync tunasynctl
|
tar -cz --numeric-owner --owner root -f tunasync-$i-bin.tar.gz -C build-$i tunasync tunasynctl
|
||||||
|
done
|
||||||
|
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
id: create_release
|
id: create_release
|
||||||
@ -42,13 +38,9 @@ jobs:
|
|||||||
release_name: Release ${{ github.ref }}
|
release_name: Release ${{ github.ref }}
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: false
|
prerelease: false
|
||||||
- name: Upload Release Asset
|
- name: Upload Release Assets
|
||||||
id: upload-release-asset
|
|
||||||
uses: actions/upload-release-asset@v1
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
TAG_NAME: ${{ github.ref }}
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
|
run: |
|
||||||
asset_path: ./build/tunasync-linux-bin.tar.bz2
|
hub release edit $(find . -type f -name "tunasync-*.tar.gz" -printf "-a %p ") -m "" "${TAG_NAME##*/}"
|
||||||
asset_name: tunasync-linux-bin.tar.bz2
|
|
||||||
asset_content_type: application/x-bzip2
|
|
||||||
|
2
.github/workflows/tunasync.yml
vendored
2
.github/workflows/tunasync.yml
vendored
@ -32,7 +32,7 @@ jobs:
|
|||||||
uses: actions/upload-artifact@v1
|
uses: actions/upload-artifact@v1
|
||||||
with:
|
with:
|
||||||
name: tunasync-bin
|
name: tunasync-bin
|
||||||
path: build/
|
path: build-linux-amd64/
|
||||||
|
|
||||||
test:
|
test:
|
||||||
name: Test
|
name: Test
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
/build
|
/build
|
||||||
|
/build-*
|
||||||
|
25
Makefile
25
Makefile
@ -1,19 +1,22 @@
|
|||||||
LDFLAGS="-X main.buildstamp=`date -u '+%s'` -X main.githash=`git rev-parse HEAD`"
|
LDFLAGS="-X main.buildstamp=`date -u '+%s'` -X main.githash=`git rev-parse HEAD`"
|
||||||
|
ARCH ?= linux-amd64
|
||||||
|
ARCH_LIST = $(subst -, ,$(ARCH))
|
||||||
|
GOOS = $(word 1, $(ARCH_LIST))
|
||||||
|
GOARCH = $(word 2, $(ARCH_LIST))
|
||||||
|
BUILDBIN = tunasync tunasynctl
|
||||||
|
|
||||||
all: get tunasync tunasynctl
|
all: $(BUILDBIN)
|
||||||
|
|
||||||
get:
|
build-$(ARCH):
|
||||||
go get ./cmd/tunasync
|
mkdir -p $@
|
||||||
go get ./cmd/tunasynctl
|
|
||||||
|
|
||||||
build:
|
$(BUILDBIN): % : build-$(ARCH) build-$(ARCH)/%
|
||||||
mkdir -p build
|
|
||||||
|
|
||||||
tunasync: build
|
$(BUILDBIN:%=build-$(ARCH)/%) : build-$(ARCH)/% : cmd/%
|
||||||
go build -o build/tunasync -ldflags ${LDFLAGS} github.com/tuna/tunasync/cmd/tunasync
|
GOOS=$(GOOS) GOARCH=$(GOARCH) go get ./$<
|
||||||
|
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $@ -ldflags ${LDFLAGS} github.com/tuna/tunasync/$<
|
||||||
tunasynctl: build
|
|
||||||
go build -o build/tunasynctl -ldflags ${LDFLAGS} github.com/tuna/tunasync/cmd/tunasynctl
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
go test -v -covermode=count -coverprofile=profile.cov ./...
|
go test -v -covermode=count -coverprofile=profile.cov ./...
|
||||||
|
|
||||||
|
.PHONY: all test $(BUILDBIN)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user