Skip to content

Build and Test

Build and Test #10

name: Build and Test
on:
workflow_dispatch:
workflow_call:
outputs:
addon-artifact:
description: "Name of the addon artifact"
value: godot-addon
jobs:
test-runtime:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run runtime tests
run: cargo test --manifest-path runtime/Cargo.toml
build-linux-release:
needs: test-runtime
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: docker/
load: true
tags: bobbin-build
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build Linux release
run: docker run --rm -v ${{ github.workspace }}:/workspace bobbin-build linux release --ci
- name: Upload Linux release binary
uses: actions/upload-artifact@v4
with:
name: linux-release
path: bindings/godot/addons/bobbin/bin/libbobbin_godot.so
build-linux-debug:
needs: test-runtime
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: docker/
load: true
tags: bobbin-build
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build Linux debug
run: docker run --rm -v ${{ github.workspace }}:/workspace bobbin-build linux debug --ci
- name: Upload Linux debug binary
uses: actions/upload-artifact@v4
with:
name: linux-debug
path: bindings/godot/addons/bobbin/bin/libbobbin_godot.debug.so
build-windows-release:
needs: test-runtime
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: docker/
load: true
tags: bobbin-build
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build Windows release
run: docker run --rm -v ${{ github.workspace }}:/workspace bobbin-build windows release --ci
- name: Upload Windows release binary
uses: actions/upload-artifact@v4
with:
name: windows-release
path: bindings/godot/addons/bobbin/bin/bobbin_godot.dll
build-windows-debug:
needs: test-runtime
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: docker/
load: true
tags: bobbin-build
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build Windows debug
run: docker run --rm -v ${{ github.workspace }}:/workspace bobbin-build windows debug --ci
- name: Upload Windows debug binary
uses: actions/upload-artifact@v4
with:
name: windows-debug
path: bindings/godot/addons/bobbin/bin/bobbin_godot.debug.dll
build-wasm:
needs: test-runtime
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: docker/
load: true
tags: bobbin-build
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build WASM
run: docker run --rm -v ${{ github.workspace }}:/workspace bobbin-build wasm --ci
- name: Upload WASM binary
uses: actions/upload-artifact@v4
with:
name: wasm-binary
path: bindings/godot/addons/bobbin/bin/bobbin_godot.wasm
build-macos:
needs: test-runtime
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Download Godot 4.3
run: |
curl -L -o godot.zip https://github.com/godotengine/godot/releases/download/4.3-stable/Godot_v4.3-stable_macos.universal.zip
unzip godot.zip
echo "GODOT4_BIN=${{ github.workspace }}/Godot.app/Contents/MacOS/Godot" >> $GITHUB_ENV
- name: Install Rust nightly
run: |
rustup toolchain install nightly
rustup component add rust-src --toolchain nightly
- name: Set LLVM path
run: echo "LLVM_PATH=$(brew --prefix llvm)" >> $GITHUB_ENV
- name: Build release
run: cargo +nightly build --manifest-path bindings/godot/Cargo.toml --release
- name: Build debug
run: cargo +nightly build --manifest-path bindings/godot/Cargo.toml
- name: Upload macOS binaries
uses: actions/upload-artifact@v4
with:
name: macos-binaries
path: |
bindings/godot/target/release/libbobbin_godot.dylib
bindings/godot/target/debug/libbobbin_godot.dylib
test-linux:
needs: build-linux-debug
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup addon directory
run: |
mkdir -p tests/godot_project/addons/bobbin/bin/
cp -r bindings/godot/addons/bobbin/* tests/godot_project/addons/bobbin/
- name: Download Linux debug binary
uses: actions/download-artifact@v4
with:
name: linux-debug
path: tests/godot_project/addons/bobbin/bin/
- name: Verify addon setup
run: ls -la tests/godot_project/addons/bobbin/bin/
- name: Download Godot 4.3
run: |
wget -q https://github.com/godotengine/godot/releases/download/4.3-stable/Godot_v4.3-stable_linux.x86_64.zip
unzip Godot_v4.3-stable_linux.x86_64.zip
chmod +x Godot_v4.3-stable_linux.x86_64
- name: Import project
run: ./Godot_v4.3-stable_linux.x86_64 --headless --path tests/godot_project --import --quit || true
- name: Run smoke test
run: |
# gdext may crash during shutdown even when tests pass, so check output
output=$(./Godot_v4.3-stable_linux.x86_64 --headless --path tests/godot_project -s res://smoke_test.gd --quit 2>&1) || true
echo "$output"
if echo "$output" | grep -q "All smoke tests passed"; then
echo "Tests passed!"
exit 0
else
echo "Tests failed!"
exit 1
fi
test-windows:
needs: build-windows-debug
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup addon directory
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path tests/godot_project/addons/bobbin/bin/
Copy-Item -Path bindings/godot/addons/bobbin/* -Destination tests/godot_project/addons/bobbin/ -Recurse -Force
- name: Download Windows debug binary
uses: actions/download-artifact@v4
with:
name: windows-debug
path: tests/godot_project/addons/bobbin/bin/
- name: Verify addon setup
shell: pwsh
run: |
Write-Host "=== Addon bin directory ==="
Get-ChildItem tests/godot_project/addons/bobbin/bin/ -ErrorAction SilentlyContinue
Write-Host "=== Full addon structure ==="
Get-ChildItem tests/godot_project/addons/bobbin/ -Recurse
Write-Host "=== GDExtension file contents ==="
Get-Content tests/godot_project/addons/bobbin/bobbin.gdextension
- name: Check DLL dependencies
shell: pwsh
run: |
$dllPath = "tests/godot_project/addons/bobbin/bin/bobbin_godot.debug.dll"
Write-Host "=== Checking DLL: $dllPath ==="
if (Test-Path $dllPath) {
Write-Host "DLL exists, size: $((Get-Item $dllPath).Length) bytes"
# Try to load the DLL to see if it has missing dependencies
try {
$bytes = [System.IO.File]::ReadAllBytes($dllPath)
Write-Host "DLL is readable, first bytes: $($bytes[0..3] -join ',')"
# Check PE header
if ($bytes[0] -eq 77 -and $bytes[1] -eq 90) {
Write-Host "Valid PE header (MZ)"
}
} catch {
Write-Host "Error reading DLL: $_"
}
} else {
Write-Host "DLL NOT FOUND!"
}
- name: Download Godot 4.3
shell: pwsh
run: |
Invoke-WebRequest -Uri "https://github.com/godotengine/godot/releases/download/4.3-stable/Godot_v4.3-stable_win64.exe.zip" -OutFile godot.zip
Expand-Archive godot.zip -DestinationPath .
- name: Import project
shell: pwsh
run: |
# gdext may crash during import shutdown - ignore exit code
Write-Host "=== Importing project ==="
$output = & ./Godot_v4.3-stable_win64.exe --headless --path tests/godot_project --import --quit 2>&1 | Out-String
Write-Host $output
Write-Host "=== Import complete (crash during shutdown is expected) ==="
exit 0
- name: Run smoke test
shell: pwsh
run: |
# gdext may crash during shutdown even when tests pass, so check output
$output = & ./Godot_v4.3-stable_win64.exe --headless --path tests/godot_project -s res://smoke_test.gd --quit 2>&1 | Out-String
Write-Host $output
if ($output -match "All smoke tests passed") {
Write-Host "Tests passed!"
exit 0
} else {
Write-Host "Tests failed!"
exit 1
}
# Verifies WASM binary works for Web export
# Also downloads Linux binary so Godot can load the extension on the host
test-wasm-export:
needs: [build-wasm, build-linux-debug]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup addon directory
run: |
mkdir -p tests/godot_project/addons/bobbin/bin/
cp -r bindings/godot/addons/bobbin/* tests/godot_project/addons/bobbin/
- name: Download WASM binary
uses: actions/download-artifact@v4
with:
name: wasm-binary
path: tests/godot_project/addons/bobbin/bin/
- name: Download Linux debug binary
uses: actions/download-artifact@v4
with:
name: linux-debug
path: tests/godot_project/addons/bobbin/bin/
- name: Verify addon setup
run: ls -la tests/godot_project/addons/bobbin/bin/
- name: Setup Godot with export templates
uses: chickensoft-games/setup-godot@v2
with:
version: 4.3.0
use-dotnet: false
include-templates: true
- name: Verify Godot setup
run: godot --version
- name: Import project
run: godot --headless --path tests/godot_project --import --quit || true
- name: Export to Web (WASM verification)
run: |
mkdir -p tests/godot_project/build/web
# gdext may crash during shutdown even when export succeeds, so check output files
godot --headless --path tests/godot_project --export-release "Web" build/web/index.html || true
- name: Verify export output
run: |
ls -la tests/godot_project/build/web/
# Check that export produced the expected files
if [ -f tests/godot_project/build/web/index.html ] && [ -f tests/godot_project/build/web/index.wasm ]; then
echo "PASS: Web export files generated successfully"
else
echo "FAIL: Export did not produce expected files"
exit 1
fi
test-macos:
needs: build-macos
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Setup addon directory
run: |
mkdir -p tests/godot_project/addons/bobbin/bin/
cp -r bindings/godot/addons/bobbin/* tests/godot_project/addons/bobbin/
- name: Download macOS binaries
uses: actions/download-artifact@v4
with:
name: macos-binaries
path: macos-bin/
- name: Debug artifact contents
run: |
echo "=== Artifact contents ==="
find macos-bin -type f
- name: Install macOS binaries
run: |
cp macos-bin/release/libbobbin_godot.dylib tests/godot_project/addons/bobbin/bin/
cp macos-bin/debug/libbobbin_godot.dylib tests/godot_project/addons/bobbin/bin/libbobbin_godot.debug.dylib
- name: Verify addon setup
run: ls -la tests/godot_project/addons/bobbin/bin/
- name: Download Godot 4.3
run: |
curl -L -o godot.zip https://github.com/godotengine/godot/releases/download/4.3-stable/Godot_v4.3-stable_macos.universal.zip
unzip godot.zip
- name: Remove quarantine
run: xattr -dr com.apple.quarantine Godot.app tests/godot_project/addons/bobbin/bin/*.dylib || true
- name: Import project
run: ./Godot.app/Contents/MacOS/Godot --headless --path tests/godot_project --import --quit || true
- name: Run smoke test
run: |
# gdext may crash during shutdown even when tests pass, so check output
output=$(./Godot.app/Contents/MacOS/Godot --headless --path tests/godot_project -s res://smoke_test.gd --quit 2>&1) || true
echo "$output"
if echo "$output" | grep -q "All smoke tests passed"; then
echo "Tests passed!"
exit 0
else
echo "Tests failed!"
exit 1
fi
# Assembles the complete addon with all platform binaries for release
# Waits for all tests to pass and all release builds to complete
assemble-addon:
needs: [test-linux, test-windows, test-wasm-export, test-macos, build-linux-release, build-windows-release]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create bin directory
run: mkdir -p bindings/godot/addons/bobbin/bin/
- name: Download Linux release
uses: actions/download-artifact@v4
with:
name: linux-release
path: bindings/godot/addons/bobbin/bin/
- name: Download Linux debug
uses: actions/download-artifact@v4
with:
name: linux-debug
path: bindings/godot/addons/bobbin/bin/
- name: Download Windows release
uses: actions/download-artifact@v4
with:
name: windows-release
path: bindings/godot/addons/bobbin/bin/
- name: Download Windows debug
uses: actions/download-artifact@v4
with:
name: windows-debug
path: bindings/godot/addons/bobbin/bin/
- name: Download WASM binary
uses: actions/download-artifact@v4
with:
name: wasm-binary
path: bindings/godot/addons/bobbin/bin/
- name: Download macOS binaries
uses: actions/download-artifact@v4
with:
name: macos-binaries
path: macos-bin/
- name: Install macOS binaries
run: |
cp macos-bin/release/libbobbin_godot.dylib bindings/godot/addons/bobbin/bin/
cp macos-bin/debug/libbobbin_godot.dylib bindings/godot/addons/bobbin/bin/libbobbin_godot.debug.dylib
- name: Show final addon contents
run: |
echo "=== Complete addon structure ==="
find bindings/godot/addons -type f
echo "=== Bin directory ==="
ls -la bindings/godot/addons/bobbin/bin/
- name: Upload complete addon
uses: actions/upload-artifact@v4
with:
name: godot-addon
path: bindings/godot/addons/