mirror of
https://github.com/lihop/godot-xterm.git
synced 2025-05-23 11:15:32 +02:00
Update build files and GitHub Actions workflow
This commit is contained in:
parent
237a456f99
commit
2ba480b4da
15 changed files with 172 additions and 429 deletions
32
.github/actions/cache-submodules/action.yaml
vendored
32
.github/actions/cache-submodules/action.yaml
vendored
|
@ -1,32 +0,0 @@
|
|||
name: Cache dependencies
|
||||
inputs:
|
||||
platform:
|
||||
required: true
|
||||
target:
|
||||
required: true
|
||||
bits:
|
||||
required: true
|
||||
outputs:
|
||||
cache-hit:
|
||||
value: ${{ steps.cache.outputs.cache-hit }}
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Hash submodule revisions
|
||||
id: hash
|
||||
working-directory: addons/godot_xterm/native/thirdparty
|
||||
shell: bash
|
||||
run: |
|
||||
cache_version=1 # Increment this number to invalidate the cache.
|
||||
godot_cpp_rev=$(git ls-tree HEAD godot-cpp --object-only)
|
||||
libuv_rev=$(git ls-tree HEAD libuv --object-only)
|
||||
libtsm_rev=$(git ls-tree HEAD libtsm --object-only)
|
||||
hash_cmd=$([[ $RUNNER_OS == 'Windows' ]] && echo 'sha1sum' || echo 'shasum')
|
||||
hash_of_hashes=$(echo -n "$godot_cpp_rev$libuv_rev$libtsm_rev$cache_version" | $hash_cmd | head -c 40)
|
||||
echo "::set-output name=hash::$hash_of_hashes"
|
||||
- name: Cache submodules
|
||||
uses: actions/cache@v3
|
||||
id: cache
|
||||
with:
|
||||
path: addons/godot_xterm/native/thirdparty
|
||||
key: thirdparty-${{ inputs.platform }}-${{ inputs.bits }}-${{ inputs.target }}-${{ steps.hash.outputs.hash }}
|
44
.github/actions/cache-submodules/action.yml
vendored
Normal file
44
.github/actions/cache-submodules/action.yml
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
name: Cache dependencies
|
||||
inputs:
|
||||
platform:
|
||||
required: true
|
||||
target:
|
||||
required: true
|
||||
arch:
|
||||
required: true
|
||||
outputs:
|
||||
cache-hit:
|
||||
value: ${{ steps.cache.outputs.cache-hit }}
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Hash submodule revisions
|
||||
id: hash
|
||||
working-directory: addons/godot_xterm/native/thirdparty
|
||||
shell: bash
|
||||
run: |
|
||||
godot_cpp_rev=$(git ls-tree HEAD godot-cpp --object-only)
|
||||
libuv_rev=$(git ls-tree HEAD libuv --object-only)
|
||||
libtsm_rev=$(git ls-tree HEAD libtsm --object-only)
|
||||
hash_cmd=$([[ $RUNNER_OS == 'Windows' ]] && echo 'sha1sum' || echo 'shasum')
|
||||
hash_of_hashes=$(echo -n "$godot_cpp_rev$libuv_rev$libtsm_rev" | $hash_cmd | head -c 40)
|
||||
echo "hash=$hash_of_hashes" >> $GITHUB_OUTPUT
|
||||
build_files_hash=${{ hashFiles('**/build.sh', '**/*.Dockerfile', '**/SConstruct', '**/*.yml') }}
|
||||
echo "build-files-hash=$build_files_hash" >> $GITHUB_OUTPUT
|
||||
- name: Cache submodules
|
||||
uses: actions/cache@v3
|
||||
id: cache
|
||||
with:
|
||||
path: addons/godot_xterm/native/thirdparty
|
||||
key: thirdparty-${{ inputs.platform }}-${{ inputs.arch }}-${{ inputs.target }}-${{ steps.hash.outputs.hash }}-${{ steps.hash.outputs.build-files-hash }}
|
||||
restore-keys: |
|
||||
thirdparty-${{ inputs.platform }}-${{ inputs.arch }}-${{ inputs.target }}-${{ steps.hash.outputs.hash }}-
|
||||
thirdparty-${{ inputs.platform }}-${{ inputs.arch }}-${{ inputs.target }}-
|
||||
- name: Scons cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: "${{github.workspace}}/.scons-cache/"
|
||||
key: scons-${{ inputs.platform }}-${{ inputs.arch }}-${{ inputs.target }}-${{ steps.hash.outputs.hash }}-${{ steps.hash.outputs.build-files-hash }}
|
||||
restore-keys: |
|
||||
scons-${{ inputs.platform }}-${{ inputs.arch }}-${{ inputs.target }}-${{ steps.hash.outputs.hash }}-
|
||||
scons-${{ inputs.platform }}-${{ inputs.arch }}-${{ inputs.target }}-
|
10
.github/actions/import-assets/action.yml
vendored
Normal file
10
.github/actions/import-assets/action.yml
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
name: Import assets
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Import assets
|
||||
shell: bash
|
||||
run: |
|
||||
# HACK: See https://github.com/godotengine/godot-proposals/issues/1362.
|
||||
(for i in {1..4}; do godot --editor --headless & sleep 5 && .github/actions/import-assets/monitor_import.sh; done) || true
|
||||
|
10
.github/actions/import-assets/monitor_import.sh
vendored
Executable file
10
.github/actions/import-assets/monitor_import.sh
vendored
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Source: https://github.com/godotengine/godot/pull/68461#issuecomment-1328177902
|
||||
|
||||
while [ "$(printf "%.0f\n" $(top -n 1 -b | awk '/^%Cpu/{print $2}'))" -gt 10 ];
|
||||
do
|
||||
echo "$(top -n 1 -b | awk '/^%Cpu/{print $2}')";
|
||||
done
|
||||
echo "Finished importing. Killing godot editor process";
|
||||
kill -9 $(pgrep -o godot)
|
21
.github/import_assets.tscn
vendored
21
.github/import_assets.tscn
vendored
|
@ -1,21 +0,0 @@
|
|||
[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"]
|
113
.github/workflows/main.yml
vendored
113
.github/workflows/main.yml
vendored
|
@ -5,24 +5,17 @@ on:
|
|||
schedule: # Build and test daily.
|
||||
- cron: 0 11 * * *
|
||||
|
||||
env:
|
||||
# Caches should be automatically invalidated when versions change,
|
||||
# but invalidation can be forced by incrementing these numbers.
|
||||
EMSCRIPTEN_CACHE_VERSION: 1
|
||||
EXPORT_TEMPLATE_CACHE_VERSION: 1
|
||||
GODOT_CACHE_VERSION: 1
|
||||
|
||||
jobs:
|
||||
build_docker:
|
||||
name: 'Build Docker (linux, ${{ matrix.target }}, ${{ matrix.bits }})'
|
||||
name: 'Build Docker'
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target: [ release, debug ]
|
||||
bits: [ 64, 32 ]
|
||||
arch: [ x86_64, x86_32 ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Cache submodules
|
||||
|
@ -31,34 +24,31 @@ jobs:
|
|||
with:
|
||||
platform: linux
|
||||
target: ${{ matrix.target }}
|
||||
bits: ${{ matrix.bits }}
|
||||
arch: ${{ matrix.arch }}
|
||||
- name: Pull docker images
|
||||
run: docker-compose pull
|
||||
working-directory: addons/godot_xterm/native
|
||||
- name: Cache docker image layers
|
||||
uses: satackey/action-docker-layer-caching@v0
|
||||
uses: jpribyl/action-docker-layer-caching@v0.1.1
|
||||
continue-on-error: true
|
||||
- name: Build godot-cpp bindings
|
||||
if: steps.cache-submodules.outputs.cache-hit != 'true'
|
||||
working-directory: addons/godot_xterm/native
|
||||
run: |
|
||||
docker-compose build godot-cpp-linux
|
||||
UID_GID="$(id -u):$(id -g)" docker-compose run -e TARGET=${{ matrix.target }} -e BITS=${{ matrix.bits }} godot-cpp-linux
|
||||
- name: Ensure scons cache exists
|
||||
run: mkdir -p ${{github.workspace}}/.scons-cache
|
||||
- name: Build libuv
|
||||
if: steps.cache-submodules.outputs.cache-hit != 'true'
|
||||
working-directory: addons/godot_xterm/native
|
||||
run: UID_GID="$(id -u):$(id -g)" docker-compose run -e TARGET=${{ matrix.target }} -e BITS=${{ matrix.bits }} libuv-linux
|
||||
run: UID_GID="$(id -u):$(id -g)" docker-compose run -e TARGET=${{ matrix.target }} -e ARCH=${{ matrix.arch }} -v ${{github.workspace}}/.scons-cache:/scons-cache libuv-linux
|
||||
- name: Build libgodot-xterm
|
||||
working-directory: addons/godot_xterm/native
|
||||
run: UID_GID="$(id -u):$(id -g)" docker-compose run -e TARGET=${{ matrix.target }} -e BITS=${{ matrix.bits }} libgodot-xterm-linux
|
||||
run: UID_GID="$(id -u):$(id -g)" docker-compose run -e TARGET=${{ matrix.target }} -e ARCH=${{ matrix.arch }} -v ${{github.workspace}}/.scons-cache:/scons-cache libgodot-xterm-linux
|
||||
- name: Upload binaries
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: libgodot-xterm-${{ matrix.target }}
|
||||
path: |
|
||||
addons/godot_xterm/native/bin/*.so
|
||||
|
||||
build_native:
|
||||
if: false # Temporarily disabled.
|
||||
name: 'Build Native'
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
|
@ -80,7 +70,7 @@ jobs:
|
|||
- platform: osx
|
||||
bits: 32 # Only 64-bit supported on macOS.
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Cache submodules
|
||||
|
@ -92,12 +82,14 @@ jobs:
|
|||
bits: ${{ matrix.bits }}
|
||||
- name: Cache emscripten
|
||||
if: ${{ matrix.platform == 'javascript' }}
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-emscripten
|
||||
with:
|
||||
path: addons/godot_xterm/native/.emcache
|
||||
key: emsdk-cache-${{ matrix.target }}-v${{ env.EMSCRIPTEN_CACHE_VERSION }}
|
||||
key: emsdk-cache-${{ matrix.target }}-${{ hashFiles('**/*.c*', '**/*.h*') }}
|
||||
restore-keys: |
|
||||
emsdk-cache-${{ matrix.target }}-
|
||||
- name: Install javascript build dependencies
|
||||
if: ${{ matrix.platform == 'javascript' }}
|
||||
uses: mymindstorm/setup-emsdk@v11
|
||||
|
@ -160,7 +152,7 @@ jobs:
|
|||
cd addons/godot_xterm/native
|
||||
scons platform=${{ matrix.platform }} target=${{ matrix.target }} bits=${{ matrix.bits }} -j2
|
||||
- name: Upload binaries
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: libgodot-xterm-${{ matrix.target }}
|
||||
path: |
|
||||
|
@ -169,27 +161,23 @@ jobs:
|
|||
addons/godot_xterm/native/bin/*.dll
|
||||
|
||||
html5_export:
|
||||
if: false # Temporarily disabled.
|
||||
name: 'HTML5 Export'
|
||||
needs: [ build_docker, build_native ]
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup Godot
|
||||
uses: lihop/setup-godot@v2
|
||||
uses: lihop/setup-godot@4aad9daa7dd81c11329c4b54fdc26dbd39eea7d6
|
||||
with:
|
||||
export-templates: true
|
||||
- name: Install binary build artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: libgodot-xterm-release
|
||||
path: addons/godot_xterm/native/bin
|
||||
- name: Import assets
|
||||
uses: nick-fields/retry@v2
|
||||
with:
|
||||
command: godot --editor .github/import_assets.tscn
|
||||
retry_on: error
|
||||
timeout_minutes: 5
|
||||
max_attempts: 6
|
||||
uses: ./.github/actions/import-assets
|
||||
- name: Export HTML5
|
||||
uses: nick-fields/retry@v2
|
||||
with:
|
||||
|
@ -209,7 +197,7 @@ jobs:
|
|||
npx serve ../../docs/demo -p 3000 &
|
||||
npx cypress run
|
||||
- name: Upload cypress artifacts (on failure)
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
if: ${{ failure() }}
|
||||
with:
|
||||
name: cypress-artifacts
|
||||
|
@ -217,52 +205,48 @@ jobs:
|
|||
test/html5/cypress/screenshots
|
||||
test/html5/cypress/videos
|
||||
- name: Upload export
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: html5-demo
|
||||
path: docs/demo
|
||||
|
||||
test:
|
||||
name: 'Test'
|
||||
needs: [ build_docker, build_native ]
|
||||
needs: [ build_docker ] #, build_native ]
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ windows-2022, macos-12, ubuntu-22.04 ]
|
||||
os: [ ubuntu-22.04 ] #, macos-12, windows-2022 ] Temporarily disabled.
|
||||
bits: [ 64, 32 ]
|
||||
godot_version: [ 'v3.4.5-stable', 'v3.5-stable' ]
|
||||
godot_version: [ 'v4.0-beta14' ]
|
||||
exclude:
|
||||
- os: macos-12
|
||||
bits: 32
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup Godot
|
||||
uses: lihop/setup-godot@v2
|
||||
uses: lihop/setup-godot@4aad9daa7dd81c11329c4b54fdc26dbd39eea7d6
|
||||
with:
|
||||
version: ${{ matrix.godot_version }}
|
||||
bits: ${{ matrix.bits }}
|
||||
- name: Install binary build artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
- name: Install release binary build artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: libgodot-xterm-release
|
||||
path: addons/godot_xterm/native/bin
|
||||
- name: Run tests
|
||||
uses: nick-fields/retry@v2
|
||||
- name: Install debug binary build artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
shell: bash
|
||||
command: godot --no-window -s addons/gut/gut_cmdln.gd -gconfig=test/.gutconfig.ci.json
|
||||
retry_on: error
|
||||
timeout_minutes: 5
|
||||
max_attempts: 6
|
||||
name: libgodot-xterm-debug
|
||||
path: addons/godot_xterm/native/bin
|
||||
- name: Import assets
|
||||
uses: ./.github/actions/import-assets
|
||||
- name: Run tests
|
||||
run: godot -s addons/gut/gut_cmdln.gd -gconfig=test/.gutconfig.ci.json
|
||||
- name: Run unix tests
|
||||
if: ${{ matrix.os != 'windows-2022' }}
|
||||
uses: nick-fields/retry@v2
|
||||
with:
|
||||
command: godot --no-window -s addons/gut/gut_cmdln.gd -gconfig=test/.gutconfig.unix.json
|
||||
retry_on: error
|
||||
timeout_minutes: 5
|
||||
max_attempts: 6
|
||||
run: godot -s addons/gut/gut_cmdln.gd -gconfig=test/.gutconfig.unix.json
|
||||
|
||||
|
||||
# Git archive should only include addons/godot_xterm directory.
|
||||
|
@ -270,14 +254,14 @@ jobs:
|
|||
name: 'Check Archive'
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Create git archive
|
||||
run: git archive -o archive.zip HEAD
|
||||
- name: Extract archive
|
||||
run: mkdir -p /tmp/unzipped && unzip archive.zip -d /tmp/unzipped
|
||||
- name: Check that archive only contains addons directory
|
||||
- name: Check that archive only contains addons/godot_xterm directory
|
||||
run: |
|
||||
shopt -s nullglob dotglob
|
||||
ls -lR /tmp/unzipped
|
||||
|
@ -304,11 +288,12 @@ jobs:
|
|||
name: 'Check Code Format'
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-python@v2
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.x
|
||||
- name: GDFormat Check
|
||||
run: |
|
||||
python -m pip install -r requirements.txt
|
||||
gdformat -c .
|
||||
cache: 'pip'
|
||||
- name: Install python dependencies
|
||||
run: pip install -r requirements.txt
|
||||
- name: GDScript format check
|
||||
run: gdformat -c .
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue