godot-xterm/.github/workflows/main.yml

148 lines
5.2 KiB
YAML
Raw Normal View History

name: build
on: [ push ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
2021-06-07 08:53:43 +02:00
platform: [ linux, javascript, osx, windows ]
target: [ release, debug ]
bits: [ 64, 32 ]
include:
- platform: linux
os: ubuntu-latest
2021-06-07 08:53:43 +02:00
- platform: javascript
os: ubuntu-latest
- platform: osx
os: macos-latest
- platform: windows
os: windows-latest
exclude:
2021-06-07 08:53:43 +02:00
- 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 }}
2021-06-07 08:53:43 +02:00
- 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
2021-06-07 08:53:43 +02:00
# 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
2021-07-03 10:15:01 +02:00
- uses: ilammy/msvc-dev-cmd@v1.9.0
if: ${{ matrix.os == 'windows-latest' }}
2021-07-03 10:15:01 +02:00
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
2021-06-07 08:53:43 +02:00
addons/godot_xterm/native/bin/*.wasm
addons/godot_xterm/native/bin/*.dylib
addons/godot_xterm/native/bin/*.dll