Use default export templates for HTML5

Changes Emscripten SDK version to match that used to compile the default export
templates used by Godot 3.5 (in this case 3.1.14 as can be seen here:
https://github.com/godotengine/build-containers/blob/3.5/Dockerfile.javascript).

This means we no longer need to compile custom export templates when
exporting HTML5 for Godot 3.5. Exports from other Godot versions may
requiring compiling the GDNative library with a different version of the
Emscripten SDK.

- Changes renderer from GLES3 -> GLES2 and reduces MSAA level to better
  support HTML5 export.
- Updates GitHub Action to export HTML5 and upload as a build artifact.
- Adds Cypress test to smoke test HTML5 export.
This commit is contained in:
Leroy Hopson 2022-08-01 19:56:43 +12:00
parent b31861f171
commit fae6317eb7
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA
26 changed files with 4895 additions and 118 deletions

21
.github/import_assets.tscn vendored Normal file
View file

@ -0,0 +1,21 @@
[gd_scene load_steps=2 format=2]
[sub_resource type="GDScript" id=1]
script/source = "tool
extends Timer
func _enter_tree():
start()
func _on_timeout():
get_tree().quit(0)
"
[node name="Timer" type="Timer"]
process_mode = 0
wait_time = 10.0
one_shot = true
autostart = true
script = SubResource( 1 )
[connection signal="timeout" from="." to="." method="_on_timeout"]

View file

@ -102,7 +102,7 @@ jobs:
if: ${{ matrix.platform == 'javascript' }}
uses: mymindstorm/setup-emsdk@v11
with:
version: 3.1.5
version: 3.1.14
actions-cache-folder: emsdk-cache-${{ matrix.target }}
- name: Install additional javascript build dependencies
if: ${{ matrix.platform == 'javascript' }}
@ -168,43 +168,9 @@ jobs:
addons/godot_xterm/native/bin/*.dylib
addons/godot_xterm/native/bin/*.dll
# GDNative HTML5 export templates aren't provided so we must build them
export_template:
name: 'Export Template'
runs-on: ubuntu-latest
strategy:
matrix:
target: [ release, debug ]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Get godot submodule commit hash
shell: bash
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
run: |
echo ::set-env name=GODOT_COMMIT_HASH::$(git ls-tree HEAD misc/export_templates/godot -l | cut -d\ -f3)
- name: Cache export template
uses: actions/cache@v2
id: cache-export-template
env:
cache-name: cache-export-template
with:
path: misc/export_templates/godot/bin
key: godot-${{ env.GODOT_COMMIT_HASH }}-${{ matrix.target }}-v${{ env.EXPORT_TEMPLATE_CACHE_VERSION }}
- name: Build template in docker container
if: steps.cache-export-template.outputs.cache-hit != 'true'
run: cd misc/export_templates && ./build.sh -t ${{ matrix.target }}
- name: Upload export template
uses: actions/upload-artifact@v2
with:
name: html5-gdnative-export-templates
path: misc/export_templates/godot/bin/webassembly_gdnative_${{matrix.target}}.zip
html5_export:
name: 'HTML5 Export'
needs: [ build_docker, build_native, export_template ]
needs: [ build_docker, build_native ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
@ -217,23 +183,39 @@ jobs:
with:
name: libgodot-xterm-release
path: addons/godot_xterm/native/bin
- name: Install html5 export templates
uses: actions/download-artifact@v2
- name: Import assets
shell: bash
# The GodotXterm plugin will be disabled the first time we run the editor as resources that it depends
# (e.g. icons) will not have been imported yet so the plugin will fail to load. Without the plugin
# enabled resources imported by GodotXterm import plugins (e.g. .cast) will not be imported. Therefore,
# we need to re-enable the plugin by checking out project.godot and running the editor again.
run: godot --editor .github/import_assets.tscn && git checkout project.godot && godot --editor .github/import_assets.tscn
- name: Export HTML5
run: godot --no-window --export HTML5
- name: NPM cache
uses: c-hive/gha-npm-cache@v1
with:
name: html5-gdnative-export-templates
path: misc/export_templates/godot/bin
- name: Create export directory
run: mkdir -p docs/demo
- name: Export html5
run: godot --export HTML5
# FIXME: HTML5 Exports not properly exporting .cast files.
# So skip upload for now.
#- name: Upload export
# uses: actions/upload-artifact@v2
# with:
# name: html5-demo
# path: docs/demo
directory: test/html5
- name: Smoke test HTML5 export
shell: bash
working-directory: test/html5
run: |
npm ci
npx serve ../../docs/demo -p 3000 &
npx cypress run
- name: Upload cypress artifacts (on failure)
uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: cypress-artifacts
path: |-
test/html5/cypress/screenshots
test/html5/cypress/videos
- name: Upload export
uses: actions/upload-artifact@v2
with:
name: html5-demo
path: docs/demo
test:
name: 'Test'