Cross Compile in Parallel two archs at a time (#825)
* Cross Compile in Parallel two archs at a time Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com> * Remove echo. Fix args Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
This commit is contained in:
34
.github/workflows/crosscompile-1.yml
vendored
Normal file
34
.github/workflows/crosscompile-1.yml
vendored
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
name: Go
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Cross compile
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
go-version: [1.16.x]
|
||||||
|
os: [ubuntu-latest]
|
||||||
|
steps:
|
||||||
|
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: ${{ matrix.go-version }}
|
||||||
|
id: go
|
||||||
|
|
||||||
|
- name: Check out code into the Go module directory
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Build on ${{ matrix.os }}
|
||||||
|
env:
|
||||||
|
GO111MODULE: on
|
||||||
|
GOOS: linux
|
||||||
|
run: |
|
||||||
|
make crosscompile arg1="'linux/ppc64le linux/mips64'"
|
||||||
34
.github/workflows/crosscompile-2.yml
vendored
Normal file
34
.github/workflows/crosscompile-2.yml
vendored
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
name: Go
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Cross compile
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
go-version: [1.16.x]
|
||||||
|
os: [ubuntu-latest]
|
||||||
|
steps:
|
||||||
|
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: ${{ matrix.go-version }}
|
||||||
|
id: go
|
||||||
|
|
||||||
|
- name: Check out code into the Go module directory
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Build on ${{ matrix.os }}
|
||||||
|
env:
|
||||||
|
GO111MODULE: on
|
||||||
|
GOOS: linux
|
||||||
|
run: |
|
||||||
|
make crosscompile arg1="'linux/arm64 linux/s390x'"
|
||||||
34
.github/workflows/crosscompile-3.yml
vendored
Normal file
34
.github/workflows/crosscompile-3.yml
vendored
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
name: Go
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Cross compile
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
go-version: [1.16.x]
|
||||||
|
os: [ubuntu-latest]
|
||||||
|
steps:
|
||||||
|
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: ${{ matrix.go-version }}
|
||||||
|
id: go
|
||||||
|
|
||||||
|
- name: Check out code into the Go module directory
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Build on ${{ matrix.os }}
|
||||||
|
env:
|
||||||
|
GO111MODULE: on
|
||||||
|
GOOS: linux
|
||||||
|
run: |
|
||||||
|
make crosscompile arg1="'darwin/amd64 freebsd/amd64'"
|
||||||
34
.github/workflows/crosscompile-4.yml
vendored
Normal file
34
.github/workflows/crosscompile-4.yml
vendored
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
name: Go
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Cross compile
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
go-version: [1.16.x]
|
||||||
|
os: [ubuntu-latest]
|
||||||
|
steps:
|
||||||
|
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: ${{ matrix.go-version }}
|
||||||
|
id: go
|
||||||
|
|
||||||
|
- name: Check out code into the Go module directory
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Build on ${{ matrix.os }}
|
||||||
|
env:
|
||||||
|
GO111MODULE: on
|
||||||
|
GOOS: linux
|
||||||
|
run: |
|
||||||
|
make crosscompile arg1="'windows/amd64 linux/arm'"
|
||||||
@@ -31,4 +31,4 @@ jobs:
|
|||||||
GO111MODULE: on
|
GO111MODULE: on
|
||||||
GOOS: linux
|
GOOS: linux
|
||||||
run: |
|
run: |
|
||||||
make crosscompile
|
make crosscompile arg1="'linux/386 netbsd/amd64'"
|
||||||
2
Makefile
2
Makefile
@@ -31,7 +31,7 @@ fmt:
|
|||||||
@GO111MODULE=on gofmt -d cluster/
|
@GO111MODULE=on gofmt -d cluster/
|
||||||
|
|
||||||
crosscompile:
|
crosscompile:
|
||||||
@(env bash $(PWD)/cross-compile.sh)
|
@(env bash $(PWD)/cross-compile.sh $(arg1))
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
@echo "Running $@ check"
|
@echo "Running $@ check"
|
||||||
|
|||||||
@@ -4,13 +4,12 @@ set -e
|
|||||||
# Enable tracing if set.
|
# Enable tracing if set.
|
||||||
[ -n "$BASH_XTRACEFD" ] && set -x
|
[ -n "$BASH_XTRACEFD" ] && set -x
|
||||||
|
|
||||||
_init() {
|
## All binaries are static make sure to disable CGO.
|
||||||
## All binaries are static make sure to disable CGO.
|
export CGO_ENABLED=0
|
||||||
export CGO_ENABLED=0
|
|
||||||
|
|
||||||
## List of architectures and OS to test coss compilation.
|
## List of architectures and OS to test cross compilation.
|
||||||
SUPPORTED_OSARCH="linux/ppc64le linux/mips64 linux/arm64 linux/s390x darwin/amd64 freebsd/amd64 windows/amd64 linux/arm linux/386 netbsd/amd64"
|
SUPPORTED_OSARCH_DEFAULTS="linux/ppc64le linux/mips64 linux/arm64 linux/s390x darwin/amd64 freebsd/amd64 windows/amd64 linux/arm linux/386 netbsd/amd64"
|
||||||
}
|
SUPPORTED_OSARCH=${1:-$SUPPORTED_OSARCH_DEFAULTS}
|
||||||
|
|
||||||
_build() {
|
_build() {
|
||||||
local osarch=$1
|
local osarch=$1
|
||||||
@@ -31,4 +30,4 @@ main() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
_init && main "$@"
|
main "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user