Skip to content

Commit

Permalink
Merge branch 'master' into hc-release-v0.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
HCastano committed Nov 30, 2023
2 parents 863a915 + ea755ed commit f07f7ae
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ jobs:
--title "${{ needs.build.outputs.git_ref_basename }}" \
$(echo ${{ github.ref_name }} | grep --quiet -E '^test|v[0-9]\.[0-9]\.[0-9]-' && echo '--prerelease') \
--verify-tag "${{ github.ref_name }}" \
{entropy,server}_${{ needs.git-ref-basename.outputs.git_ref_basename }}_${{ runner.os }}_${{ runner.arch }}/*
{entropy,server}_${{ needs.git-ref-basename.outputs.git_ref_basename }}/*
35 changes: 35 additions & 0 deletions .github/workflows/container-build-and-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,38 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
push: true
- name: Create image export directory
id: export-dir
run: |
tmpdir=$(mktemp -d)
echo path=${tmpdir} >> $GITHUB_OUTPUT
- name: Export plain binaries from built images
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
build-args: |
PACKAGE=${{ inputs.docker_build_arg_package }}
secrets: |
credentials=${{ secrets.CI_MACHINE_USER_TOKEN }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
outputs: |
type=local,dest=${{ steps.export-dir.outputs.path }}
- name: Disambiguate binaries by platform
id: artifacts
run: |
dirname=${{ steps.export-dir.outputs.path }}
refname=${{ inputs.git_ref_basename }}
package=${{ inputs.docker_build_arg_package }}
artifact_dir=$(mktemp -d)
for platform in linux_amd64 linux_arm64; do
cp ${dirname}/${platform}/usr/local/bin/${package} ${artifact_dir}/${package}_${refname}_${platform}
done
echo dir="${artifact_dir}" >> $GITHUB_OUTPUT
- name: Upload ${{ inputs.docker_build_arg_package }} binary artifact
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.docker_build_arg_package}}_${{ inputs.git_ref_basename }}
path: ${{ steps.artifacts.outputs.dir }}/${{ inputs.docker_build_arg_package }}*
if-no-files-found: error
retention-days: 5
13 changes: 6 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@ ARG RUST_STABLE_VERSION=1.73.0
ARG DEBIAN_CODENAME=bullseye
# Version of Ubuntu to deploy with.
ARG UBUNTU_VERSION=20.04
# Whether or not to `strip(1)` the binaries. See:
# https://doc.rust-lang.org/rustc/codegen-options/index.html#strip
ARG STRIP=symbols

FROM --platform=$BUILDPLATFORM docker.io/library/debian:${DEBIAN_CODENAME}-20230522-slim as build
ARG TARGETPLATFORM
ARG PACKAGE
ARG RUST_STABLE_VERSION
ARG UBUNTU_VERSION
ARG STRIP

# Prepare and cache build dependencies, to speed up subsequent runs.
RUN rm -f /etc/apt/apt.conf.d/docker-clean; \
Expand All @@ -29,7 +25,8 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
git bash curl ca-certificates openssh-client \
pkg-config protobuf-compiler make clang \
openssl libssl-dev libssl-dev:arm64 \
gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
binutils \
gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu

# Install Rust and its componentry for the current build target.
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
Expand Down Expand Up @@ -82,17 +79,19 @@ RUN --mount=type=ssh \
> ~/.ssh/known_hosts \
&& if [ "amd64" = ${TARGETPLATFORM#"linux/"} ]; then \
export RUST_PLATFORM=x86_64; \
export BINUTILS_PATH=/usr/bin; \
else \
export RUST_PLATFORM=aarch64; \
export BINUTILS_PATH=/usr/${RUST_PLATFORM}-linux-gnu/bin; \
fi; $HOME/.cargo/bin/rustup target add "${RUST_PLATFORM}-unknown-linux-gnu" \
&& if [ "linux/arm64" = "${TARGETPLATFORM}" ]; then \
export PKG_CONFIG_SYSROOT_DIR="/usr/aarch64-linux-gnu"; \
export BINDGEN_EXTRA_CLANG_ARGS="-I/usr/aarch64-linux-gnu/include/"; \
fi; CARGO_NET_GIT_FETCH_WITH_CLI=true \
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER="cc" \
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER="aarch64-linux-gnu-gcc" \
$HOME/.cargo/bin/cargo rustc --release -p "${PACKAGE}" --target "${RUST_PLATFORM}-unknown-linux-gnu" \
-- -C strip="${STRIP}" \
$HOME/.cargo/bin/cargo build --release -p "${PACKAGE}" --target "${RUST_PLATFORM}-unknown-linux-gnu" \
&& ${BINUTILS_PATH}/strip "target/${RUST_PLATFORM}-unknown-linux-gnu/release/${PACKAGE}" \
&& install "target/${RUST_PLATFORM}-unknown-linux-gnu/release/${PACKAGE}" /usr/local/bin

# Next stage will contain just our built binary, without dependencies.
Expand Down

0 comments on commit f07f7ae

Please sign in to comment.