This commit is contained in:
parent
c33ca6f4b4
commit
1e09c5c995
26
.gitea/workflows/dropshell-build.yaml
Normal file
26
.gitea/workflows/dropshell-build.yaml
Normal file
@ -0,0 +1,26 @@
|
||||
name: dropshell-build
|
||||
run-name: Build test and publish dropshell-build
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Login to Gitea
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: gitea.jde.nz
|
||||
username: DoesntMatter
|
||||
password: ${{ secrets.DOCKER_PUSH_TOKEN }}
|
||||
- name: Build
|
||||
run: |
|
||||
./build.sh
|
||||
- name: Test
|
||||
run: |
|
||||
./test.sh
|
||||
- name: Publish
|
||||
run: |
|
||||
./publish.sh
|
21
dropshell-build/Dockerfile
Normal file
21
dropshell-build/Dockerfile
Normal file
@ -0,0 +1,21 @@
|
||||
FROM debian:latest
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
cmake \
|
||||
git \
|
||||
nlohmann-json3-dev wget curl cmake ninja-build mold build-essential nodejs npm jq \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
#RUN curl -fsSL https://get.docker.com | sh
|
||||
|
||||
COPY --chmod=0755 ./src/install_dropshell_build_requirements.sh /usr/local/bin/
|
||||
COPY --chmod=0755 ./src/dropshell-build.sh /usr/local/bin/
|
||||
|
||||
RUN install_dropshell_build_requirements.sh
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ENTRYPOINT ["dropshell-build.sh","/app"]
|
||||
|
||||
|
6
dropshell-build/build.sh
Executable file
6
dropshell-build/build.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
docker build -t gitea.jde.nz/public/dropshell-build:latest .
|
||||
|
11
dropshell-build/publish.sh
Executable file
11
dropshell-build/publish.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
|
||||
"${SCRIPT_DIR}/build.sh"
|
||||
|
||||
"${SCRIPT_DIR}/sos/sos" upload "getbin.xyz" "dropshell-tool-install.sh" "${SCRIPT_DIR}/dropshell-tool-install.sh"
|
||||
|
||||
docker push gitea.jde.nz/public/dropshell-build:latest
|
@ -32,7 +32,7 @@ function help() {
|
||||
}
|
||||
|
||||
function version() {
|
||||
echo "magicbuild 0.1"
|
||||
echo "2025.0531.0942"
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------
|
||||
@ -162,13 +162,6 @@ function build_arch() {
|
||||
}
|
||||
|
||||
function build() {
|
||||
if [ -z "$1" ]; then
|
||||
help
|
||||
echo " "
|
||||
echo "Error: DIR is required"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Building project in directory $1"
|
||||
if [ ! -d "$1" ]; then
|
||||
echo "Directory $1 does not exist"
|
||||
@ -202,13 +195,39 @@ function build() {
|
||||
fi
|
||||
}
|
||||
|
||||
function buildspawn() {
|
||||
local BUILD_DIR="$1"
|
||||
if [ -z "$BUILD_DIR" ] || [ ! -d "$BUILD_DIR" ]; then
|
||||
echo "Error: builddir doesn't exist: $BUILD_DIR"
|
||||
exit 1
|
||||
fi
|
||||
# make canonical
|
||||
BUILD_DIR=$(realpath "$BUILD_DIR")
|
||||
|
||||
BUILD_VERSION_FILE="$HOME/.config/dropshell-build/version"
|
||||
if [ ! -f "$BUILD_VERSION_FILE" ]; then
|
||||
# check if docker is installed
|
||||
if ! command -v docker &> /dev/null; then
|
||||
echo "Neither dropshell-build nor docker appears to be available. Please install one of them."
|
||||
exit 1
|
||||
fi
|
||||
echo "Using Docker Buildchain."
|
||||
docker run --rm \
|
||||
-u "$(id -u)":"$(id -g)" \
|
||||
-v "$BUILD_DIR":/app \
|
||||
gitea.jde.nz/public/dropshell-build:latest
|
||||
else
|
||||
echo "Using local native buildchain"
|
||||
build "$BUILD_DIR"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------
|
||||
# MAIN
|
||||
# ----------------------------------------------------------------------------------------------------------
|
||||
|
||||
function main() {
|
||||
|
||||
while getopts "rm" opt; do
|
||||
case $opt in
|
||||
r)
|
||||
@ -227,6 +246,13 @@ function main() {
|
||||
# Shift the processed options out of the argument list
|
||||
shift $((OPTIND-1))
|
||||
|
||||
# check we have at least one argument
|
||||
if [ $# -eq 0 ]; then
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# get command argument, now that the flags are set
|
||||
CMD="$1"
|
||||
|
||||
@ -241,7 +267,7 @@ function main() {
|
||||
version
|
||||
;;
|
||||
*)
|
||||
build "$1"
|
||||
buildspawn "$1"
|
||||
;;
|
||||
esac
|
||||
}
|
@ -1,10 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
|
||||
VERSION=$(date +%Y.%m%d.%H%M)
|
||||
VERSION_FILE="$HOME/.config/dropshell-build/version"
|
||||
|
||||
# If the user is not root, use sudo
|
||||
SUDOCMD=""
|
||||
[ "$EUID" -eq 0 ] || SUDOCMD="sudo"
|
||||
@ -281,7 +283,7 @@ function install_musl_cross() {
|
||||
fi
|
||||
}
|
||||
|
||||
function installmusl() {
|
||||
function install_musl() {
|
||||
echo "Installing musl toolchain"
|
||||
|
||||
# Set install directory
|
||||
@ -316,10 +318,11 @@ function main() {
|
||||
|
||||
install_headers
|
||||
|
||||
installmusl
|
||||
install_musl
|
||||
|
||||
install_openssl_musl
|
||||
|
||||
echo "$VERSION" > "$VERSION_FILE"
|
||||
}
|
||||
|
||||
main
|
17
dropshell-build/test.sh
Executable file
17
dropshell-build/test.sh
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
|
||||
echo "Testing dropshell-build"
|
||||
|
||||
"${SCRIPT_DIR}/build.sh"
|
||||
|
||||
"${SCRIPT_DIR}/src/dropshell-build.sh" ./test
|
||||
|
||||
"${SCRIPT_DIR}/test/output/ipdemo.x86_64"
|
||||
|
||||
|
||||
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
|
||||
|
||||
|
||||
echo "wheeeee!"
|
||||
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
|
||||
|
||||
# run sos to upload dropshell-tool-install.sh
|
||||
"${SCRIPT_DIR}/sos/sos" upload "${SCRIPT_DIR}/dropshell-tool-install.sh" "dropshell-tool-install.sh"
|
||||
"${SCRIPT_DIR}/sos/sos" upload "getbin.xyz" "dropshell-tool-install.sh" "${SCRIPT_DIR}/dropshell-tool-install.sh"
|
||||
|
||||
|
||||
# build and publish all dropshell tools
|
||||
|
Loading…
x
Reference in New Issue
Block a user