mirror of
https://github.com/lihop/godot-xterm.git
synced 2024-11-14 22:30:26 +01:00
381 lines
13 KiB
YAML
381 lines
13 KiB
YAML
name: 'Build and Test'
|
|
|
|
on:
|
|
push:
|
|
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
|
|
GODOT_CPP_CACHE_VERSION: 1
|
|
LIBUV_CACHE_VERSION: 1
|
|
|
|
jobs:
|
|
build_docker:
|
|
name: 'Build Docker'
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
target: [ release, debug ]
|
|
bits: [ 64, 32 ]
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Get godot-cpp submodule commit hash
|
|
shell: bash
|
|
env:
|
|
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
|
|
run: |
|
|
echo ::set-env name=GODOT_CPP_COMMIT_HASH::$(git ls-tree HEAD addons/godot_xterm/native/thirdparty/godot-cpp -l | cut -d\ -f3)
|
|
- name: Cache godot-cpp bindings
|
|
uses: actions/cache@v2
|
|
id: cache
|
|
env:
|
|
cache-name: cache-godot-cpp
|
|
with:
|
|
path: addons/godot_xterm/native/thirdparty/godot-cpp
|
|
key: godot-cpp-${{ matrix.platform }}-${{ matrix.target }}-${{ matrix.bits }}-${{ env.GODOT_CPP_COMMIT_HASH }}-v${{ env.GODOT_CPP_CACHE_VERSION }}
|
|
- name: Get libuv submodule commit hash
|
|
shell: bash
|
|
env:
|
|
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
|
|
run: |
|
|
echo ::set-env name=LIBUV_COMMIT_HASH::$(git ls-tree HEAD addons/godot_xterm/native/thirdparty/libuv -l | cut -d\ -f3)
|
|
|
|
# Build inside docker container in order to target older GLIBC versions.
|
|
- name: Run build script
|
|
run: |
|
|
cd addons/godot_xterm/native
|
|
/bin/bash ./build.sh --target ${{ matrix.target }} --bits ${{ matrix.bits }} --docker
|
|
|
|
- name: Upload build artifacts
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: libgodot-xterm-${{ matrix.target }}
|
|
path: |
|
|
addons/godot_xterm/native/bin/*.so
|
|
|
|
|
|
build_native:
|
|
name: 'Build Native'
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
platform: [ linux, javascript, osx, windows ]
|
|
target: [ release, debug ]
|
|
bits: [ 64, 32 ]
|
|
include:
|
|
- platform: linux
|
|
os: ubuntu-latest
|
|
- platform: javascript
|
|
os: ubuntu-latest
|
|
- platform: osx
|
|
os: macos-latest
|
|
- platform: windows
|
|
os: windows-latest
|
|
exclude:
|
|
- platform: javascript
|
|
bits: 64 # Currently only wasm32 is supported.
|
|
- platform: osx
|
|
bits: 32 # Only 64-bit supported on macOS.
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Get godot-cpp submodule commit hash
|
|
shell: bash
|
|
env:
|
|
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
|
|
run: |
|
|
echo ::set-env name=GODOT_CPP_COMMIT_HASH::$(git ls-tree HEAD addons/godot_xterm/native/thirdparty/godot-cpp -l | cut -d\ -f3)
|
|
- name: Cache godot-cpp bindings
|
|
uses: actions/cache@v2
|
|
id: cache
|
|
env:
|
|
cache-name: cache-godot-cpp
|
|
with:
|
|
path: addons/godot_xterm/native/thirdparty/godot-cpp
|
|
key: godot-cpp-${{ matrix.platform }}-${{ matrix.target }}-${{ matrix.bits }}-${{ env.GODOT_CPP_COMMIT_HASH }}-v${{ env.GODOT_CPP_CACHE_VERSION }}
|
|
- name: Get libuv submodule commit hash
|
|
shell: bash
|
|
env:
|
|
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
|
|
run: |
|
|
echo ::set-env name=LIBUV_COMMIT_HASH::$(git ls-tree HEAD addons/godot_xterm/native/thirdparty/libuv -l | cut -d\ -f3)
|
|
- name: Cache libuv
|
|
uses: actions/cache@v2
|
|
id: cache-libuv
|
|
with:
|
|
path: addons/godot_xterm/native/thirdparty/libuv
|
|
key: libuv-cache-${{ matrix.platform }}-${{ matrix.target }}-${{ matrix.bits }}-${{ env.LIBUV_COMMIT_HASH }}-v${{ env.LIBUV_CACHE_VERSION }}
|
|
- name: Cache emscripten
|
|
if: ${{ matrix.platform == 'javascript' }}
|
|
uses: actions/cache@v2
|
|
env:
|
|
cache-name: cache-emscripten
|
|
with:
|
|
path: addons/godot_xterm/native/.emcache
|
|
key: emsdk-cache-${{ matrix.target }}-v${{ env.EMSCRIPTEN_CACHE_VERSION }}
|
|
|
|
# Ubuntu-specific steps.
|
|
- name: Install ubuntu build dependencies
|
|
if: ${{ matrix.os == 'ubuntu-latest' }}
|
|
run: sudo apt-get update && sudo apt-get install -y scons gcc-multilib g++-multilib
|
|
|
|
# JavaScript-specific steps.
|
|
- name: Install javascript build dependencies
|
|
if: ${{ matrix.platform == 'javascript' }}
|
|
uses: mymindstorm/setup-emsdk@v11
|
|
with:
|
|
version: 3.1.5
|
|
actions-cache-folder: emsdk-cache-${{ matrix.target }}
|
|
|
|
# MacOS-specific steps.
|
|
- name: Install additional macos build dependencies
|
|
if: ${{ matrix.os == 'macos-latest' }}
|
|
run: brew install scons
|
|
|
|
# Windows-specific steps.
|
|
- name: Install additional windows build dependencies
|
|
if: ${{ matrix.os == 'windows-latest' }}
|
|
run: python -m pip install scons
|
|
- uses: ilammy/msvc-dev-cmd@v1.9.0
|
|
if: ${{ matrix.os == 'windows-latest' }}
|
|
with:
|
|
arch: win${{ matrix.bits }}
|
|
|
|
- name: Build godot-cpp bindings
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd addons/godot_xterm/native/thirdparty/godot-cpp
|
|
scons platform=${{ matrix.platform }} target=${{ matrix.target }} bits=${{ matrix.bits }} generate_bindings=yes -j2
|
|
|
|
- name: Setup cmake
|
|
if: steps.cache-libuv.outputs.cache-hit != 'true'
|
|
uses: jwlawson/actions-setup-cmake@v1.9
|
|
with:
|
|
cmake-version: '3.15.4'
|
|
use-32bit: ${{ matrix.bits == 32 && matrix.os == 'windows-latest' }}
|
|
- name: Build libuv
|
|
if: steps.cache-libuv.outputs.cache-hit != 'true'
|
|
shell: bash
|
|
env:
|
|
TARGET: ${{ matrix.target }}
|
|
BITS: ${{ matrix.bits }}
|
|
OS: ${{ matrix.os }}
|
|
run: |
|
|
cd addons/godot_xterm/native/thirdparty/libuv
|
|
args="-DCMAKE_BUILD_TYPE=$TARGET -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE"
|
|
if [ "$TARGET" == "release" ]; then
|
|
args="$args -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL"
|
|
else
|
|
args="$args -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL"
|
|
fi
|
|
if [ "$BITS" -eq 32 -a "$OS" == "windows-latest" ]; then
|
|
cmake -G "Visual Studio 16 2019" -A Win32 -S $(pwd) -B "build" $args
|
|
else
|
|
mkdir build || true
|
|
cd build
|
|
if [ "$BITS" -eq 32 ]; then args="$args -DCMAKE_SYSTEM_PROCESSOR=i686 -DCMAKE_C_FLAGS=-m32"; fi
|
|
cmake .. $args
|
|
cd ..
|
|
fi
|
|
cmake --build build --config $TARGET
|
|
|
|
- name: Build libgodot-xterm
|
|
run: |
|
|
cd addons/godot_xterm/native
|
|
scons platform=${{ matrix.platform }} target=${{ matrix.target }} bits=${{ matrix.bits }} -j2
|
|
|
|
- name: Upload build artifacts
|
|
uses: actions/upload-artifact@v2
|
|
if: ${{ matrix.platform != 'linux' }}
|
|
with:
|
|
name: libgodot-xterm-${{ matrix.target }}
|
|
path: |
|
|
addons/godot_xterm/native/bin/*.wasm
|
|
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
|
|
|
|
|
|
install_plugins:
|
|
name: 'Install Plugins'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Setup Godot
|
|
uses: lihop/setup-godot@v1.0.0
|
|
- name: Install plugins
|
|
run: godot --no-window -s plug.gd install
|
|
- name: Upload install plugins for use by other jobs
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: plugins
|
|
retention-days: 1 # Minimum.
|
|
path: |
|
|
addons
|
|
!addons/godot_xterm
|
|
|
|
|
|
html5_export:
|
|
name: 'HTML5 Export'
|
|
needs: [ build_docker, build_native, export_template ]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
submodules: recursive
|
|
- name: Setup Godot
|
|
uses: lihop/setup-godot@v1.0.0
|
|
- name: Install binary build artifacts
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: libgodot-xterm-release
|
|
path: addons/godot_xterm/native/bin
|
|
- name: Install html5 export templates
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: html5-gdnative-export-templates
|
|
path: misc/export_templates/godot/bin
|
|
- name: Install plugins
|
|
run: godot --no-window -s plug.gd install
|
|
- 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
|
|
|
|
|
|
test:
|
|
name: 'Test'
|
|
needs: [ install_plugins, build_docker, build_native ]
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ windows-latest, macos-latest, ubuntu-latest ]
|
|
bits: [ 64, 32 ]
|
|
godot_version: [ 'v3.2-stable', 'v3.3.4-stable', 'v3.4.4-stable', 'v3.5-beta1' ]
|
|
exclude:
|
|
- os: macos-latest
|
|
bits: 32
|
|
- os: ubuntu-latest
|
|
godot_version: 'v3.2-stable'
|
|
bits: 32
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
submodules: recursive
|
|
- name: Setup Godot
|
|
uses: lihop/setup-godot@v1.0.0
|
|
with:
|
|
version: ${{ matrix.godot_version }}
|
|
bits: ${{ matrix.bits }}
|
|
- name: Install binary build artifacts
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: libgodot-xterm-release
|
|
path: addons/godot_xterm/native/bin
|
|
- name: Install plugins
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: plugins
|
|
path: ./addons
|
|
- name: Run tests
|
|
if: ${{ matrix.godot_version != 'v3.2-stable' }}
|
|
shell: bash
|
|
run: godot --no-window -s addons/gut/gut_cmdln.gd -gconfig=test/.gutconfig.ci.json
|
|
- name: Run v3.2 tests
|
|
if: ${{ matrix.godot_version == 'v3.2-stable' }}
|
|
shell: bash
|
|
run: godot --no-window -s addons/gut/gut_cmdln.gd -gconfig=test/.gutconfig.3.2.json
|
|
- name: Run unix tests
|
|
if: ${{ matrix.os != 'windows-latest' }}
|
|
run: godot --no-window -s addons/gut/gut_cmdln.gd -gconfig=test/.gutconfig.unix.json
|
|
|
|
|
|
# Git archive should only include addons/godot_xterm directory.
|
|
check-archive:
|
|
name: 'Check Archive'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
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
|
|
run: |
|
|
shopt -s nullglob dotglob
|
|
ls -lR /tmp/unzipped
|
|
files=(/tmp/unzipped/*)
|
|
if [ ${#files[@]} -ne 1 ]; then
|
|
echo "Wrong number of files in archive (${#files[@]}) expected 1."
|
|
exit 1
|
|
fi
|
|
if [ ! -d "/tmp/unzipped/addons" ]; then
|
|
echo "Expected directory (addons) not found."
|
|
exit 1
|
|
fi
|
|
files=(/tmp/unzipped/addons)
|
|
if [ ${#files[@]} -ne 1 ]; then
|
|
echo "Wrong number of files in addons directory (${#files[@]}) expected 1."
|
|
exit 1
|
|
fi
|
|
if [ ! -d "/tmp/unzipped/addons/godot_xterm" ]; then
|
|
echo "Expected directory (addons/godot_xterm) not found."
|
|
exit 1
|
|
fi
|
|
|