Skip to content

Commit

Permalink
feat: update goreleaser develop build
Browse files Browse the repository at this point in the history
  • Loading branch information
ajgrande924 committed Feb 22, 2023
1 parent 88847cb commit 190d76a
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 70 deletions.
4 changes: 2 additions & 2 deletions .github/actions/goreleaser-build-sign-publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ description: A composite action that allows building and publishing signed chain
inputs:
goreleaser-version:
description: The goreleaser version
default: 1.13.1
default: 1.15.2
required: false
zig-version:
description: The zig version
default: 0.10.0
default: 0.10.1
required: false
cosign-version:
description: The cosign version
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/goreleaser-build-sign-publish/action_utils
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ goreleaser_release() {
MACOS_SDK_DIR=$(echo "$(cd "$(dirname "$MACOS_SDK_DIR")" || exit; pwd)/$(basename "$MACOS_SDK_DIR")")
fi
if [[ $ENABLE_GORELEASER_SNAPSHOT == "true" ]]; then
$GORELEASER_EXEC release --snapshot --rm-dist --config "$GORELEASER_CONFIG" "$@"
$GORELEASER_EXEC release --snapshot --clean --config "$GORELEASER_CONFIG" "$@"
if [[ $ENABLE_DOCKER_PUBLISH == "true" ]]; then
_publish_snapshot_images
_publish_snapshot_manifests
fi
else
$GORELEASER_EXEC release --rm-dist --config "$GORELEASER_CONFIG" "$@"
$GORELEASER_EXEC release --clean --config "$GORELEASER_CONFIG" "$@"
fi
if [[ $ENABLE_COSIGN == "true" ]]; then
rm -rf cosign.pub
Expand Down
31 changes: 16 additions & 15 deletions .goreleaser.develop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ builds:
hooks:
post: ./tools/bin/goreleaser_utils build_post_hook {{ dir .Path }} {{ .Os }} {{ .Arch }}
env:
- CGO_ENABLED=1
- CGO_ENABLED=0
- CC=$ZIG_EXEC cc -target aarch64-linux-gnu
- CCX=$ZIG_EXEC c++ -target aarch64-linux-gnu
flags:
Expand All @@ -46,7 +46,7 @@ builds:
hooks:
post: ./tools/bin/goreleaser_utils build_post_hook {{ dir .Path }} {{ .Os }} {{ .Arch }}
env:
- CGO_ENABLED=1
- CGO_ENABLED=0
- CC=$ZIG_EXEC cc -target x86_64-linux-gnu
- CCX=$ZIG_EXEC c++ -target x86_64-linux-gnu
flags:
Expand All @@ -64,8 +64,8 @@ dockers:
use: buildx
goos: linux
goarch: amd64
extra_files:
- tmp/linux_amd64/libs
# extra_files:
# - tmp/linux_amd64/libs
build_flag_templates:
- "--platform=linux/amd64"
- "--pull"
Expand All @@ -86,8 +86,8 @@ dockers:
use: buildx
goos: linux
goarch: arm64
extra_files:
- tmp/linux_arm64/libs
# extra_files:
# - tmp/linux_arm64/libs
build_flag_templates:
- "--platform=linux/arm64"
- "--pull"
Expand All @@ -108,8 +108,8 @@ dockers:
use: buildx
goos: linux
goarch: amd64
extra_files:
- tmp/linux_amd64/libs
# extra_files:
# - tmp/linux_amd64/libs
build_flag_templates:
- "--platform=linux/amd64"
- "--pull"
Expand All @@ -131,8 +131,8 @@ dockers:
use: buildx
goos: linux
goarch: arm64
extra_files:
- tmp/linux_arm64/libs
# extra_files:
# - tmp/linux_arm64/libs
build_flag_templates:
- "--platform=linux/arm64"
- "--pull"
Expand Down Expand Up @@ -174,11 +174,12 @@ docker_signs:
- artifacts: all
stdin: "{{ .Env.COSIGN_PASSWORD }}"

archives:
- files:
- src: tmp/{{ .Os }}_{{ .Arch }}/libs/*
dst: libs
strip_parent: true
archives: []
# - rlcp: true
# files:
# - src: tmp/{{ .Os }}_{{ .Arch }}/libs/*
# dst: libs
# strip_parent: true

checksum:
name_template: "checksums.txt"
Expand Down
27 changes: 14 additions & 13 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ builds:
hooks:
post: ./tools/bin/goreleaser_utils build_post_hook {{ dir .Path }} {{ .Os }} {{ .Arch }}
env:
- CGO_ENABLED=1
- CGO_ENABLED=0
- CC=$ZIG_EXEC cc -target aarch64-linux-gnu
- CCX=$ZIG_EXEC c++ -target aarch64-linux-gnu
flags:
Expand All @@ -46,7 +46,7 @@ builds:
hooks:
post: ./tools/bin/goreleaser_utils build_post_hook {{ dir .Path }} {{ .Os }} {{ .Arch }}
env:
- CGO_ENABLED=1
- CGO_ENABLED=0
- CC=$ZIG_EXEC cc -target x86_64-linux-gnu
- CCX=$ZIG_EXEC c++ -target x86_64-linux-gnu
flags:
Expand All @@ -66,7 +66,7 @@ builds:
hooks:
post: ./tools/bin/goreleaser_utils build_post_hook {{ dir .Path }} {{ .Os }} {{ .Arch }}
env:
- CGO_ENABLED=1
- CGO_ENABLED=0
- CC=$ZIG_EXEC cc -target aarch64-macos $ZIG_FLAGS_DARWIN
- CCX=$ZIG_EXEC c++ -target aarch64-macos $ZIG_FLAGS_DARWIN
flags:
Expand All @@ -86,7 +86,7 @@ builds:
hooks:
post: ./tools/bin/goreleaser_utils build_post_hook {{ dir .Path }} {{ .Os }} {{ .Arch }}
env:
- CGO_ENABLED=1
- CGO_ENABLED=0
- CC=$ZIG_EXEC cc -target x86_64-macos $ZIG_FLAGS_DARWIN
- CCX=$ZIG_EXEC c++ -target x86_64-macos $ZIG_FLAGS_DARWIN
flags:
Expand All @@ -104,8 +104,8 @@ dockers:
use: buildx
goos: linux
goarch: amd64
extra_files:
- tmp/linux_amd64/libs
# extra_files:
# - tmp/linux_amd64/libs
build_flag_templates:
- "--platform=linux/amd64"
- "--pull"
Expand All @@ -127,8 +127,8 @@ dockers:
use: buildx
goos: linux
goarch: arm64
extra_files:
- tmp/linux_arm64/libs
# extra_files:
# - tmp/linux_arm64/libs
build_flag_templates:
- "--platform=linux/arm64"
- "--pull"
Expand Down Expand Up @@ -162,11 +162,12 @@ docker_signs:
- artifacts: all
stdin: "{{ .Env.COSIGN_PASSWORD }}"

archives:
- files:
- src: tmp/{{ .Os }}_{{ .Arch }}/libs/*
dst: libs
strip_parent: true
archives: []
# - rlcp: true
# files:
# - src: tmp/{{ .Os }}_{{ .Arch }}/libs/*
# dst: libs
# strip_parent: true

checksum:
name_template: "checksums.txt"
Expand Down
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ mockery 2.20.0
nodejs 16.13.2
postgres 13.3
helm 3.10.3
zig 0.10.0
zig 0.10.1
golangci-lint 1.51.1
shellspec 0.28.1
3 changes: 2 additions & 1 deletion core/chainlink.goreleaser.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \
&& apt-get clean all

COPY . /usr/local/bin/
COPY ./tmp/linux_${TARGETARCH}/libs /usr/local/bin/libs
# Copy native libs if cgo is enabled
# COPY ./tmp/linux_${TARGETARCH}/libs /usr/local/bin/libs

RUN if [ ${CHAINLINK_USER} != root ]; then \
useradd --uid 14933 --create-home ${CHAINLINK_USER}; \
Expand Down
38 changes: 2 additions & 36 deletions tools/bin/goreleaser_utils
Original file line number Diff line number Diff line change
Expand Up @@ -19,44 +19,11 @@ _get_arch() {
esac
}

# get lib wasmvm path
_get_wasmvm_lib_path() {
local -r platform="$1"
local -r arch="$2"
wasmvm_dir=$(go list -json -m all | jq -r '. | select(.Path == "github.com/CosmWasm/wasmvm") | .Dir')
shared_lib_dir="$wasmvm_dir/api"
lib_name="libwasmvm"
if [ "$platform" == "darwin" ]; then
lib_extension="dylib"
elif [ "$platform" == "linux" ]; then
case "${arch}" in
x86_64 | amd64) lib_extension="x86_64.so" ;;
aarch64 | arm64) lib_extension="aarch64.so" ;;
*) echo "Unsupported arch $arch" && exit 1 ;;
esac
else
echo "Unsupported platform $platform"
exit 1
fi
echo "$shared_lib_dir/${lib_name}.$lib_extension"
}

# global goreleaser before hook
# moves native libraries to temp directories used by docker images / archives
before_hook() {
local -r lib_path=tmp
local -r wasmvm_lib_path_linux_amd64=$(_get_wasmvm_lib_path "linux" "amd64")
local -r wasmvm_lib_path_linux_arm64=$(_get_wasmvm_lib_path "linux" "arm64")
local -r wasmvm_lib_path_darwin_amd64=$(_get_wasmvm_lib_path "darwin" "amd64")
local -r wasmvm_lib_path_darwin_arm64=$(_get_wasmvm_lib_path "darwin" "arm64")
mkdir -p "$lib_path/linux_amd64/libs"
cp -f "$wasmvm_lib_path_linux_amd64" "$lib_path/linux_amd64/libs"
mkdir -p "$lib_path/linux_arm64/libs"
cp -f "$wasmvm_lib_path_linux_arm64" "$lib_path/linux_arm64/libs"
mkdir -p "$lib_path/darwin_amd64/libs"
cp -f "$wasmvm_lib_path_darwin_amd64" "$lib_path/darwin_amd64/libs"
mkdir -p "$lib_path/darwin_arm64/libs"
cp -f "$wasmvm_lib_path_darwin_arm64" "$lib_path/darwin_arm64/libs"
# MOVE NATIVE LIBRARIES HERE
}

# binary build post hook
Expand All @@ -66,9 +33,8 @@ build_post_hook() {
local -r lib_path=$dist_path/libs
local -r platform=$2
local -r arch=$3
local -r wasmvm_lib_path=$(_get_wasmvm_lib_path "$platform" "$arch")
mkdir -p "$lib_path"
cp "$wasmvm_lib_path" "$lib_path"
# COPY NATIVE LIBRARIES HERE
}

"$@"

0 comments on commit 190d76a

Please sign in to comment.