Run in buildah
Some checks failed
Build Godot Engine / Build Windows ${{ matrix.name }} (godot-windows-debug, Debug Template, no, template_debug) (push) Failing after 19s
Build Godot Engine / Build Windows ${{ matrix.name }} (godot-windows-editor, Editor, yes, editor) (push) Failing after 18s
Build Godot Engine / Build Windows ${{ matrix.name }} (godot-windows-release, Release Template, yes, template_release) (push) Has been cancelled
Some checks failed
Build Godot Engine / Build Windows ${{ matrix.name }} (godot-windows-debug, Debug Template, no, template_debug) (push) Failing after 19s
Build Godot Engine / Build Windows ${{ matrix.name }} (godot-windows-editor, Editor, yes, editor) (push) Failing after 18s
Build Godot Engine / Build Windows ${{ matrix.name }} (godot-windows-release, Release Template, yes, template_release) (push) Has been cancelled
This commit is contained in:
@ -1,42 +1,26 @@
|
|||||||
name: Build Godot Engine
|
name: Build Godot Engine
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: ["customized-moa"]
|
branches: [ "customized-moa" ]
|
||||||
create:
|
|
||||||
tags:
|
|
||||||
- "v*"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-engine:
|
build-windows:
|
||||||
name: Build Engine
|
name: Build Windows ${{ matrix.name }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
# Run on Host (so Checkout works)
|
||||||
# Run the entire job inside your new builder container
|
|
||||||
container:
|
|
||||||
image: gitea.212.63.210.91.nip.io/${{ gitea.repository_owner }}/godot-builder-windows:513d6efc259bb974ee2078adfa5f0994d0796a57
|
|
||||||
# Credentials are required to pull from your private registry
|
|
||||||
credentials:
|
|
||||||
username: ${{ gitea.actor }}
|
|
||||||
password: ${{ secrets.USER_PACKAGE_PASSWORD }}
|
|
||||||
# Note: If this fails to pull due to SSL, we may need to use a 'docker run' step approach instead.
|
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
# Windows Editor
|
|
||||||
- name: Editor
|
- name: Editor
|
||||||
target: editor
|
target: editor
|
||||||
production: yes
|
production: yes
|
||||||
artifact_name: godot-windows-editor
|
artifact_name: godot-windows-editor
|
||||||
|
|
||||||
# Windows Debug Template (For testing game logic)
|
|
||||||
- name: Debug Template
|
- name: Debug Template
|
||||||
target: template_debug
|
target: template_debug
|
||||||
production: no
|
production: no
|
||||||
artifact_name: godot-windows-debug
|
artifact_name: godot-windows-debug
|
||||||
|
|
||||||
# Windows Release Template (For final export)
|
|
||||||
- name: Release Template
|
- name: Release Template
|
||||||
target: template_release
|
target: template_release
|
||||||
production: yes
|
production: yes
|
||||||
@ -48,64 +32,20 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
# NEW STEP: Patch the build file to force linking HID
|
|
||||||
- name: Patch SCons for Fedora
|
|
||||||
run: |
|
|
||||||
# Find the line defining LIBS and inject 'hid' and 'setupapi'
|
|
||||||
# This ensures they come AFTER the object files
|
|
||||||
sed -i "s/env.Append(LIBS=\['mingw32'/env.Append(LIBS=\['mingw32', 'hid', 'setupapi'/" platform/windows/detect.py
|
|
||||||
|
|
||||||
# Optional: Verify the change
|
|
||||||
grep "env.Append(LIBS=" platform/windows/detect.py
|
|
||||||
|
|
||||||
- name: Compile with SCons
|
- name: Compile with SCons
|
||||||
run: |
|
uses: docker://quay.io/buildah/stable
|
||||||
# --- SMART CORE DETECTION ---
|
env:
|
||||||
# Default to hardware limit if no quota is found
|
REGISTRY: gitea.212.63.210.91.nip.io
|
||||||
REAL_CORES=$(nproc)
|
IMAGE_TAG: godot-builder-windows:513d6efc259bb974ee2078adfa5f0994d0796a57
|
||||||
|
USERNAME: ${{ gitea.actor }}
|
||||||
# Check Cgroup V2 (Fedora / Modern K8s)
|
PASSWORD: ${{ secrets.USER_PACKAGE_PASSWORD }}
|
||||||
if [ -f /sys/fs/cgroup/cpu.max ]; then
|
with:
|
||||||
# Read quota and period (e.g., "700000 100000")
|
entrypoint: /bin/sh
|
||||||
read QUOTA PERIOD < /sys/fs/cgroup/cpu.max
|
# Just run the file! No messy YAML strings.
|
||||||
if [ "$QUOTA" != "max" ]; then
|
args: .gitea/workflows/scripts/build-with-buildah.sh
|
||||||
# Calculate limit: Quota / Period (e.g., 700000 / 100000 = 7)
|
|
||||||
REAL_CORES=$(( QUOTA / PERIOD ))
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check Cgroup V1 (Older K8s / Docker)
|
|
||||||
elif [ -f /sys/fs/cgroup/cpu/cpu.cfs_quota_us ]; then
|
|
||||||
QUOTA=$(cat /sys/fs/cgroup/cpu/cpu.cfs_quota_us)
|
|
||||||
PERIOD=$(cat /sys/fs/cgroup/cpu/cpu.cfs_period_us)
|
|
||||||
if [ "$QUOTA" -gt 0 ]; then
|
|
||||||
REAL_CORES=$(( QUOTA / PERIOD ))
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Safety: Ensure we use at least 1 core
|
|
||||||
if [ "$REAL_CORES" -lt 1 ]; then REAL_CORES=1; fi
|
|
||||||
|
|
||||||
echo "Hardware has $(nproc) cores. Container limit is ${REAL_CORES} cores."
|
|
||||||
# -----------------------------
|
|
||||||
|
|
||||||
echo "Compiling ${{ matrix.name }}..."
|
|
||||||
|
|
||||||
# Godot 4 SCons Command
|
|
||||||
nice -n 10 scons platform=windows \
|
|
||||||
target=${{ matrix.target }} \
|
|
||||||
d3d12=no \
|
|
||||||
arch=x86_64 \
|
|
||||||
precision=double \
|
|
||||||
production=${{ matrix.production }} \
|
|
||||||
LINKFLAGS="-lhid -lsetupapi" \
|
|
||||||
-j$REAL_CORES
|
|
||||||
|
|
||||||
- name: Verify Output
|
|
||||||
run: ls -l bin/
|
|
||||||
|
|
||||||
- name: Upload Artifacts
|
- name: Upload Artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.artifact_name }}
|
name: ${{ matrix.artifact_name }}
|
||||||
# Corrected from *.dll to *.exe (Godot templates are executables)
|
path: bin/*.exe
|
||||||
path: bin/*.exe
|
|
||||||
49
.gitea/workflows/scripts/build-with-buildah.sh
Normal file
49
.gitea/workflows/scripts/build-with-buildah.sh
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e # Exit on error
|
||||||
|
|
||||||
|
# --- 1. CONFIGURATION ---
|
||||||
|
# We read these from Environment Variables passed by the workflow
|
||||||
|
# This makes the script reusable for Windows, Linux, etc.
|
||||||
|
FULL_IMAGE_URL="$REGISTRY/$OWNER/$IMAGE_NAME:$IMAGE_TAG"
|
||||||
|
|
||||||
|
echo "------------------------------------------------"
|
||||||
|
echo "Task Runner: Starting Buildah Orchestration"
|
||||||
|
echo "Target: $PLATFORM / $TARGET"
|
||||||
|
echo "Image: $FULL_IMAGE_URL"
|
||||||
|
echo "------------------------------------------------"
|
||||||
|
|
||||||
|
# --- 2. LOGIN ---
|
||||||
|
echo "Logging into registry..."
|
||||||
|
# Note: We use --password-stdin for security so the secret isn't in process list
|
||||||
|
echo "$PASSWORD" | buildah login -u "$USERNAME" --password-stdin --tls-verify=false --storage-driver=vfs "$REGISTRY"
|
||||||
|
|
||||||
|
# --- 3. CREATE CONTAINER ---
|
||||||
|
echo "Pulling image and creating working container..."
|
||||||
|
# We capture the Container ID (CTR)
|
||||||
|
CTR=$(buildah from --tls-verify=false --storage-driver=vfs "$FULL_IMAGE_URL")
|
||||||
|
|
||||||
|
# --- 4. EXECUTE BUILD ---
|
||||||
|
echo "Running SCons inside container..."
|
||||||
|
|
||||||
|
# Explaining the flags:
|
||||||
|
# -v "$PWD":/src -> Mounts the host workspace (your code) into the container at /src
|
||||||
|
# -w /src -> Sets working directory to /src
|
||||||
|
# --env ... -> Passes variables needed strictly for the build (optional)
|
||||||
|
# scons ... -> The actual compile command
|
||||||
|
|
||||||
|
buildah run \
|
||||||
|
--volume "$PWD":/src \
|
||||||
|
--working-dir /src \
|
||||||
|
"$CTR" \
|
||||||
|
scons platform="$PLATFORM" \
|
||||||
|
target="$TARGET" \
|
||||||
|
arch=x86_64 \
|
||||||
|
precision=double \
|
||||||
|
production="$PRODUCTION" \
|
||||||
|
use_llvm=yes \
|
||||||
|
use_mingw=yes \
|
||||||
|
-j$(nproc)
|
||||||
|
|
||||||
|
# --- 5. CLEANUP ---
|
||||||
|
echo "Build successful. Removing container..."
|
||||||
|
buildah rm "$CTR"
|
||||||
Reference in New Issue
Block a user