2021-07-18 14:15:08 +02:00
|
|
|
name: 'Build and Test'
|
2020-11-06 06:57:25 +01:00
|
|
|
|
2021-07-23 15:44:17 +02:00
|
|
|
on:
|
|
|
|
push:
|
2021-12-17 09:45:06 +01:00
|
|
|
schedule: # Build and test daily.
|
|
|
|
- cron: 0 11 * * *
|
2020-11-06 06:57:25 +01:00
|
|
|
|
2021-07-20 02:27:07 +02:00
|
|
|
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
|
|
|
|
|
2020-11-06 06:57:25 +01:00
|
|
|
jobs:
|
2022-06-01 05:26:03 +02:00
|
|
|
build_docker:
|
|
|
|
name: 'Build Docker (linux, ${{ matrix.target }}, ${{ matrix.bits }})'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
target: [ release, debug ]
|
|
|
|
bits: [ 64, 32 ]
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
- name: Cache submodules
|
|
|
|
uses: ./.github/actions/cache-submodules
|
|
|
|
id: cache-submodules
|
|
|
|
with:
|
|
|
|
platform: linux
|
|
|
|
target: ${{ matrix.target }}
|
|
|
|
bits: ${{ matrix.bits }}
|
|
|
|
- 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.0.11
|
|
|
|
continue-on-error: true
|
|
|
|
- name: Build godot-cpp bindings
|
|
|
|
if: steps.cache-submodules.outputs.cache-hit != 'true'
|
|
|
|
working-directory: addons/godot_xterm/native
|
2022-08-03 12:38:21 +02:00
|
|
|
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
|
2022-06-01 05:26:03 +02:00
|
|
|
- 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
|
|
|
|
- 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
|
|
|
|
- name: Upload binaries
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: libgodot-xterm-${{ matrix.target }}
|
|
|
|
path: |
|
|
|
|
addons/godot_xterm/native/bin/*.so
|
|
|
|
|
|
|
|
build_native:
|
|
|
|
name: 'Build Native'
|
2020-11-20 15:34:49 +01:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
2021-07-02 20:17:02 +02:00
|
|
|
fail-fast: false
|
2020-11-20 15:34:49 +01:00
|
|
|
matrix:
|
2022-06-01 05:26:03 +02:00
|
|
|
platform: [ javascript, osx, windows ]
|
2020-11-22 16:16:38 +01:00
|
|
|
target: [ release, debug ]
|
2020-11-20 15:34:49 +01:00
|
|
|
bits: [ 64, 32 ]
|
|
|
|
include:
|
2021-06-07 08:53:43 +02:00
|
|
|
- platform: javascript
|
|
|
|
os: ubuntu-latest
|
2020-11-20 15:34:49 +01:00
|
|
|
- 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.
|
2020-11-20 15:34:49 +01:00
|
|
|
- platform: osx
|
|
|
|
bits: 32 # Only 64-bit supported on macOS.
|
2020-11-10 04:04:08 +01:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
2022-06-01 04:54:06 +02:00
|
|
|
- name: Cache submodules
|
|
|
|
uses: ./.github/actions/cache-submodules
|
|
|
|
id: cache-submodules
|
2021-07-02 19:27:34 +02:00
|
|
|
with:
|
2022-06-01 04:54:06 +02:00
|
|
|
platform: ${{ matrix.platform }}
|
|
|
|
target: ${{ matrix.target }}
|
|
|
|
bits: ${{ matrix.bits }}
|
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
|
2021-07-20 02:27:07 +02:00
|
|
|
key: emsdk-cache-${{ matrix.target }}-v${{ env.EMSCRIPTEN_CACHE_VERSION }}
|
2021-06-07 08:53:43 +02:00
|
|
|
- name: Install javascript build dependencies
|
|
|
|
if: ${{ matrix.platform == 'javascript' }}
|
2022-02-24 03:43:03 +01:00
|
|
|
uses: mymindstorm/setup-emsdk@v11
|
2021-06-07 08:53:43 +02:00
|
|
|
with:
|
2022-08-01 09:56:43 +02:00
|
|
|
version: 3.1.14
|
2021-06-07 08:53:43 +02:00
|
|
|
actions-cache-folder: emsdk-cache-${{ matrix.target }}
|
2022-06-01 05:26:03 +02:00
|
|
|
- name: Install additional javascript build dependencies
|
|
|
|
if: ${{ matrix.platform == 'javascript' }}
|
|
|
|
run: sudo apt-get update && sudo apt-get install -y scons gcc-multilib g++-multilib
|
2020-11-20 15:34:49 +01:00
|
|
|
- name: Install additional macos build dependencies
|
|
|
|
if: ${{ matrix.os == 'macos-latest' }}
|
2020-11-20 03:00:03 +01:00
|
|
|
run: brew install scons
|
2020-11-20 15:34:49 +01:00
|
|
|
- name: Install additional windows build dependencies
|
|
|
|
if: ${{ matrix.os == 'windows-latest' }}
|
2020-11-22 16:45:02 +01:00
|
|
|
run: python -m pip install scons
|
2022-06-01 05:26:03 +02:00
|
|
|
- name: Setup MSVC command prompt
|
|
|
|
uses: ilammy/msvc-dev-cmd@v1.9.0
|
2020-11-20 15:34:49 +01:00
|
|
|
if: ${{ matrix.os == 'windows-latest' }}
|
2021-07-03 10:15:01 +02:00
|
|
|
with:
|
|
|
|
arch: win${{ matrix.bits }}
|
2020-11-20 15:34:49 +01:00
|
|
|
- name: Build godot-cpp bindings
|
2022-06-01 04:54:06 +02:00
|
|
|
if: steps.cache-submodules.outputs.cache-hit != 'true'
|
2020-11-20 15:34:49 +01:00
|
|
|
run: |
|
2021-06-12 10:02:22 +02:00
|
|
|
cd addons/godot_xterm/native/thirdparty/godot-cpp
|
2020-11-22 16:16:38 +01:00
|
|
|
scons platform=${{ matrix.platform }} target=${{ matrix.target }} bits=${{ matrix.bits }} generate_bindings=yes -j2
|
2021-07-16 09:31:13 +02:00
|
|
|
- name: Setup cmake
|
2022-06-01 04:54:06 +02:00
|
|
|
if: steps.cache-submodules.outputs.cache-hit != 'true'
|
2021-07-16 09:31:13 +02:00
|
|
|
uses: jwlawson/actions-setup-cmake@v1.9
|
2021-07-02 19:27:34 +02:00
|
|
|
with:
|
2022-06-01 04:41:59 +02:00
|
|
|
cmake-version: '3.23.2'
|
2021-07-16 09:31:13 +02:00
|
|
|
use-32bit: ${{ matrix.bits == 32 && matrix.os == 'windows-latest' }}
|
|
|
|
- name: Build libuv
|
2022-06-01 04:54:06 +02:00
|
|
|
if: steps.cache-submodules.outputs.cache-hit != 'true'
|
2021-07-16 09:31:13 +02:00
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
TARGET: ${{ matrix.target }}
|
|
|
|
BITS: ${{ matrix.bits }}
|
|
|
|
OS: ${{ matrix.os }}
|
|
|
|
run: |
|
|
|
|
cd addons/godot_xterm/native/thirdparty/libuv
|
2022-05-31 15:14:41 +02:00
|
|
|
args="-DCMAKE_BUILD_TYPE=$TARGET -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \
|
|
|
|
-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64"
|
2021-07-18 11:06:38 +02:00
|
|
|
if [ "$TARGET" == "release" ]; then
|
|
|
|
args="$args -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL"
|
|
|
|
else
|
|
|
|
args="$args -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL"
|
|
|
|
fi
|
2021-07-16 09:31:13 +02:00
|
|
|
if [ "$BITS" -eq 32 -a "$OS" == "windows-latest" ]; then
|
2022-06-01 04:41:59 +02:00
|
|
|
cmake -G "Visual Studio 17 2022" -A Win32 -S $(pwd) -B "build" $args
|
2021-07-16 09:31:13 +02:00
|
|
|
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
|
2020-11-20 15:34:49 +01:00
|
|
|
- name: Build libgodot-xterm
|
2020-11-20 03:00:03 +01:00
|
|
|
run: |
|
|
|
|
cd addons/godot_xterm/native
|
2021-07-18 11:06:38 +02:00
|
|
|
scons platform=${{ matrix.platform }} target=${{ matrix.target }} bits=${{ matrix.bits }} -j2
|
2022-06-01 05:26:03 +02:00
|
|
|
- name: Upload binaries
|
2020-11-20 15:34:49 +01:00
|
|
|
uses: actions/upload-artifact@v2
|
2020-11-20 03:00:03 +01:00
|
|
|
with:
|
2020-11-22 16:56:20 +01:00
|
|
|
name: libgodot-xterm-${{ matrix.target }}
|
2020-11-20 15:34:49 +01:00
|
|
|
path: |
|
2021-06-07 08:53:43 +02:00
|
|
|
addons/godot_xterm/native/bin/*.wasm
|
2020-11-20 15:34:49 +01:00
|
|
|
addons/godot_xterm/native/bin/*.dylib
|
|
|
|
addons/godot_xterm/native/bin/*.dll
|
|
|
|
|
2021-07-24 06:40:29 +02:00
|
|
|
html5_export:
|
|
|
|
name: 'HTML5 Export'
|
2022-08-01 09:56:43 +02:00
|
|
|
needs: [ build_docker, build_native ]
|
2021-07-24 06:40:29 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Setup Godot
|
2022-08-26 05:17:59 +02:00
|
|
|
uses: lihop/setup-godot@v2
|
|
|
|
with:
|
|
|
|
export-templates: true
|
2021-07-24 06:40:29 +02:00
|
|
|
- name: Install binary build artifacts
|
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
with:
|
|
|
|
name: libgodot-xterm-release
|
|
|
|
path: addons/godot_xterm/native/bin
|
2022-08-01 09:56:43 +02:00
|
|
|
- name: Import assets
|
|
|
|
shell: bash
|
2022-08-27 00:31:25 +02:00
|
|
|
run: godot --editor .github/import_assets.tscn
|
2022-08-01 09:56:43 +02:00
|
|
|
- name: Export HTML5
|
|
|
|
run: godot --no-window --export HTML5
|
|
|
|
- name: NPM cache
|
|
|
|
uses: c-hive/gha-npm-cache@v1
|
2021-07-24 06:40:29 +02:00
|
|
|
with:
|
2022-08-01 09:56:43 +02:00
|
|
|
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
|
2021-07-20 02:27:07 +02:00
|
|
|
|
2021-07-24 06:40:29 +02:00
|
|
|
test:
|
|
|
|
name: 'Test'
|
2022-06-02 04:13:43 +02:00
|
|
|
needs: [ build_docker, build_native ]
|
2021-07-23 15:44:17 +02:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2021-07-24 06:40:29 +02:00
|
|
|
os: [ windows-latest, macos-latest, ubuntu-latest ]
|
2021-07-23 15:44:17 +02:00
|
|
|
bits: [ 64, 32 ]
|
2022-08-25 02:33:45 +02:00
|
|
|
godot_version: [ 'v3.4.5-stable', 'v3.5-stable' ]
|
2021-07-23 15:44:17 +02:00
|
|
|
exclude:
|
|
|
|
- os: macos-latest
|
|
|
|
bits: 32
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Setup Godot
|
2022-08-26 05:17:59 +02:00
|
|
|
uses: lihop/setup-godot@v2
|
2021-07-23 15:44:17 +02:00
|
|
|
with:
|
|
|
|
version: ${{ matrix.godot_version }}
|
|
|
|
bits: ${{ matrix.bits }}
|
|
|
|
- name: Install binary build artifacts
|
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
with:
|
2021-07-24 06:40:29 +02:00
|
|
|
name: libgodot-xterm-release
|
2021-07-23 15:44:17 +02:00
|
|
|
path: addons/godot_xterm/native/bin
|
|
|
|
- name: Run tests
|
2022-08-23 23:41:22 +02:00
|
|
|
uses: nick-fields/retry@v2
|
|
|
|
with:
|
|
|
|
shell: bash
|
|
|
|
command: godot --no-window -s addons/gut/gut_cmdln.gd -gconfig=test/.gutconfig.ci.json
|
|
|
|
retry_on: error
|
|
|
|
timeout_minutes: 5
|
2022-08-26 12:46:34 +02:00
|
|
|
max_attempts: 6
|
2021-07-23 15:44:17 +02:00
|
|
|
- name: Run unix tests
|
2021-07-24 06:40:29 +02:00
|
|
|
if: ${{ matrix.os != 'windows-latest' }}
|
2022-08-23 23:41:22 +02:00
|
|
|
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
|
2022-08-26 12:46:34 +02:00
|
|
|
max_attempts: 6
|
2021-07-23 15:44:17 +02:00
|
|
|
|
|
|
|
|
2021-07-18 19:27:25 +02:00
|
|
|
# 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
|
2021-07-20 02:27:07 +02:00
|
|
|
|
2022-04-23 10:49:39 +02:00
|
|
|
check-code-format:
|
|
|
|
name: 'Check Code Format'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: 3.x
|
|
|
|
- name: GDFormat Check
|
|
|
|
run: |
|
|
|
|
python -m pip install -r requirements.txt
|
|
|
|
gdformat -c .
|