This repository has been archived by the owner on May 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Yuvraj <[email protected]>
- Loading branch information
Showing
8 changed files
with
211 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,12 @@ jobs: | |
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Cache CGO dependacy | ||
id: env-cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/cross | ||
key: ${{ hashFiles('BUILD_ENV') }}-env | ||
- uses: actions/setup-go@v1 | ||
with: | ||
go-version: '1.16' | ||
|
@@ -29,14 +35,7 @@ jobs: | |
echo "::add-path::/usr/bin/clang" | ||
- name: Install system dependencies | ||
env: | ||
MUSL_VERSION: 1.1.24 | ||
MUSL_BUILD_TIME: 20210108172549 | ||
MUSL_CROSS_MAKE_VERSION: 0.9.9 | ||
GOPATH: $HOME/go | ||
MUSL_CROSS_ARM64_BUILD_TIME: 20210108174735 | ||
OSXCROSS_VERSION: c2ad5e859d12a295c3f686a15bd7181a165bfa82 | ||
OSXCROSS_BUILD_TIME: 20210108174800 | ||
PATH: /usr/local/musl/bin:${PATH} | ||
GOBIN: ${GOPATH}/bin | ||
run: | | ||
./scripts/ci/setup.sh | ||
- name: Run GoReleaser dry run | ||
|
@@ -46,25 +45,30 @@ jobs: | |
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: /usr/local/musl-cross/bin/aarch64-unknown-linux-musl-gcc | ||
CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER: /usr/local/osxcross/target/bin/x86_64-apple-darwin15-clang | ||
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER: /usr/bin/x86_64-w64-mingw32-gcc | ||
PATH: /usr/local/musl/bin:${PATH} | ||
GOBIN: ${GOPATH}/bin | ||
with: | ||
version: latest | ||
args: --snapshot --skip-publish --rm-dist | ||
args: --snapshot --skip-publish --rm-dist | ||
- name: Unit Tests | ||
uses: cedrickring/[email protected] | ||
env: | ||
GO111MODULE: "on" | ||
with: | ||
args: make install && make test_unit_codecov | ||
run: make install && make test_unit_codecov | ||
- name: Push CodeCov | ||
uses: codecov/[email protected] | ||
with: | ||
file: coverage.txt | ||
flags: unittests | ||
fail_ci_if_error: true | ||
lint: | ||
name: Run tests and lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Lint | ||
uses: cedrickring/[email protected] | ||
env: | ||
GO111MODULE: "on" | ||
with: | ||
args: make install && make lint | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
MUSL_VERSION: 1.1.24 | ||
MUSL_CROSS_MAKE_VERSION: 0.9.9 | ||
OSXCROSS_VERSION: c2ad5e859d12a295c3f686a15bd7181a165bfa82 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
declare -r SCRIPT_DIR=$(cd $(dirname ${0}) >/dev/null 2>&1 && pwd) | ||
declare -r OUT_DIR=/tmp/cross | ||
|
||
declare -r BUILD_IMAGE=ubuntu:20.04 | ||
declare -r MUSL_VERSION=1.1.24 | ||
declare -r MUSL_CROSS_MAKE_VERSION=0.9.9 | ||
|
||
docker run --rm -i -v ${OUT_DIR}:/tmp/cross -w /tmp ${BUILD_IMAGE} bash <<EOF | ||
set -euo pipefail | ||
declare -r BUILD_TIME=\$(date -u '+%Y%m%d%H%M%S') | ||
export DEBIAN_FRONTEND=noninteractive | ||
# Install dependencies. | ||
apt-get update && apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
ca-certificates \ | ||
curl \ | ||
git \ | ||
make \ | ||
patch | ||
# Clone and build musl-cross-make's ARM64 target. | ||
git clone https://github.com/richfelker/musl-cross-make.git && \ | ||
cd musl-cross-make && \ | ||
git checkout v${MUSL_CROSS_MAKE_VERSION} && \ | ||
make MUSL_VER=${MUSL_VERSION} TARGET=aarch64-unknown-linux-musl DL_CMD="curl -C - -L -o" install && \ | ||
mv output /tmp/musl-cross && \ | ||
cd /tmp | ||
# Archive the build output. | ||
tar czf /tmp/cross/musl-${MUSL_VERSION}-cross-aarch64-${MUSL_CROSS_MAKE_VERSION}.tar.gz musl-cross | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
declare -r SCRIPT_DIR=$(cd $(dirname ${0}) >/dev/null 2>&1 && pwd) | ||
declare -r OUT_DIR=/tmp/cross | ||
|
||
declare -r BUILD_IMAGE=ubuntu:20.04 | ||
declare -r MUSL_VERSION=1.1.24 | ||
|
||
docker run --rm -i -v ${OUT_DIR}:/tmp/cross -w /tmp ${BUILD_IMAGE} bash <<EOF | ||
set -euo pipefail | ||
declare -r BUILD_TIME=\$(date -u '+%Y%m%d%H%M%S') | ||
# Install dependencies. | ||
apt-get update && apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
ca-certificates \ | ||
curl \ | ||
patch | ||
# Build MUSL from source. | ||
curl https://musl.libc.org/releases/musl-${MUSL_VERSION}.tar.gz -O && \ | ||
tar xzf musl-${MUSL_VERSION}.tar.gz && \ | ||
cd musl-${MUSL_VERSION} && | ||
./configure && | ||
make && \ | ||
make install && \ | ||
cd /tmp | ||
# Archive the build output. | ||
cd /usr/local && tar czf /tmp/cross/musl-${MUSL_VERSION}.tar.gz musl && cd /tmp | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
declare -r SCRIPT_DIR=$(cd $(dirname ${0}) >/dev/null 2>&1 && pwd) | ||
declare -r OUT_DIR=/tmp/cross | ||
|
||
declare -r BUILD_IMAGE=ubuntu:20.04 | ||
declare -r OSXCROSS_VERSION=c2ad5e859d12a295c3f686a15bd7181a165bfa82 | ||
|
||
docker run --rm -i -v ${OUT_DIR}:/tmp/cross -w /tmp ${BUILD_IMAGE} bash <<EOF | ||
set -euo pipefail | ||
declare -r BUILD_TIME=\$(date -u '+%Y%m%d%H%M%S') | ||
export DEBIAN_FRONTEND=noninteractive | ||
# Install dependencies. | ||
apt-get update && apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
ca-certificates \ | ||
clang \ | ||
cmake \ | ||
curl \ | ||
git \ | ||
libssl-dev \ | ||
libxml2-dev \ | ||
llvm-dev \ | ||
lzma-dev \ | ||
patch \ | ||
zlib1g-dev | ||
# Clone and build osxcross. | ||
git clone https://github.com/tpoechtrager/osxcross.git /usr/local/osxcross && \ | ||
cd /usr/local/osxcross && \ | ||
git checkout ${OSXCROSS_VERSION} && \ | ||
curl -L -o ./tarballs/MacOSX10.11.sdk.tar.xz https://macos-sdks.s3.amazonaws.com/MacOSX10.11.sdk.tar.xz && \ | ||
UNATTENDED=1 PORTABLE=true OCDEBUG=1 ./build.sh && \ | ||
rm -rf .git build tarballs && \ | ||
cd /tmp | ||
# Archive the build output. | ||
cd /usr/local && tar czf /tmp/cross/osxcross-${OSXCROSS_VERSION}.tar.gz osxcross && cd /tmp | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
#!/bin/bash | ||
|
||
function die() { | ||
echo "$@" 1>&2 | ||
exit 1 | ||
} | ||
|
||
GOOS=${GOOS:-$(go env GOOS)} | ||
GOARCH=${GOARCH:-$(go env GOARCH)} | ||
|
||
case "${GOOS}_${GOARCH}" in | ||
linux_amd64) CC=musl-gcc ;; | ||
linux_arm64) CC=aarch64-unknown-linux-musl-gcc ;; | ||
darwin_amd64) CC=x86_64-apple-darwin15-clang ;; | ||
windows_amd64) CC=x86_64-w64-mingw32-gcc ;; | ||
*) die "No cross-compiler set for ${GOOS}_${GOARCH}" ;; | ||
esac | ||
|
||
exec ${CC} "$@" |