godot-xterm/.github/workflows/main.yml
Leroy Hopson b08d218a59
Run tests in CI environment
Currently tests only run on X11.64 platform.
But other platforms can be supported with a bit of effort.
Remove default bell sound as it does not play nicely with CI environment
that does not have sound card.
2021-07-18 23:05:17 +07:00

237 lines
8.3 KiB
YAML

name: 'Build and Test'
on: [ push ]
jobs:
build:
name: 'Build'
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-v1-${{ matrix.platform }}-${{ matrix.target }}-${{ matrix.bits }}-${{ env.GODOT_CPP_COMMIT_HASH }}
- 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-v1-${{ matrix.platform }}-${{ matrix.target }}-${{ matrix.bits }}-${{ env.LIBUV_COMMIT_HASH }}
- 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-v1-${{ matrix.target }}
# Ubuntu-specific steps.
- name: Install ubuntu build dependencies
if: ${{ matrix.os == 'ubuntu-latest' }}
run: 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@v9
with:
version: 2.0.10
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
with:
name: libgodot-xterm-${{ matrix.target }}
path: |
addons/godot_xterm/native/bin/*.so
addons/godot_xterm/native/bin/*.wasm
addons/godot_xterm/native/bin/*.dylib
addons/godot_xterm/native/bin/*.dll
test:
name: 'Test'
needs: build
env:
GODOT: Godot_v3.3.2-stable_${{ matrix.platform }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
platform: [ x11.64 ] #, x11.32, win64.exe, win32.exe, osx.universal ]
target: [ release, debug ]
include:
- platform: x11.64
os: ubuntu-latest
# For Windows platform we need to install mesa-dist-win.
# 32 bit X11 and MacOS also needs special attention.
# So disable all of them for now.
#- platform: x11.32
# os: ubuntu-latest
#- platform: win64.exe
# os: windows-latest
#- platform: win32.exe
# os: windows-latest
#- platform: osx.universal
# os: macos-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Cache Godot
uses: actions/cache@v2
id: cache-godot
env:
cache-name: cache-godot
with:
path: godot_executable/
key: godot-cache-v1-${{ env.GODOT }}
#- name: Install 32 bit dependencies on 64 bit Ubuntu
# if: ${{ matrix.platform == 'x11.32' }}
# run: sudo apt-get install -y libxcursor-dev:i386
- name: Install Ubuntu dependencies
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt-get install -y pulseaudio
- name: Download Godot
uses: suisei-cn/actions-download-file@v1
if: steps.cache-godot.outputs.cache-hit != 'true'
with:
url: https://downloads.tuxfamily.org/godotengine/3.3.2/${{ env.GODOT }}.zip
target: godot_executable/
- name: Extract Godot
shell: bash
if: steps.cache-godot.outputs.cache-hit != 'true'
run: |
cd godot_executable
unzip ${{ env.GODOT }}.zip
- name: Symlink Godot
if: ${{ matrix.platform == 'osx.universal' }}
run: ln -s godot_executable/Godot.app/Contents/MacOS/Godot godot_executable/${{ env.GODOT }}
- name: Install binary build artifacts
uses: actions/download-artifact@v2
with:
name: libgodot-xterm-${{ matrix.target }}
path: addons/godot_xterm/native/bin
- name: Install plugins
uses: GabrielBB/xvfb-action@v1
with:
run: godot_executable/${{ env.GODOT }} --no-window -s plug.gd install
- name: Import files
uses: GabrielBB/xvfb-action@v1
with:
run: ./godot_executable/${{ env.GODOT }} --editor --quit
- name: Run tests
uses: GabrielBB/xvfb-action@v1
with:
run: ./godot_executable/${{ env.GODOT }} --no-window -s addons/gut/gut_cmdln.gd -gconfig=test/.gutconfig.ci.json
- name: Run unix tests
if: ${{ matrix.platform != 'win64.exe' && matrix.platform != 'win32.exe' }}
uses: GabrielBB/xvfb-action@v1
with:
run: ./godot_executable/${{ env.GODOT }} --no-window -s addons/gut/gut_cmdln.gd -gconfig=test/.gutconfig.unix.json