Update build files and GitHub Actions workflow

This commit is contained in:
Leroy Hopson 2023-01-26 07:12:07 +13:00
parent 237a456f99
commit 2ba480b4da
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA
15 changed files with 172 additions and 429 deletions

View file

@ -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 .