Skip to content

Build and Test

Build and Test #4

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:
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: Build Linux debug
run: docker run --rm -v ${{ github.workspace }}:/workspace bobbin-build linux debug --ci
- name: Upload Linux binaries
uses: actions/upload-artifact@v4
with:
name: linux-binaries
path: |
bindings/godot/addons/bobbin/bin/libbobbin_godot.so
bindings/godot/addons/bobbin/bin/libbobbin_godot.debug.so
build-windows:
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: Build Windows debug
run: docker run --rm -v ${{ github.workspace }}:/workspace bobbin-build windows debug --ci
- name: Upload Windows binaries
uses: actions/upload-artifact@v4
with:
name: windows-binaries
path: |
bindings/godot/addons/bobbin/bin/bobbin_godot.dll
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
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download Linux binaries
uses: actions/download-artifact@v4
with:
name: linux-binaries
path: tests/godot_project/addons/bobbin/bin/
- name: Copy addon base files
run: |
cp -r bindings/godot/addons/bobbin/* tests/godot_project/addons/bobbin/
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: ./Godot_v4.3-stable_linux.x86_64 --headless --path tests/godot_project -s res://smoke_test.gd --quit
test-windows:
needs: build-windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Download Windows binaries
uses: actions/download-artifact@v4
with:
name: windows-binaries
path: tests/godot_project/addons/bobbin/bin/
- name: Copy addon base files
shell: pwsh
run: |
Copy-Item -Path bindings/godot/addons/bobbin/* -Destination tests/godot_project/addons/bobbin/ -Recurse -Force
Get-ChildItem tests/godot_project/addons/bobbin/bin/
- 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: ./Godot_v4.3-stable_win64.exe --headless --path tests/godot_project --import --quit; exit 0
- name: Run smoke test
shell: pwsh
run: ./Godot_v4.3-stable_win64.exe --headless --path tests/godot_project -s res://smoke_test.gd --quit
test-wasm-export:
needs: build-wasm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download WASM binary
uses: actions/download-artifact@v4
with:
name: wasm-binary
path: tests/godot_project/addons/bobbin/bin/
- name: Copy addon base files
run: |
cp -r bindings/godot/addons/bobbin/* tests/godot_project/addons/bobbin/
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
godot --headless --path tests/godot_project --export-release "Web" build/web/index.html
echo "WASM export succeeded - GDExtension loaded correctly"
- name: Verify export output
run: |
ls -la tests/godot_project/build/web/
test -f tests/godot_project/build/web/index.html
test -f tests/godot_project/build/web/index.wasm
echo "PASS: Web export files generated successfully"
test-macos:
needs: build-macos
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Download macOS binaries
uses: actions/download-artifact@v4
with:
name: macos-binaries
path: macos-bin/
- name: Setup addon with macOS binaries
run: |
mkdir -p tests/godot_project/addons/bobbin/bin/
cp -r bindings/godot/addons/bobbin/* tests/godot_project/addons/bobbin/
cp macos-bin/bindings/godot/target/release/libbobbin_godot.dylib tests/godot_project/addons/bobbin/bin/
cp macos-bin/bindings/godot/target/debug/libbobbin_godot.dylib tests/godot_project/addons/bobbin/bin/libbobbin_godot.debug.dylib
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: ./Godot.app/Contents/MacOS/Godot --headless --path tests/godot_project -s res://smoke_test.gd --quit
# Assembles the complete addon with all platform binaries for release
# Only runs after all tests pass to ensure we only package verified binaries
assemble-addon:
needs: [test-linux, test-windows, test-wasm-export, test-macos]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create bin directory
run: mkdir -p bindings/godot/addons/bobbin/bin/
- name: Download Linux binaries
uses: actions/download-artifact@v4
with:
name: linux-binaries
path: bindings/godot/addons/bobbin/bin/
- name: Download Windows binaries
uses: actions/download-artifact@v4
with:
name: windows-binaries
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/bindings/godot/target/release/libbobbin_godot.dylib bindings/godot/addons/bobbin/bin/
cp macos-bin/bindings/godot/target/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/