GHA: New "Test builds" workflow

Rewritten to be able to run all unit tests.
This commit is contained in:
Serhii Snitsaruk 2023-09-15 10:49:33 +02:00
parent 46e45c6cfb
commit f7380db6a2
2 changed files with 47 additions and 108 deletions

View File

@ -1,4 +1,4 @@
name: 🔗 All Builds name: 🔗 All builds
on: on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:

View File

@ -1,4 +1,4 @@
name: 🔧 Test Builds name: 🔎 Test builds
on: on:
workflow_dispatch: workflow_dispatch:
@ -18,12 +18,11 @@ on:
- "**/*.png" - "**/*.png"
- "demo/*" - "demo/*"
# Global Settings # Global settings
env: env:
GODOT_TREEISH: 4.1.1-stable GODOT_TREEISH: 4.1.1-stable
SCONS_CACHE_MSVC_CONFIG: true
SCONS_CACHE_LIMIT: 7168
SCONSFLAGS: verbose=yes warnings=extra werror=yes SCONSFLAGS: verbose=yes warnings=extra werror=yes
SCONS_CACHE_LIMIT: 7168
DOTNET_NOLOGO: true DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true DOTNET_CLI_TELEMETRY_OPTOUT: true
@ -35,12 +34,14 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
include: include:
- name: 🐧 Editor (x86_64, debug) + Tests - name: 🐧 Unit tests
target: editor target: editor
arch: x86_64 arch: x86_64
production: false production: false
dev_build: true dev_build: true
tests: true tests: true
build-mono: false
artifact: false
- name: 🐧 Editor (x86_64, release) - name: 🐧 Editor (x86_64, release)
target: editor target: editor
@ -48,6 +49,8 @@ jobs:
production: true production: true
dev_build: false dev_build: false
tests: false tests: false
build-mono: false
artifact: true
- name: 🐧 Template (x86_64, release) - name: 🐧 Template (x86_64, release)
target: template_release target: template_release
@ -55,6 +58,8 @@ jobs:
production: true production: true
dev_build: false dev_build: false
tests: false tests: false
build-mono: false
artifact: true
- name: 🐧 Template (x86_64, debug) - name: 🐧 Template (x86_64, debug)
target: template_debug target: template_debug
@ -62,9 +67,11 @@ jobs:
production: true production: true
dev_build: false dev_build: false
tests: false tests: false
build-mono: false
artifact: true
env: env:
BIN: godot.linuxbsd.${{matrix.target}}${{ matrix.dev_build == true && '.dev' || '' }}.${{matrix.arch}} BIN: godot.linuxbsd.${{matrix.target}}${{matrix.dev_build == true && '.dev' || ''}}.${{matrix.arch}}${{matrix.build-mono == true && '.mono' || ''}}
steps: steps:
- name: Clone Godot - name: Clone Godot
@ -114,81 +121,6 @@ jobs:
${{env.BIN}}-${{env.GODOT_TREEISH}} ${{env.BIN}}-${{env.GODOT_TREEISH}}
continue-on-error: true continue-on-error: true
- name: Compilation
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
run: |
PATH=${GITHUB_WORKSPACE}/buildroot/bin:$PATH
scons platform=linuxbsd target=${{matrix.target}} arch=${{matrix.arch}} production=${{matrix.production}} dev_build=${{matrix.dev_build}} tests=${{matrix.tests}} ${{env.SCONSFLAGS}}
ls -l bin/
- name: Strip binaries
if: matrix.dev_build == false
run: strip ./bin/godot.*
- name: Prepare artifact
env:
OUTDIR: ${{ startsWith(matrix.target, 'template') && 'out/templates' || 'out/' }}
run: |
chmod +x ./bin/godot.*
mkdir -p ${{env.OUTDIR}}
mv ./bin/godot.* ${{env.OUTDIR}}
- name: Upload artifact
uses: actions/upload-artifact@v3
env:
NAME_EDITOR: ${{env.NAME_PREFIX}}.${{matrix.target}}${{matrix.dev_build == true && '.dev' || ''}}.linux.${{matrix.arch}}${{matrix.build-mono == true && '.mono' || ''}}
NAME_TEMPLATES: ${{env.NAME_PREFIX}}.export-templates${{ matrix.build-mono == true && '.mono' || '' }}
with:
name: ${{ startsWith(matrix.target, 'template') && env.NAME_TEMPLATES || env.NAME_EDITOR }}
path: out/*
- name: Unit Tests
if: ${{ matrix.tests }}
run: |
echo "Disk usage before tests:" && df -h
ls out/
./out/${{ env.BIN }} --version
./out/${{ env.BIN }} --help
./out/${{ env.BIN }} --headless --test --test-case="*[LimboAI]*"
windows-dot-net:
runs-on: "windows-latest"
name: ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
- name: 🪟 Editor .NET (x86_64, release)
target: editor
arch: x86_64
production: true
build-mono: true
- name: 🪟 Template .NET (x86_64, release)
target: template_release
arch: x86_64
production: true
build-mono: true
env:
BIN: godot.windows.${{matrix.target}}.${{matrix.arch}}${{ matrix.build-mono == true && '.mono' || '' }}
steps:
- name: Clone Godot
uses: actions/checkout@v3
with:
repository: godotengine/godot
ref: ${{ env.GODOT_TREEISH }}
- name: Clone LimboAI module
uses: actions/checkout@v3
with:
path: modules/limboai
# Inits GODOT_VERSION, LIMBOAI_VERSION and NAME_PREFIX environment variables.
- uses: ./modules/limboai/.github/actions/init-version
- name: Set up Python 3.x - name: Set up Python 3.x
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
@ -202,53 +134,60 @@ jobs:
python --version python --version
scons --version scons --version
- name: Set up MSVC problem matcher - name: Set up .NET SDK
uses: ammaraskar/msvc-problem-matcher@master if: matrix.build-mono
uses: actions/setup-dotnet@v2
- name: Set up scons cache
uses: actions/cache@v3
with: with:
path: ${{github.workspace}}/.scons_cache/ dotnet-version: '6.0.x'
key: ${{env.BIN}}-${{env.GODOT_TREEISH}}-${{github.ref}}-${{github.sha}}
restore-keys: | - name: Setup GCC problem matcher
${{env.BIN}}-${{env.GODOT_TREEISH}}-${{github.ref}}-${{github.sha}} uses: ammaraskar/gcc-problem-matcher@master
${{env.BIN}}-${{env.GODOT_TREEISH}}-${{github.ref}}
${{env.BIN}}-${{env.GODOT_TREEISH}}
- name: Compilation - name: Compilation
env: env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/ SCONS_CACHE: ${{github.workspace}}/.scons_cache/
run: | run: |
scons -j2 platform=windows target=${{matrix.target}} arch=${{matrix.arch}} production=${{matrix.production}} module_mono_enabled=${{matrix.build-mono}} ${{env.SCONSFLAGS}} PATH=${GITHUB_WORKSPACE}/buildroot/bin:$PATH
scons platform=linuxbsd target=${{matrix.target}} arch=${{matrix.arch}} production=${{matrix.production}} dev_build=${{matrix.dev_build}} tests=${{matrix.tests}} ${{env.SCONSFLAGS}}
ls -l bin/
- name: Generate C# glue - name: Generate C# glue
if: matrix.build-mono && matrix.target == 'editor' if: matrix.build-mono
env:
GODOT_VERSION_STATUS: limboai
run: | run: |
./bin/${{ env.BIN }} --headless --generate-mono-glue ./modules/mono/glue || true bin/${{ env.BIN }} --headless --generate-mono-glue ./modules/mono/glue || true
- name: Build .NET solutions - name: Build .NET solutions
if: matrix.build-mono && matrix.target == 'editor' if: matrix.build-mono
env:
GODOT_VERSION_STATUS: limboai
run: | run: |
python ./modules/mono/build_scripts/build_assemblies.py --godot-output-dir=./bin --godot-platform=windows ./modules/mono/build_scripts/build_assemblies.py --godot-output-dir=./bin --godot-platform=linuxbsd
# Execute unit tests for the editor
- name: Unit tests
if: matrix.tests
run: |
bin/${{ env.BIN }} --version
bin/${{ env.BIN }} --help
bin/${{ env.BIN }} --test --headless
- name: Strip binaries
if: matrix.dev_build == false
run: strip ./bin/godot.*
- name: Prepare artifact - name: Prepare artifact
shell: bash if: matrix.artifact
env: env:
OUTDIR: ${{ startsWith(matrix.target, 'template') && 'out/templates' || 'out/' }} OUTDIR: ${{ startsWith(matrix.target, 'template') && 'out/templates' || 'out/' }}
run: | run: |
rm -f bin/*.{exp,lib,pdb} chmod +x ./bin/godot.*
mkdir -p out/templates/ mkdir -p ${{env.OUTDIR}}
mv bin/* ${{env.OUTDIR}} mv ./bin/godot.* ${{env.OUTDIR}}
- name: Upload artifact - name: Upload artifact
if: matrix.artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
env: env:
NAME_EDITOR: ${{env.NAME_PREFIX}}.${{matrix.target}}${{matrix.dev_build == true && '.dev' || ''}}.windows.${{matrix.arch}}${{matrix.build-mono == true && '.mono' || ''}} NAME_EDITOR: ${{env.NAME_PREFIX}}.${{matrix.target}}${{matrix.dev_build == true && '.dev' || ''}}.linux.${{matrix.arch}}${{matrix.build-mono == true && '.mono' || ''}}
NAME_TEMPLATES: ${{env.NAME_PREFIX}}.export-templates${{ matrix.build-mono == true && '.mono' || '' }} NAME_TEMPLATES: ${{env.NAME_PREFIX}}.export-templates${{matrix.build-mono == true && '.mono' || ''}}
with: with:
name: ${{ startsWith(matrix.target, 'template') && env.NAME_TEMPLATES || env.NAME_EDITOR }} name: ${{ startsWith(matrix.target, 'template') && env.NAME_TEMPLATES || env.NAME_EDITOR }}
path: out/* path: out/*