GHA: Refactor Linux build workflow for the test builds

This commit is contained in:
Serhii Snitsaruk 2023-12-29 14:40:10 +01:00
parent 044de6eea0
commit 6bcffe712d
3 changed files with 58 additions and 121 deletions

View File

@ -61,6 +61,7 @@ jobs:
with:
godot-treeish: ${{ needs.cache-sha.outputs.godot-sha }}
limboai-treeish: ${{ needs.cache-sha.outputs.limboai-sha }}
test-build: false
macos-build:
name: 🍎 macOS

View File

@ -10,6 +10,10 @@ on:
description: A tag, branch or commit hash in the LimboAI repository.
type: string
default: master
test-build:
description: Is this a test build? In other words, should we only build a classical editor?
type: boolean
default: false
workflow_dispatch:
inputs:
@ -21,6 +25,10 @@ on:
description: A tag, branch or commit hash in the LimboAI repository.
type: string
default: master
test-build:
description: Is this a test build? In other words, should we only build a classical editor?
type: boolean
default: false
# Global Settings
env:
@ -32,73 +40,88 @@ env:
jobs:
linux-builds:
runs-on: "ubuntu-20.04"
name: ${{ matrix.name }}
name: ${{ matrix.opts.name }}
strategy:
fail-fast: false
matrix:
include:
opts:
- name: Editor (x86_64, release)
target: editor
arch: x86_64
build-mono: false
should-build: true
- name: Template (x86_64, release)
target: template_release
arch: x86_64
build-mono: false
should-build: true
- name: Template (x86_64, debug)
target: template_debug
arch: x86_64
build-mono: false
should-build: ${{ !inputs.test-build }}
# - name: Editor (x86_32, release)
# target: editor
# arch: x86_32
# build-mono: false
# should-build: ${{ !inputs.test-build }}
- name: Template (x86_32, release)
target: template_release
arch: x86_32
build-mono: false
should-build: ${{ !inputs.test-build }}
- name: Template (x86_32, debug)
target: template_debug
arch: x86_32
build-mono: false
should-build: ${{ !inputs.test-build }}
- name: Editor .NET (x86_64, release)
target: editor
arch: x86_64
build-mono: true
should-build: ${{ !inputs.test-build }}
- name: Template .NET (x86_64, release)
target: template_release
arch: x86_64
build-mono: true
should-build: ${{ !inputs.test-build }}
- name: Template .NET (x86_64, debug)
target: template_debug
arch: x86_64
build-mono: true
should-build: ${{ !inputs.test-build }}
# - name: Editor .NET (x86_32, release)
# target: editor
# arch: x86_32
# build-mono: true
# should-build: ${{ !inputs.test-build }}
- name: Template .NET (x86_32, release)
target: template_release
arch: x86_32
build-mono: true
should-build: ${{ !inputs.test-build }}
- name: Template .NET (x86_32, debug)
target: template_debug
arch: x86_32
build-mono: true
should-build: ${{ !inputs.test-build }}
exclude:
- { opts: {should-build: false }}
env:
BIN: godot.linuxbsd.${{matrix.target}}.${{matrix.arch}}${{ matrix.build-mono == true && '.mono' || '' }}
BIN: godot.linuxbsd.${{matrix.opts.target}}.${{matrix.opts.arch}}${{ matrix.opts.build-mono == true && '.mono' || '' }}
steps:
- name: Clone Godot
@ -118,7 +141,7 @@ jobs:
# About sed see: https://github.com/godotengine/buildroot/issues/6
- name: Set up buildroot x86_64
if: matrix.arch == 'x86_64'
if: matrix.opts.arch == 'x86_64'
run: |
wget https://download.tuxfamily.org/godotengine/toolchains/linux/x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2
tar -xjf x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2
@ -129,7 +152,7 @@ jobs:
cd ..
- name: Set up buildroot x86_32
if: matrix.arch == 'x86_32'
if: matrix.opts.arch == 'x86_32'
run: |
wget https://download.tuxfamily.org/godotengine/toolchains/linux/i686-godot-linux-gnu_sdk-buildroot.tar.bz2
tar -xjf i686-godot-linux-gnu_sdk-buildroot.tar.bz2
@ -153,17 +176,17 @@ jobs:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
run: |
PATH=${GITHUB_WORKSPACE}/buildroot/bin:$PATH
scons platform=linuxbsd target=${{matrix.target}} arch=${{matrix.arch}} module_mono_enabled=${{matrix.build-mono}} ${{env.SCONSFLAGS}}
scons platform=linuxbsd target=${{matrix.opts.target}} arch=${{matrix.opts.arch}} module_mono_enabled=${{matrix.opts.build-mono}} ${{env.SCONSFLAGS}}
- name: Generate C# glue
if: matrix.build-mono && matrix.target == 'editor'
if: matrix.opts.build-mono && matrix.opts.target == 'editor'
env:
GODOT_VERSION_STATUS: limboai
run: |
./bin/$BIN --headless --generate-mono-glue ./modules/mono/glue || true
- name: Build .NET solutions
if: matrix.build-mono && matrix.target == 'editor'
if: matrix.opts.build-mono && matrix.opts.target == 'editor'
env:
GODOT_VERSION_STATUS: limboai
run: |
@ -171,7 +194,7 @@ jobs:
- name: Prepare artifact
env:
OUTDIR: ${{ startsWith(matrix.target, 'template') && 'out/templates' || 'out/' }}
OUTDIR: ${{ startsWith(matrix.opts.target, 'template') && 'out/templates' || 'out/' }}
run: |
strip ./bin/godot.*
chmod +x ./bin/godot.*
@ -182,7 +205,7 @@ jobs:
# Zipping the editor artifact to retain executable bit;
# workaround for: https://github.com/actions/upload-artifact/issues/38
- name: Zip the editor artifact
if: matrix.target == 'editor'
if: matrix.opts.target == 'editor'
shell: bash
run: |
pushd out/
@ -192,19 +215,19 @@ jobs:
popd
- name: Rename templates
if: startsWith(matrix.target, 'template')
if: startsWith(matrix.opts.target, 'template')
env:
BUILD_TYPE: ${{ endsWith(matrix.target, 'release') && 'release' || 'debug' }}
BUILD_TYPE: ${{ endsWith(matrix.opts.target, 'release') && 'release' || 'debug' }}
run: |
mv out/templates/${BIN} out/templates/linux_${BUILD_TYPE}.${{matrix.arch}}
mv out/templates/${BIN} out/templates/linux_${BUILD_TYPE}.${{matrix.opts.arch}}
echo "${GODOT_VERSION}.limboai+${LIMBOAI_VERSION}" > out/templates/version.txt
ls -R out/
- name: Upload artifact
uses: actions/upload-artifact@v3
env:
NAME_EDITOR: ${{env.NAME_PREFIX}}.${{matrix.target}}.linux.${{matrix.arch}}${{ matrix.build-mono == true && '.mono' || '' }}
NAME_TEMPLATES: ${{env.NAME_PREFIX}}.export-templates${{ matrix.build-mono == true && '.mono' || '' }}
NAME_EDITOR: ${{env.NAME_PREFIX}}.${{matrix.opts.target}}.linux.${{matrix.opts.arch}}${{ matrix.opts.build-mono == true && '.mono' || '' }}
NAME_TEMPLATES: ${{env.NAME_PREFIX}}.export-templates${{ matrix.opts.build-mono == true && '.mono' || '' }}
with:
name: ${{ startsWith(matrix.target, 'template') && env.NAME_TEMPLATES || env.NAME_EDITOR }}
name: ${{ startsWith(matrix.opts.target, 'template') && env.NAME_TEMPLATES || env.NAME_EDITOR }}
path: out/*

View File

@ -29,59 +29,16 @@ on:
type: string
default: 4.2.1-stable
# Global settings
env:
SCONSFLAGS: verbose=yes warnings=extra werror=yes
SCONS_CACHE_LIMIT: 7168
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
linux-test-builds:
unit-tests:
name: 🧪 Unit tests
runs-on: "ubuntu-20.04"
name: ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
- name: 🐧 Unit tests
target: editor
arch: x86_64
production: false
dev_build: true
tests: true
build-mono: false
artifact: false
- name: 🐧 Editor (x86_64, release)
target: editor
arch: x86_64
production: true
dev_build: false
tests: false
build-mono: false
artifact: true
- name: 🐧 Template (x86_64, release)
target: template_release
arch: x86_64
production: true
dev_build: false
tests: false
build-mono: false
artifact: true
# - name: 🐧 Template (x86_64, debug)
# target: template_debug
# arch: x86_64
# production: true
# dev_build: false
# tests: false
# build-mono: false
# artifact: true
# Settings
env:
BIN: godot.linuxbsd.${{matrix.target}}${{matrix.dev_build == true && '.dev' || ''}}.${{matrix.arch}}${{matrix.build-mono == true && '.mono' || ''}}
SCONSFLAGS: platform=linuxbsd target=editor arch=x86_64 production=false dev_build=true tests=true verbose=yes warnings=extra werror=yes
SCONS_CACHE_LIMIT: 7168
BIN: godot.linuxbsd.editor.dev
steps:
- name: Clone Godot
@ -95,12 +52,8 @@ jobs:
with:
path: modules/limboai
# Inits GODOT_VERSION, LIMBOAI_VERSION and NAME_PREFIX environment variables.
- uses: ./modules/limboai/.github/actions/init-version
# About sed see: https://github.com/godotengine/buildroot/issues/6
- name: Set up buildroot x86_64
if: matrix.arch == 'x86_64'
run: |
wget https://download.tuxfamily.org/godotengine/toolchains/linux/x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2
tar -xjf x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2
@ -110,16 +63,6 @@ jobs:
./relocate-sdk.sh
cd ..
- name: Set up buildroot x86_32
if: matrix.arch == 'x86_32'
run: |
wget https://download.tuxfamily.org/godotengine/toolchains/linux/i686-godot-linux-gnu_sdk-buildroot.tar.bz2
tar -xjf i686-godot-linux-gnu_sdk-buildroot.tar.bz2
mv i686-godot-linux-gnu_sdk-buildroot buildroot
cd buildroot
./relocate-sdk.sh
cd ..
- name: Set up scons cache
uses: actions/cache@v3
with:
@ -144,12 +87,6 @@ jobs:
python --version
scons --version
- name: Set up .NET SDK
if: matrix.build-mono
uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0.x'
- name: Setup GCC problem matcher
uses: ammaraskar/gcc-problem-matcher@master
@ -158,49 +95,25 @@ jobs:
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}} module_mono_enabled=${{matrix.build-mono}} ${{env.SCONSFLAGS}}
scons platform=linuxbsd ${{env.SCONSFLAGS}}
ls -l bin/
- name: Generate C# glue
if: matrix.build-mono
run: |
bin/${{ env.BIN }} --headless --generate-mono-glue ./modules/mono/glue || true
- name: Build .NET solutions
if: matrix.build-mono
run: |
./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
- name: Verify build
run: |
bin/${{ env.BIN }} --version
bin/${{ env.BIN }} --help
- name: Unit tests
run: |
bin/${{ env.BIN }} --test --headless
- name: Strip binaries
if: matrix.dev_build == false
run: strip ./bin/godot.*
- name: Prepare artifact
if: matrix.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
if: matrix.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' || ''}}
linux-test-build:
name: 🐧 Linux test build
uses: ./.github/workflows/linux.yml
with:
name: ${{ startsWith(matrix.target, 'template') && env.NAME_TEMPLATES || env.NAME_EDITOR }}
path: out/*
godot-treeish: ${{ inputs.godot-treeish }}
limboai-treeish: ${{ github.sha }}
test-build: true
windows-test-build:
name: 🪟 Windows test build