Skip to content

Commit

Permalink
CI export and test (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashtonmeuser authored Oct 14, 2023
1 parent 677a5d1 commit 989f612
Show file tree
Hide file tree
Showing 13 changed files with 347 additions and 22 deletions.
43 changes: 33 additions & 10 deletions .github/actions/download-godot/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,58 @@ runs:
- name: Linux File Pattern
if: runner.os == 'Linux'
shell: bash
run: echo "FILE=linux(\.x86_64|_headless\.64)" >> $GITHUB_ENV
run: |
echo "ASSET=linux(\.x86_64|_headless\.64)" >> $GITHUB_ENV
echo "FILE=linux(\.x86_64|_headless\.64)" >> $GITHUB_ENV
- name: MacOS File Pattern
if: runner.os == 'macOS'
shell: bash
run: echo "FILE=(macos|osx)\.universal" >> $GITHUB_ENV
run: |
echo "ASSET=(macos|osx)\.universal" >> $GITHUB_ENV
echo "FILE=(macos|osx)\.universal" >> $GITHUB_ENV
- name: Windows File Pattern
if: runner.os == 'Windows'
shell: bash
run: echo "FILE=win64.exe" >> $GITHUB_ENV
run: |
echo "ASSET=win64.exe" >> $GITHUB_ENV
echo "FILE=win64_console.exe" >> $GITHUB_ENV
- name: Cache Godot
id: cache-godot
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/Godot*.x86_64
${{ github.workspace }}/Godot.app
${{ github.workspace }}/Godot*_win64*.exe
templates/*
key: godot-${{ runner.os }}-${{ inputs.version }}

- name: Download Godot
if: steps.cache-godot.outputs.cache-hit != 'true'
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: godotengine/godot
version: tags/${{ inputs.version }}
regex: true
target: './' # Defaults to regex prepended to filename
file: ${{ env.FILE }}
file: ${{ inputs.version }}_(${{ env.ASSET }}|export_templates.tpz)

- name: Unzip Godot
- name: Extract Godot
if: steps.cache-godot.outputs.cache-hit != 'true'
shell: bash
run: |
zip_file=$( ls | grep -E '${{ env.FILE }}' | grep -v '_mono_' )
unzip "$zip_file"
ls | grep -E '${{ env.FILE }}.*\.zip' | xargs rm
echo "EXECUTABLE=$( ls | grep -E '${{ env.FILE }}' )" >> $GITHUB_ENV
zip_editor=$( ls | grep -E '${{ env.ASSET }}' )
unzip "$zip_editor"
zip_templates=$( ls | grep export_templates.tpz )
unzip "$zip_templates"
rm "$zip_editor" "$zip_templates"
- name: Generic Executable
shell: bash
run: echo "EXECUTABLE=$( ls | grep -E '${{ env.FILE }}' )" >> $GITHUB_ENV

- name: MacOS Executable
if: runner.os == 'macOS'
Expand All @@ -52,4 +76,3 @@ runs:
id: set-output
shell: bash
run: echo "executable=${{ env.EXECUTABLE }}" >> $GITHUB_OUTPUT

50 changes: 50 additions & 0 deletions .github/actions/export-tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Export Tests
description: Export and run test project
inputs:
executable:
description: The Godot executable in CWD
required: true
godot-major:
description: The major version of Godot being targeted used to configure export command
required: true
runs:
using: composite
steps:
- name: Linux Export Details
if: runner.os == 'Linux'
shell: bash
run: echo "EXTENSION=x86_64" >> $GITHUB_ENV

- name: MacOS Export Details
if: runner.os == 'macOS'
shell: bash
run: echo "EXTENSION=app" >> $GITHUB_ENV

- name: Windows Export Details
if: runner.os == 'Windows'
shell: bash
run: echo "EXTENSION=exe" >> $GITHUB_ENV

- name: Generic Export Command
shell: bash
run: echo "EXPORT_CMD=--export-release ${{ runner.os }} ../../WasmTest.${{ env.EXTENSION }}" >> $GITHUB_ENV

- name: Godot 3.x Export Command
if: inputs.godot-major == 3
shell: bash
run: echo "EXPORT_CMD=--export ${{ runner.os }}" >> $GITHUB_ENV

- name: Export
shell: bash
run: |
./${{ inputs.executable }} --headless --no-window --path examples/wasm-test ${{ env.EXPORT_CMD }}
echo "EXECUTABLE=WasmTest.${{ env.EXTENSION }}" >> $GITHUB_ENV
- name: MacOS Executable
if: runner.os == 'macOS'
shell: bash
run: echo "EXECUTABLE=WasmTest.app/Contents/MacOS/WasmTest" >> $GITHUB_ENV

- name: Run Tests
shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }}
run: ./${{ env.EXECUTABLE }} --headless --no-window -- --key=val
2 changes: 1 addition & 1 deletion .github/actions/godot-cpp/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ runs:
${{ github.workspace }}/godot-cpp/bin
${{ github.workspace }}/godot-cpp/include
${{ github.workspace }}/godot-cpp/gen
key: ${{ inputs.platform }}-${{ steps.submodule-hash.outputs.hash }}
key: godotcpp-${{ inputs.platform }}-${{ steps.submodule-hash.outputs.hash }}

- name: Compile Godot Library
if: steps.cache-godot-cpp.outputs.cache-hit != 'true'
Expand Down
1 change: 0 additions & 1 deletion .github/actions/install-deps/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@ runs:
if: runner.os == 'Windows'
shell: bash
run: python -m pip install pywin32

2 changes: 1 addition & 1 deletion .github/actions/run-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ runs:
using: composite
steps:
- name: Run Tests
shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }}
shell: bash
run: ./${{ inputs.executable }} --headless --no-window --debug --path examples/wasm-test -- --key=val
10 changes: 5 additions & 5 deletions .github/actions/scons-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ runs:
shell: bash
run: echo "name=${{ inputs.cache-prefix }}${{ inputs.platform }}-${{ inputs.godot-major }}-${{ github.workflow }}" >> $GITHUB_OUTPUT

- name: Load Cache
- name: Cache Scons
uses: actions/cache@v3
with:
path: ${{ inputs.scons-cache }}
key: ${{ steps.cache-name.outputs.name }}-${{ github.ref }}-${{ github.sha }}
key: scons-${{ steps.cache-name.outputs.name }}-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ steps.cache-name.outputs.name }}-${{ github.ref }}-${{ github.sha }}
${{ steps.cache-name.outputs.name }}-${{ github.ref }}
${{ steps.cache-name.outputs.name }}
scons-${{ steps.cache-name.outputs.name }}-${{ github.ref }}-${{ github.sha }}
scons-${{ steps.cache-name.outputs.name }}-${{ github.ref }}
scons-${{ steps.cache-name.outputs.name }}
- name: MSVC Developer Command Prompt
if: runner.os == 'Windows'
Expand Down
43 changes: 41 additions & 2 deletions .github/workflows/addon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ jobs:
path: ${{ github.workspace }}/${{ env.LIBRARY_PATH }}/${{ matrix.platform }}
if-no-files-found: error

test-addon:
test-editor:
needs: build-addon
name: Test Addon
name: Test Addon Editor
strategy:
fail-fast: false
matrix:
Expand All @@ -69,6 +69,7 @@ jobs:
- platform: windows
os: windows-latest
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -89,3 +90,41 @@ jobs:
uses: ./.github/actions/run-tests
with:
executable: ${{ steps.download-godot.outputs.executable }}

test-export:
needs: build-addon
name: Test Addon Export
strategy:
fail-fast: false
matrix:
platform: [linux, macos, windows]
include:
- platform: linux
os: ubuntu-latest
- platform: macos
os: macos-11
- platform: windows
os: windows-latest
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Download Godot
id: download-godot
uses: ./.github/actions/download-godot
with:
version: ${{ env.GODOT_REF }}

- name: Download Addon
uses: actions/download-artifact@v3
with:
name: ${{ matrix.platform }}
path: ${{ github.workspace }}/${{ env.LIBRARY_PATH }}/${{ matrix.platform }}

- name: Export Tests
uses: ./.github/actions/export-tests
with:
executable: ${{ steps.download-godot.outputs.executable }}
godot-major: ${{ env.GODOT_MAJOR }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
wasmer/
wasmtime/
addons.zip
templates/
*.os
*.obj
*.pdb
Expand Down
1 change: 1 addition & 0 deletions examples/wasm-test/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.DS_Store
.import/
.godot/**
WasmTest.app
*.import
!.godot/extension_list.cfg
!.godot/global_script_class_cache.cfg
Loading

0 comments on commit 989f612

Please sign in to comment.