Create binaries for armv7 and arm64 (#111)
This commit is contained in:
parent
36cc016f9d
commit
a1b8cd1c7a
3 changed files with 23 additions and 28 deletions
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
name: build-32
|
||||
name: build-arm
|
||||
|
||||
# Trigger the workflow on push or pull request
|
||||
on:
|
||||
|
@ -13,7 +13,16 @@ on:
|
|||
jobs:
|
||||
build_job:
|
||||
runs-on: ubuntu-20.04
|
||||
name: ubuntu-20.04 armv7
|
||||
name: linux_${{ matrix.arch }}
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- arch: armv7
|
||||
go: 1.17.5
|
||||
go_arch: armv6l
|
||||
- arch: aarch64
|
||||
go: 1.17.5
|
||||
go_arch: arm64
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
name: Checkout
|
||||
|
@ -23,7 +32,7 @@ jobs:
|
|||
name: Test and Build
|
||||
id: runcmd
|
||||
with:
|
||||
arch: armv7
|
||||
arch: ${{ matrix.arch }}
|
||||
distro: ubuntu20.04
|
||||
githubToken: ${{ github.token }}
|
||||
|
||||
|
@ -39,18 +48,25 @@ jobs:
|
|||
export PATH=$PATH:/usr/local/go/bin
|
||||
rm -rf /usr/local/go
|
||||
mkdir -p /usr/local/go
|
||||
curl -s -L https://golang.org/dl/go1.17.linux-armv6l.tar.gz | tar -C /usr/local -xz
|
||||
curl -s -L https://golang.org/dl/go${{ matrix.go }}.linux-${{ matrix.go_arch }}.tar.gz | tar -C /usr/local -xz
|
||||
go version
|
||||
|
||||
make test
|
||||
make build
|
||||
cp bin/* /artifacts
|
||||
- name: Show the artifact
|
||||
- name: Show artifacts
|
||||
run: |
|
||||
ls -al "/tmp/artifacts"
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
if-no-files-found: error
|
||||
name: build-armv7
|
||||
name: build-${{ matrix.arch }}
|
||||
path: "/tmp/artifacts/*"
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
files: "/tmp/artifacts/*"
|
5
.github/workflows/build.yaml
vendored
5
.github/workflows/build.yaml
vendored
|
@ -114,11 +114,6 @@ jobs:
|
|||
shell: bash
|
||||
run: |
|
||||
make build
|
||||
- name: Cross-compile
|
||||
shell: bash
|
||||
run: |
|
||||
make cross-compile
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
|
|
16
Makefile
16
Makefile
|
@ -5,10 +5,6 @@ BUILD := $(shell git rev-parse --short HEAD)
|
|||
BIN_OUTPUT ?= bin/distribyted-$(VERSION)-`go env GOOS`-`go env GOARCH``go env GOEXE`
|
||||
PROJECTNAME := $(shell basename "$(PWD)")
|
||||
|
||||
go-cross-compile: GOPATH=~/go
|
||||
go-cross-compile: ORGPATH=$(GOPATH)/src/github.com/distribyted
|
||||
go-cross-compile: REPOPATH=$(ORGPATH)/distribyted
|
||||
|
||||
# Use linker flags to provide version/build settings
|
||||
LDFLAGS=-X=main.Version=$(VERSION) -X=main.Build=$(BUILD) -linkmode external
|
||||
|
||||
|
@ -30,9 +26,6 @@ test-race:
|
|||
test:
|
||||
CGO_ENABLED=1 go test -v -coverprofile=coverage.out ./...
|
||||
|
||||
## cross-compile: compile for other platforms using xgo.
|
||||
cross-compile: go-generate go-cross-compile
|
||||
|
||||
go-build:
|
||||
@echo " > Building binary on $(BIN_OUTPUT)..."
|
||||
go build -o $(BIN_OUTPUT) -tags "release" -ldflags='$(LDFLAGS)' cmd/distribyted/main.go
|
||||
|
@ -41,15 +34,6 @@ go-generate:
|
|||
@echo " > Generating code files..."
|
||||
go generate ./...
|
||||
|
||||
go-cross-compile:
|
||||
@echo " > Compiling for several platforms..."
|
||||
go install src.techknowlogick.com/xgo@latest
|
||||
docker build ./build_tools/ -t distribyted/xgo-cgofuse
|
||||
mkdir -p $(ORGPATH)
|
||||
ln -sfrnT . $(REPOPATH)
|
||||
|
||||
GOPATH=$(GOPATH) xgo -out bin/distribyted-$(VERSION) -image=distribyted/xgo-cgofuse -ldflags='$(LDFLAGS)' -tags="release" -targets=linux/arm-7 $(REPOPATH)
|
||||
|
||||
.PHONY: help
|
||||
all: help
|
||||
help: Makefile
|
||||
|
|
Loading…
Reference in a new issue