Build for linux
Some checks failed
Publish Builder Images / setup (push) Successful in 41s
Publish Builder Images / build-base (push) Failing after 24s
Publish Builder Images / build-targets (Dockerfile.linux, linux) (push) Has been skipped
Publish Builder Images / build-targets (Dockerfile.windows, windows) (push) Has been skipped

This commit is contained in:
2025-12-03 18:29:00 +01:00
parent 513d6efc25
commit f80308b565
7 changed files with 156 additions and 122 deletions

View File

@ -3,20 +3,30 @@ on:
push: push:
paths: paths:
- 'Dockerfile.*' - 'Dockerfile.*'
- '*.sh' - 'workflows/scripts/*.sh'
jobs: jobs:
# JOB 1: Handles the Fedora Base # JOB 1: Setup & Calculate Short SHA
setup:
runs-on: ubuntu-latest
steps:
- name: Set Short SHA
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
outputs:
short_sha: ${{ env.SHORT_SHA }}
# JOB 2: Build Base (Cached)
build-base: build-base:
needs: setup
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Make scripts executable - name: Make scripts executable
run: chmod +x *.sh run: chmod +x workflows/scripts/*.sh
- name: Build/Cache Base - name: Build Base
uses: docker://quay.io/buildah/stable uses: docker://quay.io/buildah/stable
env: env:
USERNAME: ${{ gitea.repository_owner }} USERNAME: ${{ gitea.repository_owner }}
@ -24,28 +34,36 @@ jobs:
REGISTRY: gitea.212.63.210.91.nip.io REGISTRY: gitea.212.63.210.91.nip.io
with: with:
entrypoint: /bin/sh entrypoint: /bin/sh
args: ./build-base.sh args: workflows/scripts/build-base.sh
# JOB 2: Handles the Windows Builder # JOB 3: Build Targets (Matrix)
# Only runs if Base succeeds. build-targets:
build-windows: needs: [setup, build-base]
needs: build-base
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: windows
dockerfile: Dockerfile.windows
- name: linux
dockerfile: Dockerfile.linux
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Make scripts executable - name: Make scripts executable
run: chmod +x *.sh run: chmod +x workflows/scripts/*.sh
- name: Build Windows Target - name: Build ${{ matrix.name }}
uses: docker://quay.io/buildah/stable uses: docker://quay.io/buildah/stable
env: env:
USERNAME: ${{ gitea.repository_owner }} USERNAME: ${{ gitea.repository_owner }}
PASSWORD: ${{ secrets.USER_PACKAGE_PASSWORD }} PASSWORD: ${{ secrets.USER_PACKAGE_PASSWORD }}
REGISTRY: gitea.212.63.210.91.nip.io REGISTRY: gitea.212.63.210.91.nip.io
# We pass the Git SHA here for the final image tag TAG: ${{ needs.setup.outputs.short_sha }}
TAG: ${{ gitea.sha }}
with: with:
entrypoint: /bin/sh entrypoint: /bin/sh
args: ./build-windows.sh # Pass the matrix variables to our generic script
args: -c "./workflows/scripts/build-target.sh ${{ matrix.name }} ${{ matrix.dockerfile }}"

View File

@ -0,0 +1,35 @@
#!/bin/sh
set -e
# --- Configuration ---
IMAGE_NAME="godot-builder-base"
# We hash the Dockerfile to create a unique cache key
FILE_HASH=$(sha256sum Dockerfile.base | cut -c 1-8)
FULL_TAG="$REGISTRY/$USERNAME/$IMAGE_NAME:$FILE_HASH"
LATEST_TAG="$REGISTRY/$USERNAME/$IMAGE_NAME:latest"
echo "Logging in..."
buildah login -u "$USERNAME" -p "$PASSWORD" --tls-verify=false "$REGISTRY"
echo "Checking if base image $FULL_TAG exists..."
# If we can pull it, we don't need to build it!
if buildah pull --tls-verify=false "$FULL_TAG"; then
echo "✅ Cache Hit! Base image exists. Skipping build."
# Just re-tag 'latest' to point to this valid existing image
buildah tag "$FULL_TAG" "$LATEST_TAG"
buildah push --tls-verify=false "$LATEST_TAG"
exit 0
fi
echo "⚠️ Cache Miss. Building new base image..."
buildah build \
--tls-verify=false \
-f Dockerfile.base \
-t "$FULL_TAG" \
-t "$LATEST_TAG" \
.
echo "Pushing base image..."
buildah push --tls-verify=false "$FULL_TAG"
buildah push --tls-verify=false "$LATEST_TAG"

View File

@ -0,0 +1,46 @@
#!/bin/sh
set -e
# Arguments passed from YAML:
# $1 = Target Name (e.g., windows, linux)
# $2 = Dockerfile Path (e.g., Dockerfile.windows)
TARGET_NAME="$1"
DOCKERFILE="$2"
IMAGE_NAME="godot-builder-$TARGET_NAME"
# Determine Base Tag (Must match logic in build-base.sh!)
BASE_HASH=$(sha256sum Dockerfile.base | cut -c 1-8)
BASE_FULL_TAG="$REGISTRY/$USERNAME/godot-builder-base:$BASE_HASH"
# Target Tags (Using the Commit SHA passed from workflow)
FULL_TAG="$REGISTRY/$USERNAME/$IMAGE_NAME:$TAG"
LATEST_TAG="$REGISTRY/$USERNAME/$IMAGE_NAME:latest"
echo "Logging in..."
buildah login -u "$USERNAME" -p "$PASSWORD" --tls-verify=false "$REGISTRY"
echo "---------------------------------------"
echo "Building $TARGET_NAME Image..."
echo "Using Base: $BASE_FULL_TAG"
echo "---------------------------------------"
# 1. Pull the Base (Required so Buildah knows about it)
buildah pull --tls-verify=false "$BASE_FULL_TAG"
# 2. Create Local Alias
# This satisfies "FROM godot-fedora:custom" in your Dockerfiles
buildah tag "$BASE_FULL_TAG" "godot-fedora:custom"
# 3. Build Target
buildah build \
--tls-verify=false \
--build-arg img_version=custom \
-f "$DOCKERFILE" \
-t "$FULL_TAG" \
-t "$LATEST_TAG" \
.
echo "Pushing $TARGET_NAME image..."
buildah push --tls-verify=false "$FULL_TAG"
buildah push --tls-verify=false "$LATEST_TAG"

35
Dockerfile.linux Normal file
View File

@ -0,0 +1,35 @@
ARG img_version
FROM godot-fedora:${img_version}
ENV GODOT_SDK_LINUX_X86_64=/root/x86_64-godot-linux-gnu_sdk-buildroot
ENV GODOT_SDK_LINUX_X86_32=/root/i686-godot-linux-gnu_sdk-buildroot
ENV GODOT_SDK_LINUX_ARM64=/root/aarch64-godot-linux-gnu_sdk-buildroot
ENV GODOT_SDK_LINUX_ARM32=/root/arm-godot-linux-gnueabihf_sdk-buildroot
ENV BASE_PATH=${PATH}
RUN dnf install -y wayland-devel && \
curl -LO https://github.com/godotengine/buildroot/releases/download/godot-2023.08.x-4/x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2 && \
tar xf x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2 && \
rm -f x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2 && \
cd x86_64-godot-linux-gnu_sdk-buildroot && \
./relocate-sdk.sh && \
cd /root && \
curl -LO https://github.com/godotengine/buildroot/releases/download/godot-2023.08.x-4/i686-godot-linux-gnu_sdk-buildroot.tar.bz2 && \
tar xf i686-godot-linux-gnu_sdk-buildroot.tar.bz2 && \
rm -f i686-godot-linux-gnu_sdk-buildroot.tar.bz2 && \
cd i686-godot-linux-gnu_sdk-buildroot && \
./relocate-sdk.sh && \
cd /root && \
curl -LO https://github.com/godotengine/buildroot/releases/download/godot-2023.08.x-4/aarch64-godot-linux-gnu_sdk-buildroot.tar.bz2 && \
tar xf aarch64-godot-linux-gnu_sdk-buildroot.tar.bz2 && \
rm -f aarch64-godot-linux-gnu_sdk-buildroot.tar.bz2 && \
cd aarch64-godot-linux-gnu_sdk-buildroot && \
./relocate-sdk.sh && \
cd /root && \
curl -LO https://github.com/godotengine/buildroot/releases/download/godot-2023.08.x-4/arm-godot-linux-gnueabihf_sdk-buildroot.tar.bz2 && \
tar xf arm-godot-linux-gnueabihf_sdk-buildroot.tar.bz2 && \
rm -f arm-godot-linux-gnueabihf_sdk-buildroot.tar.bz2 && \
cd arm-godot-linux-gnueabihf_sdk-buildroot && \
./relocate-sdk.sh
CMD /bin/bash

View File

@ -4,15 +4,14 @@ FROM godot-fedora:${img_version}
RUN dnf -y install --setopt=install_weak_deps=False \ RUN dnf -y install --setopt=install_weak_deps=False \
mingw32-gcc mingw32-gcc-c++ mingw32-winpthreads-static mingw64-gcc mingw64-gcc-c++ mingw64-winpthreads-static mingw32-gcc mingw32-gcc-c++ mingw32-winpthreads-static mingw64-gcc mingw64-gcc-c++ mingw64-winpthreads-static
ENV LLVM_MINGW_NAME=llvm-mingw-20250528-ucrt-ubuntu-22.04-x86_64 ENV LLVM_MINGW_VERSION=20250528
ENV LLVM_MINGW_NAME=llvm-mingw-${LLVM_MINGW_VERSION}-ucrt-ubuntu-22.04-x86_64
# Use a wildcard so we don't have to worry about variable expansion issues in COPY # DIRECT DOWNLOAD (Now works because MTU is fixed!)
COPY llvm-mingw-*.tar.xz . RUN curl -LO "https://github.com/mstorsjo/llvm-mingw/releases/download/${LLVM_MINGW_VERSION}/${LLVM_MINGW_NAME}.tar.xz" && \
tar xf "${LLVM_MINGW_NAME}.tar.xz" && \
# Extract and Install rm -f "${LLVM_MINGW_NAME}.tar.xz" && \
RUN tar xf ${LLVM_MINGW_NAME}.tar.xz && \ mv "${LLVM_MINGW_NAME}" /root/llvm-mingw
rm -f ${LLVM_MINGW_NAME}.tar.xz && \
mv ${LLVM_MINGW_NAME} /root/llvm-mingw
ENV PATH="/root/llvm-mingw/bin:${PATH}" ENV PATH="/root/llvm-mingw/bin:${PATH}"

View File

@ -1,38 +0,0 @@
#!/bin/sh
set -e
# --- Configuration ---
IMAGE_NAME="godot-builder-base"
# Calculate a short hash based purely on the file content
# If you don't change the file, this hash stays the same!
FILE_HASH=$(sha256sum Dockerfile.base | cut -c 1-8)
FULL_TAG="$REGISTRY/$USERNAME/$IMAGE_NAME:$FILE_HASH"
LATEST_TAG="$REGISTRY/$USERNAME/$IMAGE_NAME:latest"
echo "Logging in..."
buildah login -u "$USERNAME" -p "$PASSWORD" --tls-verify=false --storage-driver=vfs "$REGISTRY"
echo "Checking if base image $FULL_TAG exists..."
# Try to pull the specific hash. If it works, we are done!
if buildah pull --tls-verify=false --storage-driver=vfs "$FULL_TAG"; then
echo "✅ Cache Hit! Image already exists. Skipping build."
# Retag it as 'latest' just to be safe for other jobs
buildah tag --storage-driver=vfs "$FULL_TAG" "$LATEST_TAG"
buildah push --tls-verify=false --storage-driver=vfs "$LATEST_TAG"
exit 0
fi
echo "⚠️ Cache Miss. Building new base image..."
buildah build \
--tls-verify=false \
--storage-driver=vfs \
--network=host \
-f Dockerfile.base \
-t "$FULL_TAG" \
-t "$LATEST_TAG" \
.
echo "Pushing new base image..."
buildah push --tls-verify=false --storage-driver=vfs "$FULL_TAG"
buildah push --tls-verify=false --storage-driver=vfs "$LATEST_TAG"

View File

@ -1,61 +0,0 @@
#!/bin/sh
set -e
# --- Configuration ---
BASE_IMAGE_NAME="godot-builder-base"
WIN_IMAGE_NAME="godot-builder-windows"
# We need the SAME hash logic to find the right base
BASE_HASH=$(sha256sum Dockerfile.base | cut -c 1-8)
BASE_TAG="$REGISTRY/$USERNAME/$BASE_IMAGE_NAME:$BASE_HASH"
# For the Windows image, we still use the Git SHA (passed from workflow)
# because we want a new Windows builder for every code commit.
WIN_TAG="$REGISTRY/$USERNAME/$WIN_IMAGE_NAME:$TAG"
TARBALL="llvm-mingw-20250528-ucrt-ubuntu-22.04-x86_64.tar.xz"
echo "Logging in..."
buildah login -u "$USERNAME" -p "$PASSWORD" --tls-verify=false --storage-driver=vfs "$REGISTRY"
echo "---------------------------------------"
echo "Preparing Base Image..."
echo "---------------------------------------"
# Pull the base (which build-base.sh guaranteed exists)
buildah pull --tls-verify=false --storage-driver=vfs "$BASE_TAG"
# Create the local alias so Dockerfile.windows finds it
# This satisfies: FROM godot-fedora:custom
buildah tag --storage-driver=vfs "$BASE_TAG" "godot-fedora:custom"
echo "---------------------------------------"
echo "Preparing Context..."
echo "---------------------------------------"
# Check if the file exists in the 'files/' folder (provided by actions/checkout)
if [ -f "files/$TARBALL" ]; then
echo "✅ Found local tarball in repository. Copying to build context..."
cp "files/$TARBALL" .
else
echo "❌ CRITICAL ERROR: $TARBALL not found in 'files/' directory!"
echo "Did you forget to git add/push the file?"
exit 1
fi
echo "---------------------------------------"
echo "Building Windows Image..."
echo "---------------------------------------"
buildah build \
--tls-verify=false \
--storage-driver=vfs \
--network=host \
--build-arg img_version=custom \
-f Dockerfile.windows \
-t "$WIN_TAG" \
-t "$REGISTRY/$USERNAME/$WIN_IMAGE_NAME:latest" \
.
echo "Pushing Windows image..."
buildah push --tls-verify=false --storage-driver=vfs "$WIN_TAG"
buildah push --tls-verify=false --storage-driver=vfs "$REGISTRY/$USERNAME/$WIN_IMAGE_NAME:latest"