Skip to content

Commit

Permalink
addressing PR comments/default x64 builds to variant 3
Browse files Browse the repository at this point in the history
  • Loading branch information
wileyj committed Mar 5, 2024
1 parent 1a0775f commit 11dd4d1
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 24 deletions.
16 changes: 10 additions & 6 deletions .github/actions/dockerfiles/Dockerfile.alpine-binary
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG TARGETARCH
ARG TARGETVARIANT
ARG REPO=stacks-network/stacks-core
ARG REPO

RUN case ${TARGETARCH} in \
"amd64") BIN_ARCH=linux-musl-x64-v3 ;; \
"arm64") BIN_ARCH=linux-musl-arm64 ;; \
"arm") BIN_ARCH=linux-musl-armv7 ;; \
"*") exit 1 ;; \
RUN case ${TARGETPLATFORM} in \
linux/amd64/v2) BIN_ARCH=linux-glibc-x64-v2 ;; \
linux/amd64*) BIN_ARCH=linux-glibc-x64 ;; \
linux/arm64*) BIN_ARCH=linux-glibc-arm64 ;; \
linux/arm/v7) BIN_ARCH=linux-glibc-armv7 ;; \
*) exit 1 ;; \
esac \
&& echo "TARGETPLATFORM: $TARGETPLATFORM" \
&& echo "BIN_ARCH: $BIN_ARCH" \
&& echo "wget -q https://github.com/${REPO}/releases/download/${TAG}/${BIN_ARCH}.zip -O /${BIN_ARCH}.zip" \
&& wget -q https://github.com/${REPO}/releases/download/${TAG}/${BIN_ARCH}.zip -O /${BIN_ARCH}.zip \
&& unzip ${BIN_ARCH}.zip -d /out

Expand Down
16 changes: 10 additions & 6 deletions .github/actions/dockerfiles/Dockerfile.debian-binary
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG TARGETARCH
ARG TARGETVARIANT
ARG REPO=stacks-network/stacks-core
ARG REPO

RUN case ${TARGETARCH} in \
"amd64") BIN_ARCH=linux-glibc-x64-v3 ;; \
"arm64") BIN_ARCH=linux-glibc-arm64 ;; \
"arm") BIN_ARCH=linux-glibc-armv7 ;; \
"*") exit 1 ;; \
RUN case ${TARGETPLATFORM} in \
linux/amd64/v2) BIN_ARCH=linux-glibc-x64-v2 ;; \
linux/amd64*) BIN_ARCH=linux-glibc-x64 ;; \
linux/arm64*) BIN_ARCH=linux-glibc-arm64 ;; \
linux/arm/v7) BIN_ARCH=linux-glibc-armv7 ;; \
*) exit 1 ;; \
esac \
&& echo "TARGETPLATFORM: $TARGETPLATFORM" \
&& echo "BIN_ARCH: $BIN_ARCH" \
&& echo "wget -q https://github.com/${REPO}/releases/download/${TAG}/${BIN_ARCH}.zip -O /${BIN_ARCH}.zip" \
&& wget -q https://github.com/${REPO}/releases/download/${TAG}/${BIN_ARCH}.zip -O /${BIN_ARCH}.zip \
&& unzip ${BIN_ARCH}.zip -d /out

Expand Down
27 changes: 20 additions & 7 deletions .github/workflows/create-source-binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ jobs:
cpu:
- arm64
- armv7
- x86-64
- x86-64-v3
- x86-64 ## defaults to x86-64-v3 variant - intel haswell (2013) and newer
# - x86-64-v2 ## intel nehalem (2008) and newer
# - x86-64-v3 ## intel haswell (2013) and newer
# - x86-64-v4 ## intel skylake (2017) and newer
exclude:
- arch: windows # excludes windows-arm64
cpu: arm64
Expand All @@ -57,19 +59,33 @@ jobs:
uses: stacks-network/actions/docker@main

- name: Set Local env vars
id: set_envars
id: set_env
run: |
case ${{ matrix.cpu }} in
x86-64)
TARGET_CPU="${{ matrix.cpu }}"
## default x64 builds to use v3 variant. TARGET_CPU is required to build for v3 via RUSTFLAGS
TARGET_CPU="${{ matrix.cpu }}-v3"
DOCKERFILE_CPU="x64"
ARCHIVE_NAME="x64"
;;
x86-64-v2)
## intel nehalem (2008) and newer
TARGET_CPU="${{ matrix.cpu }}"
DOCKERFILE_CPU="x64"
ARCHIVE_NAME="x64-v2"
;;
x86-64-v3)
## intel haswell (2013) and newer
TARGET_CPU="${{ matrix.cpu }}"
DOCKERFILE_CPU="x64"
ARCHIVE_NAME="x64-v3"
;;
x86-64-v4)
## intel skylake (2017) and newer
TARGET_CPU="${{ matrix.cpu }}"
DOCKERFILE_CPU="x64"
ARCHIVE_NAME="x64-v4"
;;
*)
TARGET_CPU=""
DOCKERFILE_CPU="${{ matrix.cpu }}"
Expand All @@ -79,9 +95,6 @@ jobs:
echo "DOCKERFILE=Dockerfile.${{ matrix.arch }}-${DOCKERFILE_CPU}" >> "$GITHUB_ENV"
echo "ZIPFILE=${{ matrix.arch }}-${ARCHIVE_NAME}" >> "$GITHUB_ENV"
echo "TARGET_CPU=${TARGET_CPU}" >> "$GITHUB_ENV"
echo "DOCKERFILE: ${DOCKERFILE}"
echo "ZIPFILE: ${ZIPFILE}"
echo "TARGET_CPU: ${TARGET_CPU}"
## Build the binaries using defined dockerfiles
- name: Build Binary (${{ matrix.arch }}_${{ matrix.cpu }})
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/image-build-binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:

## Define which docker arch to build for
env:
docker_platforms: "linux/arm64, linux/arm/v7, linux/amd64, linux/amd64/v2, linux/amd64/v3"
docker_platforms: "linux/arm64, linux/arm/v7, linux/amd64, linux/amd64/v3"
docker-org: blockstack

concurrency:
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
## if the repo owner is not `stacks-network`, default to a docker-org of the repo owner (i.e. github user id)
## this allows forks to run the docker push workflows without having to hardcode a dockerhub org (but it does require docker hub user to match github username)
- name: Set Local env vars
id: set_envars
id: set_env
if: |
github.repository_owner != 'stacks-network'
run: |
Expand All @@ -65,6 +65,7 @@ jobs:
id: docker_metadata
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 #v5.0.0
with:
## tag images with current repo name `stacks-core` as well as legacy `stacks-blockchain`
images: |
${{env.docker-org}}/${{ github.event.repository.name }}
${{env.docker-org}}/stacks-blockchain
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/image-build-source.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

## Define which docker arch to build for
env:
docker_platforms: linux/amd64
docker_platforms: "linux/amd64"
docker-org: blockstack

concurrency:
Expand Down Expand Up @@ -40,7 +40,7 @@ jobs:
## if the repo owner is not `stacks-network`, default to a docker-org of the repo owner (i.e. github user id)
## this allows forks to run the docker push workflows without having to hardcode a dockerhub org (but it does require docker hub user to match github username)
- name: Set Local env vars
id: set_envars
id: set_env
if: |
github.repository_owner != 'stacks-network'
run: |
Expand Down Expand Up @@ -68,7 +68,6 @@ jobs:
tags: ${{ steps.docker_metadata.outputs.tags }}
labels: ${{ steps.docker_metadata.outputs.labels }}
build-args: |
REPO=${{ github.repository_owner }}/${{ github.event.repository.name }}
STACKS_NODE_VERSION=${{ env.GITHUB_SHA_SHORT }}
GIT_BRANCH=${{ env.GITHUB_REF_SHORT }}
GIT_COMMIT=${{ env.GITHUB_SHA_SHORT }}
Expand Down

0 comments on commit 11dd4d1

Please sign in to comment.