Add some build constants. #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: xr-grid-shader Builds | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
env: | |
GODOT_BASE_BRANCH: master | |
SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes | |
DOTNET_NOLOGO: true | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
EM_VERSION: 3.1.18 | |
EM_CACHE_FOLDER: "emsdk-cache" | |
concurrency: | |
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-deploy | |
cancel-in-progress: true | |
jobs: | |
build-linux: | |
runs-on: "ubuntu-20.04" | |
name: ${{ matrix.name }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: linux_editor_win_deploy | |
cache-name: linux-editor-deploy-windows-editor | |
target: editor | |
tests: false | |
sconsflags: use_llvm=yes linker=gold deprecate=no | |
doc-test: false | |
bin: "./bin/godot.linuxbsd.editor.x86_64.llvm" | |
deploy-bin: "./bin/godot.windows.editor.x86_64.llvm.exe" | |
proj-conv: false | |
artifact: true | |
platform: linuxbsd | |
deploy: true | |
deploy-platform: windows | |
deploy-platform-target: editor | |
- name: linux_editor_linux_deploy | |
cache-name: linux-editor-deploy-linux-editor | |
target: editor | |
tests: false | |
sconsflags: use_llvm=yes linker=gold deprecate=no | |
doc-test: false | |
bin: "./bin/godot.linuxbsd.editor.x86_64.llvm" | |
deploy-bin: "./bin/godot.linuxbsd.editor.x86_64.llvm" | |
proj-conv: false | |
artifact: true | |
platform: linuxbsd | |
deploy: true | |
deploy-platform: linux | |
deploy-platform-target: editor | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.5.2 | |
- name: Linux dependencies for gold linker | |
run: | | |
sudo apt-get install -qq binutils | |
- name: Setup Godot build cache | |
uses: ./.github/actions/godot-cache | |
with: | |
cache-name: ${{ matrix.cache-name }} | |
continue-on-error: true | |
- name: Set up Emscripten latest | |
if: ${{ matrix.platform == 'web' }} | |
uses: mymindstorm/setup-emsdk@ab889da2abbcbb280f91ec4c215d3bb4f3a8f775 # v12 | |
with: | |
version: ${{env.EM_VERSION}} | |
actions-cache-folder: ${{env.EM_CACHE_FOLDER}} | |
- name: Verify Emscripten setup | |
if: ${{ matrix.platform == 'web' }} | |
run: | | |
emcc -v | |
- name: Setup python and scons | |
uses: ./.github/actions/godot-deps | |
- name: Set up .NET Sdk | |
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0 | |
if: ${{ matrix.build-mono }} | |
with: | |
dotnet-version: "6.0.x" | |
- name: Setup GCC problem matcher | |
uses: ammaraskar/gcc-problem-matcher@d1fed1fac9e94d30e23b5a82dba4e2963e71d2e7 # master | |
- name: Compilation | |
uses: ./.github/actions/godot-build | |
with: | |
sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }} | |
platform: ${{ matrix.platform }} | |
target: ${{ matrix.target }} | |
tests: ${{ matrix.tests }} | |
deploy: ${{ matrix.deploy }} | |
deploy-platform: ${{ matrix.deploy-platform }} | |
deploy-platform-target: ${{ matrix.deploy-platform-target }} | |
- name: Generate build constants | |
uses: ./.github/actions/vsk-generate-constants | |
- name: Export Game | |
if: ${{ matrix.deploy }} | |
run: | | |
mkdir -p .godot/editor .godot/imported export_linux | |
chmod +x ${{ matrix.bin }} | |
${{ matrix.bin }} --headless --xr-mode off --export-pack Linux `pwd`/vsekai_game_${{ matrix.deploy-platform }}.pck --path . || true | |
timeout-minutes: 10 | |
- name: Prepare artifacts | |
if: ${{ matrix.deploy && matrix.deploy-platform == 'windows' }} | |
run: | | |
rm -rf vsekai_game_${{ matrix.deploy-platform }} | |
export TARGET=vsekai_game_${{ matrix.deploy-platform }} | |
mkdir -p $TARGET | |
cp -rf ${{ matrix.deploy-bin }} $TARGET/vsekai_game_${{ matrix.deploy-platform }}.exe | |
cp -rf vsekai_game_${{ matrix.deploy-platform }}.pck $TARGET/vsekai_game_${{ matrix.deploy-platform }}.pck | |
7z a -r $TARGET.zip $TARGET | |
shell: bash | |
- name: Prepare artifacts | |
if: ${{ matrix.deploy && matrix.deploy-platform != 'windows' }} | |
run: | | |
rm -rf vsekai_game_${{ matrix.deploy-platform }} | |
export TARGET=vsekai_game_${{ matrix.deploy-platform }} | |
mkdir -p $TARGET | |
cp -rf ${{ matrix.deploy-bin }} $TARGET/vsekai_game_${{ matrix.deploy-platform }} | |
cp -rf vsekai_game_${{ matrix.deploy-platform }}.pck $TARGET/vsekai_game_${{ matrix.deploy-platform }}.pck | |
7z a -r $TARGET.zip $TARGET | |
shell: bash | |
- name: Upload Godot Artifact Export | |
if: ${{ matrix.deploy }} | |
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
with: | |
name: vsekai_game_${{ matrix.deploy-platform }}_x86_64 | |
path: | | |
vsekai_game_${{ matrix.deploy-platform }} | |
- name: Generate C# glue | |
if: ${{ matrix.build-mono }} | |
run: | | |
${{ matrix.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 | |
- name: Unit tests | |
if: ${{ matrix.tests }} | |
run: | | |
${{ matrix.bin }} --version | |
${{ matrix.bin }} --help | |
${{ matrix.bin }} --test --headless | |
- name: Check for class reference updates | |
if: ${{ matrix.doc-test }} | |
run: | | |
echo "Running --doctool to see if this changes the public API without updating the documentation." | |
echo -e "If a diff is shown, it means that your code/doc changes are incomplete and you should update the class reference with --doctool.\n\n" | |
${{ matrix.bin }} --doctool --headless 2>&1 > /dev/null || true | |
git diff --color --exit-code && ! git ls-files --others --exclude-standard | sed -e 's/^/New doc file missing in PR: /' | grep 'xml$' | |
- name: Test project converter | |
if: ${{ matrix.proj-conv }} | |
run: | | |
mkdir -p converter_test | |
cd converter_test | |
touch project.godot | |
${{ matrix.bin }} --headless --validate-conversion-3to4 | |
cd .. | |
rm converter_test -rf | |
- name: Open and close editor (Vulkan) | |
if: ${{ matrix.proj-test }} | |
run: | | |
xvfb-run ${{ matrix.bin }} --audio-driver Dummy --editor --quit --path test_project 2>&1 | tee sanitizers_log.txt || true | |
misc/scripts/check_ci_log.py sanitizers_log.txt | |
- name: Open and close editor (GLES3) | |
if: ${{ matrix.proj-test }} | |
run: | | |
DRI_PRIME=0 xvfb-run ${{ matrix.bin }} --audio-driver Dummy --rendering-driver opengl3 --editor --quit --path test_project 2>&1 | tee sanitizers_log.txt || true | |
misc/scripts/check_ci_log.py sanitizers_log.txt | |
- name: Run project | |
if: ${{ matrix.proj-test }} | |
run: | | |
xvfb-run ${{ matrix.bin }} 40 --audio-driver Dummy --path test_project 2>&1 | tee sanitizers_log.txt || true | |
misc/scripts/check_ci_log.py sanitizers_log.txt | |
- name: Prepare artifact | |
if: ${{ matrix.artifact }} | |
run: | | |
chmod +x godot/bin/godot.* || true | |
chmod +x godot/bin/libgodot.* || true | |
- name: Upload artifact | |
uses: ./.github/actions/upload-artifact | |
if: ${{ matrix.artifact }} | |
with: | |
name: ${{ matrix.cache-name }} | |
release: | |
needs: build-linux | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v3 | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Assets | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
const fs = require('fs'); | |
const path = require('path'); | |
const artifacts = ['vsekai_game_windows_x86_64.zip', 'vsekai_game_linux_x86_64.zip']; | |
for (const artifact of artifacts) { | |
const filePath = path.join(process.env.GITHUB_WORKSPACE, artifact); | |
if (fs.existsSync(filePath)) { | |
await github.repos.uploadReleaseAsset({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
release_id: context.payload.release.id, | |
name: path.basename(artifact), | |
data: fs.readFileSync(filePath), | |
headers: { | |
'content-length': fs.statSync(filePath).size, | |
'content-type': 'application/zip', | |
}, | |
}); | |
} | |
} |