Skip to content

Commit

Permalink
Fix loading ImGuiConfig and add CI tests (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
pkdawson authored Jun 30, 2024
1 parent 573f24e commit e917d4a
Show file tree
Hide file tree
Showing 17 changed files with 639 additions and 62 deletions.
21 changes: 21 additions & 0 deletions .github/actions/import/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Import
description: Import
inputs:
path:
description: Path
required: true

runs:
using: composite
steps:
- name: Prep
shell: bash
run: |
cd imgui-godot-*
cd imgui-godot-*
cd ${{ inputs.path }}
godotenv addons install
mkdir .godot
echo "res://addons/imgui-godot/imgui-godot-native.gdextension" > .godot/extension_list.cfg
$GODOT --headless --import || true
echo "GAMEDIR=$(pwd)" >> $GITHUB_ENV
97 changes: 97 additions & 0 deletions .github/actions/install-godot/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Install Godot
description: Install Godot
inputs:
version:
description: NuGet name
required: true
dotnet:
description: Use .NET build
required: false
default: 'false'

runs:
using: composite
steps:
# 4.3.0-beta.2 -> 4.3.beta2
# https://github.com/godotengine/godot-builds/releases/download/4.3-beta2/Godot_v4.3-beta2_export_templates.tpz
# https://github.com/godotengine/godot-builds/releases/download/4.3-beta2/Godot_v4.3-beta2_mono_export_templates.tpz
- if: contains(inputs.version, 'beta')
shell: bash
run: |
gdver_full=$(echo ${{ inputs.version }} | sed 's:0-::' | sed 's:beta\.:beta:')
if [[ "${{ inputs.dotnet}}" == "true" ]]; then
gdver_full="$gdver_full.mono"
fi
echo "gdver_full=$gdver_full" >> $GITHUB_ENV
gdver_url=$(echo ${{ inputs.version }} | sed 's:\.0-:-:' | sed 's:beta\.:beta:')
templates_url="https://github.com/godotengine/godot-builds/releases/download/${gdver_url}/Godot_v${gdver_url}_export_templates.tpz"
if [[ "${{ inputs.dotnet}}" == "true" ]]; then
templates_url="https://github.com/godotengine/godot-builds/releases/download/${gdver_url}/Godot_v${gdver_url}_mono_export_templates.tpz"
fi
echo "templates_url=$templates_url" >> $GITHUB_ENV
# 4.2.2 -> 4.2.2.stable
# https://github.com/godotengine/godot/releases/download/4.2.2-stable/Godot_v4.2.2-stable_export_templates.tpz
# https://github.com/godotengine/godot/releases/download/4.2.2-stable/Godot_v4.2.2-stable_mono_export_templates.tpz
- if: "!contains(inputs.version, 'beta')"
shell: bash
run: |
gdver_full=${{ inputs.version }}.stable
if [[ "${{ inputs.dotnet}}" == "true" ]]; then
gdver_full="$gdver_full.mono"
fi
echo "gdver_full=$gdver_full" >> $GITHUB_ENV
gdver_url=${{ inputs.version }}-stable
templates_url="https://github.com/godotengine/godot/releases/download/${gdver_url}/Godot_v${gdver_url}_export_templates.tpz"
if [[ "${{ inputs.dotnet}}" == "true" ]]; then
templates_url="https://github.com/godotengine/godot/releases/download/${gdver_url}/Godot_v${gdver_url}_mono_export_templates.tpz"
fi
echo "templates_url=$templates_url" >> $GITHUB_ENV
- if: runner.os == 'Linux'
shell: bash
run: |
echo "templates_path=$HOME/.local/share/godot/export_templates" >> $GITHUB_ENV
- if: runner.os == 'macOS'
shell: bash
run: |
echo "templates_path=$HOME/Library/Application Support/Godot/export_templates" >> $GITHUB_ENV
- if: runner.os == 'Windows'
shell: bash
run: |
choco install wget
echo "templates_path=$APPDATA/Godot/export_templates" >> $GITHUB_ENV
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Install Godot
if: inputs.dotnet != 'true'
shell: bash
run: |
dotnet tool install --global Chickensoft.GodotEnv
godotenv godot install ${{ inputs.version }} --no-dotnet
echo "GODOT=$(godotenv godot env path)" >> $GITHUB_ENV
- name: Install Godot (.NET)
if: inputs.dotnet == 'true'
shell: bash
run: |
dotnet tool install --global Chickensoft.GodotEnv
godotenv godot install ${{ inputs.version }}
echo "GODOT=$(godotenv godot env path)" >> $GITHUB_ENV
- name: Install export templates
shell: bash
run: |
mkdir -p "${{ env.templates_path }}"
cd "${{ env.templates_path }}"
wget -q ${{ env.templates_url }}
unzip *.tpz
rm *.tpz
mv templates ${{ env.gdver_full }}
pwd
ls -R
155 changes: 110 additions & 45 deletions .github/workflows/gdext.yml
Original file line number Diff line number Diff line change
Expand Up @@ -280,71 +280,136 @@ jobs:
name: ${{ steps.prep_cs.outputs.pkgfn }}
path: ~/out

export_linux:
name: 🐧Export
runs-on: ubuntu-latest
gds_game:
needs: [package]

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-14, windows-latest]
gdver: ["4.2.2", "4.3.0-beta.2"]
include:
- gdver: "4.2.2"
gdver_full: 4.2.2.stable
templates_url: https://github.com/godotengine/godot/releases/download/4.2.2-stable/Godot_v4.2.2-stable_export_templates.tpz
- gdver: "4.3.0-beta.2"
gdver_full: 4.3.beta2
templates_url: https://github.com/godotengine/godot-builds/releases/download/4.3-beta2/Godot_v4.3-beta2_export_templates.tpz

- os: ubuntu-latest
name: 🐧GdsGameProject
exe: GdsGameProject.x86_64
- os: macos-14
name: 🍎GdsGameProject
exe: GdsGameProject.app/Contents/MacOS/GdsGameProject
- os: windows-latest
name: 🪟GdsGameProject
exe: GdsGameProject.exe

name: ${{ matrix.name }} (${{ matrix.gdver }})
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
pattern: imgui-godot-*_imgui*

- name: Setup .NET
uses: actions/setup-dotnet@v4
- name: Install Godot
uses: ./.github/actions/install-godot
with:
dotnet-version: 8.0.x
version: ${{ matrix.gdver }}

- name: Download Godot
run: |
dotnet tool install --global Chickensoft.GodotEnv
godotenv godot install ${{ matrix.gdver }} --no-dotnet
echo "GODOT=$(godotenv godot env path)" >> $GITHUB_ENV
- name: Import
uses: ./.github/actions/import
with:
path: doc/examples/GdsGameProject

- name: Download export templates
- name: Export Debug
shell: bash
run: |
mkdir -p ~/.local/share/godot/export_templates
cd ~/.local/share/godot/export_templates
wget -q ${{ matrix.templates_url }}
unzip *.tpz
rm *.tpz
mv templates ${{ matrix.gdver_full }}
- name: Prep
cd $GAMEDIR
$GODOT --headless --export-debug $RUNNER_OS
# TODO: check output for unexpected errors
# Godot 4.2.2 exits with error code 1 on Mac/Win, this is fixed in 4.3
# https://github.com/godotengine/godot/pull/89229
- name: Run Debug (workaround)
if: runner.os != 'Linux' && matrix.gdver == '4.2.2'
shell: bash
run: |
cd imgui-godot-*
cd imgui-godot-*
ls -R
cd doc/examples/GdsGameProject
mkdir ../export
godotenv addons install
timeout 10 $GODOT --headless --import || true
$GODOT --headless --import
echo "GAMEDIR=$(pwd)" >> $GITHUB_ENV
cd $GAMEDIR/export
./${{ matrix.exe }} --headless --quit-after 10 || true
rm -rf *
- name: Export Debug
- name: Run Debug
if: runner.os == 'Linux' || matrix.gdver != '4.2.2'
shell: bash
run: |
cd $GAMEDIR
$GODOT --headless --export-debug Linux
cd ../export
./GdsGameProject.x86_64 --headless --quit-after 10
cd $GAMEDIR/export
./${{ matrix.exe }} --headless --quit-after 10
rm -rf *
- name: Export Release
shell: bash
run: |
cd $GAMEDIR
$GODOT --headless --export-release $RUNNER_OS
- name: Run Release (workaround)
shell: bash
run: |
cd $GAMEDIR/export
./${{ matrix.exe }} --headless --quit-after 10 || true
test:
needs: [package]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-14, windows-latest]
gdver: ["4.2.2", "4.3.0-beta.2"]
include:
- os: ubuntu-latest
name: 🐧Test
test_exe: test.x86_64
- os: macos-14
name: 🍎Test
test_exe: test.app/Contents/MacOS/test
- os: windows-latest
name: 🪟Test
test_exe: test.exe

name: ${{ matrix.name }} (${{ matrix.gdver }})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
pattern: imgui-godot-*_imgui*

- name: Install Godot
uses: ./.github/actions/install-godot
with:
version: ${{ matrix.gdver }}

- name: Import
uses: ./.github/actions/import
with:
path: doc/test

- name: Run tests
shell: bash
run: |
cd $GAMEDIR
$GODOT --headless --debug
- name: Export debug
shell: bash
run: |
cd $GAMEDIR
$GODOT --headless --export-debug $RUNNER_OS
cd export
./${{ matrix.test_exe }} --headless
- name: Export release
shell: bash
run: |
cd $GAMEDIR
$GODOT --headless --export-release Linux
cd ../export
./GdsGameProject.x86_64 --headless --quit-after 10
$GODOT --headless --export-release $RUNNER_OS
cd export
./${{ matrix.test_exe }} --headless
Empty file.
10 changes: 5 additions & 5 deletions doc/examples/GdsGameProject/export_presets.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="../export/GdsGameProject.exe"
export_path="export/GdsGameProject.exe"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
Expand All @@ -31,7 +31,7 @@ codesign/timestamp_server_url=""
codesign/digest_algorithm=1
codesign/description=""
codesign/custom_options=PackedStringArray()
application/modify_resources=true
application/modify_resources=false
application/icon=""
application/console_wrapper_icon=""
application/icon_interpolation=4
Expand Down Expand Up @@ -77,15 +77,15 @@ custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="../export/GdsGameProject.dmg"
export_path="export/GdsGameProject.app"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false

[preset.1.options]

export/distribution_type=1
export/distribution_type=0
binary_format/architecture="universal"
custom_template/debug=""
custom_template/release=""
Expand Down Expand Up @@ -184,7 +184,7 @@ custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="../export/GdsGameProject.x86_64"
export_path="export/GdsGameProject.x86_64"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
Expand Down
4 changes: 4 additions & 0 deletions doc/examples/GdsGameProject/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ window/vsync/vsync_mode=0
[editor_plugins]

enabled=PackedStringArray("res://addons/imgui-godot/plugin.cfg")

[rendering]

textures/vram_compression/import_etc2_astc=true
8 changes: 8 additions & 0 deletions doc/test/addons.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"addons": {
"imgui-godot": {
"url": "../../../addons/imgui-godot",
"source": "symlink"
}
}
}
12 changes: 12 additions & 0 deletions doc/test/config_scale2x.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[gd_resource type="Resource" script_class="ImGuiConfig" load_steps=2 format=3 uid="uid://su0bdciskixm"]

[ext_resource type="Script" path="res://addons/imgui-godot/scripts/ImGuiConfig.gd" id="1_o27t7"]

[resource]
script = ExtResource("1_o27t7")
Fonts = Array[Resource("res://addons/imgui-godot/scripts/ImGuiFont.gd")]([])
AddDefaultFont = true
Scale = 2.0
IniFilename = "user://imgui.ini"
Renderer = "RenderingDevice"
Layer = 128
Empty file added doc/test/export/.gdignore
Empty file.
Loading

0 comments on commit e917d4a

Please sign in to comment.