This commit is contained in:
parent
18c53acd71
commit
7f341699c1
@ -16,12 +16,24 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
cd source
|
cd source
|
||||||
./install_build_prerequisites.sh
|
./install_build_prerequisites.sh
|
||||||
- name: Build
|
- name: Build Native
|
||||||
run: |
|
run: |
|
||||||
cd source
|
cd source
|
||||||
./multibuild.sh
|
./build_native.sh
|
||||||
- name: Test
|
- name: Test
|
||||||
run: |
|
run: |
|
||||||
cd source/output
|
cd source
|
||||||
./dropshell_x86_64 list
|
./test.sh
|
||||||
./dropshell_x86_64 help
|
- name: Build Production
|
||||||
|
run: |
|
||||||
|
cd source
|
||||||
|
./build_production.sh
|
||||||
|
- name: Test
|
||||||
|
run: |
|
||||||
|
cd source
|
||||||
|
./test.sh
|
||||||
|
- name: Publish
|
||||||
|
run: |
|
||||||
|
cd source
|
||||||
|
./publish.sh
|
||||||
|
|
||||||
|
@ -21,16 +21,13 @@ fi
|
|||||||
_check_required_env_vars "AGENT_PATH"
|
_check_required_env_vars "AGENT_PATH"
|
||||||
|
|
||||||
function install_bb64() {
|
function install_bb64() {
|
||||||
curl -fsSL "https://gitea.jde.nz/public/bb64/releases/download/latest/install.sh" | bash -s -- "$AGENT_PATH" "$(id -u $USER):$(id -g $USER)"
|
if ! curl -fsSL "https://gitea.jde.nz/public/bb64/releases/download/latest/install.sh" | \
|
||||||
|
bash -s -- "$AGENT_PATH" "$(id -u "$USER"):$(id -g "$USER")"; then
|
||||||
# test result code from curl
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
_die "Failed to install bb64. Curl returned non-zero exit code."
|
_die "Failed to install bb64. Curl returned non-zero exit code."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# test if bb64 is installed
|
# test if bb64 is installed
|
||||||
VER=$("$AGENT_PATH/bb64" -v)
|
if ! VER=$("$AGENT_PATH/bb64" -v); then
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
_die "bb64 did not install correctly."
|
_die "bb64 did not install correctly."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -6,7 +6,14 @@ INSTALL_DIR=${HOME}/.local/bin
|
|||||||
mkdir -p "${OUTPUT_DIR}"
|
mkdir -p "${OUTPUT_DIR}"
|
||||||
|
|
||||||
# Exit on error
|
# Exit on error
|
||||||
set -e
|
set -euo pipefail
|
||||||
|
|
||||||
|
ARCH=$(uname -m)
|
||||||
|
if [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "aarch64" ]; then
|
||||||
|
echo "Unsupported architecture: $ARCH"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
function build_native() {
|
function build_native() {
|
||||||
local BUILDDIR=${SCRIPT_DIR}/build/native
|
local BUILDDIR=${SCRIPT_DIR}/build/native
|
||||||
@ -16,8 +23,8 @@ function build_native() {
|
|||||||
mkdir -p "${BUILDDIR}"
|
mkdir -p "${BUILDDIR}"
|
||||||
cd "${SCRIPT_DIR}" || exit 1
|
cd "${SCRIPT_DIR}" || exit 1
|
||||||
|
|
||||||
CC="${HOME}/.musl-cross/x86_64-linux-musl-native/bin/x86_64-linux-musl-gcc"
|
CC="${HOME}/.musl-cross/${ARCH}-linux-musl-native/bin/${ARCH}-linux-musl-gcc"
|
||||||
CXX="${HOME}/.musl-cross/x86_64-linux-musl-native/bin/x86_64-linux-musl-g++"
|
CXX="${HOME}/.musl-cross/${ARCH}-linux-musl-native/bin/${ARCH}-linux-musl-g++"
|
||||||
|
|
||||||
|
|
||||||
cmake -B "${BUILDDIR}" -G Ninja \
|
cmake -B "${BUILDDIR}" -G Ninja \
|
@ -1,15 +1,15 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||||
|
|
||||||
# Create output directory
|
# Create output directory
|
||||||
mkdir -p ${SCRIPT_DIR}/output
|
mkdir -p "${SCRIPT_DIR}/output"
|
||||||
|
|
||||||
|
cd "${SCRIPT_DIR}"
|
||||||
|
trap 'cd "${PREVDIR}"' EXIT
|
||||||
|
|
||||||
function build_arch() {
|
function build_arch() {
|
||||||
local arch=$1
|
local arch=$1
|
||||||
local PREVDIR=$PWD
|
|
||||||
cd ${SCRIPT_DIR}
|
|
||||||
|
|
||||||
if [ ! -f "${HOME}/.musl-cross/${arch}-linux-musl-cross/bin/${arch}-linux-musl-c++" ]; then
|
if [ ! -f "${HOME}/.musl-cross/${arch}-linux-musl-cross/bin/${arch}-linux-musl-c++" ]; then
|
||||||
echo "Musl cross compiler for ${arch} not found. Please run install_build_prerequisites.sh first."
|
echo "Musl cross compiler for ${arch} not found. Please run install_build_prerequisites.sh first."
|
||||||
@ -20,16 +20,14 @@ function build_arch() {
|
|||||||
CC="${HOME}/.musl-cross/${arch}-linux-musl-cross/bin/${arch}-linux-musl-gcc"
|
CC="${HOME}/.musl-cross/${arch}-linux-musl-cross/bin/${arch}-linux-musl-gcc"
|
||||||
CXX="${HOME}/.musl-cross/${arch}-linux-musl-cross/bin/${arch}-linux-musl-g++"
|
CXX="${HOME}/.musl-cross/${arch}-linux-musl-cross/bin/${arch}-linux-musl-g++"
|
||||||
|
|
||||||
BUILDDIR=${SCRIPT_DIR}/build/${arch}
|
BUILDDIR="${SCRIPT_DIR}/build/${arch}"
|
||||||
mkdir -p ${BUILDDIR}
|
mkdir -p "${BUILDDIR}"
|
||||||
|
|
||||||
cmake -B ${BUILDDIR} -G Ninja -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_C_COMPILER=${CC} -DCMAKE_CXX_COMPILER=${CXX}
|
cmake -B "${BUILDDIR}" -G Ninja -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" -DCMAKE_C_COMPILER="${CC}" -DCMAKE_CXX_COMPILER="${CXX}"
|
||||||
cmake --build ${BUILDDIR}
|
cmake --build "${BUILDDIR}"
|
||||||
|
|
||||||
upx ${BUILDDIR}/dropshell
|
upx "${BUILDDIR}/dropshell"
|
||||||
cp ${BUILDDIR}/dropshell ${SCRIPT_DIR}/output/dropshell.${arch}
|
cp "${BUILDDIR}/dropshell" "${SCRIPT_DIR}/output/dropshell.${arch}"
|
||||||
|
|
||||||
cd ${PREVDIR}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
build_arch x86_64
|
build_arch x86_64
|
12
source/test.sh
Normal file
12
source/test.sh
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||||
|
|
||||||
|
ARCH=$(uname -m)
|
||||||
|
|
||||||
|
PREV_DIR=$(pwd)
|
||||||
|
trap 'cd "$PREV_DIR"' EXIT
|
||||||
|
|
||||||
|
"$SCRIPT_DIR/output/dropshell_${ARCH}" list
|
||||||
|
"$SCRIPT_DIR/output/dropshell_${ARCH}" help
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user