Skip to content

Build Ark Linux Release #17

Build Ark Linux Release

Build Ark Linux Release #17

Workflow file for this run

name: "Build Ark Linux Release"
on:
workflow_call:
inputs:
version:
required: false
description: "The Ark version"
default: ${{ github.sha }}
type: string
workflow_dispatch:
jobs:
build_linux:
name: Build Linux
runs-on: ubuntu-latest
timeout-minutes: 60
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEBUG_FLAG: ${{ matrix.flavor == 'debug' && '-debug' || '' }}
TARGET_FLAG: ${{ matrix.flavor == 'release' && '--release' || '' }}
ARCH_FLAG: ${{ matrix.arch == 'x64' && 'x86_64' || 'aarch64' }}
GLIBC_MAX_VERSION: '2.26' # Sufficiently old for all our target platforms
strategy:
matrix:
arch: [arm64, x64]
flavor: [release]
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup Build Environment
run: |
sudo apt-get update
sudo apt-get install -y cargo
# We're linking with zig to select the libc version
cargo install --locked cargo-zigbuild
sudo apt install python3-pip
pip3 install ziglang
# Install static OpenSSL
sudo apt-get install -y libssl-dev
# The openssl-sys crate expects to see all headers in one place but
# Ubuntu puts configured headers in an arch-specific folder. We
# merge these folders as a workaround.
sudo cp /usr/include/${ARCH_FLAG}-linux-gnu/openssl/* /usr/include/openssl
- name: Compile ARK (${{ matrix.flavor }})
run: |
cargo clean
# Instruct the openssl-sys crate to link to libssl statically.
# This is important for portability because distributions have
# various requirements for their dynamic libssl libraries.
export OPENSSL_STATIC=yes
export OPENSSL_LIB_DIR=/usr/lib/${ARCH_FLAG}-linux-gnu
export OPENSSL_INCLUDE_DIR=/usr/include
# Use the zig linker. This allows linking to a specific version of glibc.
# We use a sufficiently old version that is available on all platforms we target.
# See https://github.com/ziglang/glibc-abi-tool
cargo zigbuild --target ${ARCH_FLAG}-unknown-linux-gnu.$GLIBC_MAX_VERSION $TARGET_FLAG
# Compress kernel to a zip file
- name: Create archive
run: |
# Enter the build directory
pushd target/${ARCH_FLAG}-unknown-linux-gnu/${{ matrix.flavor }}
# Compress the kernel to an archive
ARCHIVE="$GITHUB_WORKSPACE/ark-${{ inputs.version }}-${{ matrix.flavor }}-linux-${{ matrix.arch }}.zip"
[ -e LICENSE ] || cp "$GITHUB_WORKSPACE/LICENSE" LICENSE
[ -e NOTICE ] || cp "$GITHUB_WORKSPACE/crates/ark/NOTICE" NOTICE
zip -Xry $ARCHIVE ark LICENSE NOTICE
popd
- name: Upload archive
uses: actions/upload-artifact@v3
with:
name: ark-${{ matrix.flavor }}-linux-${{ matrix.arch }}-archive
path: ark-${{ inputs.version }}-${{ matrix.flavor }}-linux-${{ matrix.arch }}.zip