Improve performance. #34
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: V-Sekai Builds | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "*" | |
pull_request: | |
env: | |
GAME_NAME: vsekai_goal_plan_ | |
GODOT_REF: groups-4.2.2023-11-29T013556Z | |
GODOT_REPOSITORY: v-sekai/godot | |
SCONSFLAGS: verbose=yes warnings=extra werror=no module_text_server_fb_enabled=yes use_thinlto=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: | |
runs-on: ${{ matrix.runs-on }} | |
name: ${{ matrix.name }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: linux_editor_win_deploy | |
runs-on: ubuntu-22.04 | |
cache-name: linux-editor-deploy-windows-editor | |
target: editor | |
tests: false | |
sconsflags: linker=gold precision=double use_mingw=yes | |
doc-test: false | |
bin: ./godot/bin/godot.linuxbsd.editor.double.x86_64 | |
deploy-bin: ./godot/bin/godot.windows.editor.double.x86_64.exe | |
editor-bin-name: godot.windows.editor.double.x86_64.exe | |
proj-conv: false | |
artifact: true | |
platform: linuxbsd | |
deploy: true | |
deploy-pdb: true | |
deploy-platform: windows | |
export-platform: Windows | |
arch: _x86_64 | |
deploy-platform-target: editor | |
- name: linux_editor_linux_deploy | |
runs-on: ubuntu-22.04 | |
cache-name: linux-editor-deploy-linux-editor | |
target: editor | |
tests: false | |
sconsflags: linker=gold precision=double use_llvm=yes | |
doc-test: false | |
bin: ./godot/bin/godot.linuxbsd.editor.double.x86_64.llvm | |
deploy-bin: ./godot/bin/godot.linuxbsd.editor.double.x86_64.llvm | |
editor-bin-name: godot.linuxbsd.editor.double.x86_64.llvm | |
proj-conv: false | |
artifact: true | |
platform: linuxbsd | |
deploy: true | |
deploy-platform: linux | |
export-platform: Linux | |
arch: _x86_64 | |
deploy-platform-target: editor | |
- name: macos_editor_macos_deploy | |
runs-on: "macos-latest" | |
cache-name: macos-editor-deploy-macos-editor | |
target: editor | |
tests: false | |
sconsflags: linker=gold precision=double | |
doc-test: false | |
bin: ./godot/bin/godot.macos.editor.double.x86_64 | |
deploy-bin: ./godot/bin/godot.macos.editor.double.x86_64 | |
editor-bin-name: godot.macos.editor.double.x86_64 | |
proj-conv: false | |
artifact: true | |
platform: macos | |
deploy: true | |
deploy-platform: macos | |
export-platform: Mac | |
arch: _x86_64 | |
deploy-platform-target: editor | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v3.5.2 | |
- name: Linux dependencies for gold linker | |
if: ${{ matrix.platform == 'linux' }} | |
run: | | |
sudo apt-get install -qq binutils | |
shell: bash | |
- name: Install MinGW | |
if: ${{ matrix.deploy-platform == 'windows' }} | |
run: | | |
sudo add-apt-repository ppa:savoury1/build-tools | |
sudo apt-get update | |
sudo apt-get install mingw-w64 | |
sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix | |
sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix | |
shell: bash | |
- name: Setup Godot build cache | |
uses: ./.github/actions/godot-cache | |
with: | |
cache-name: ${{ matrix.cache-name }} | |
continue-on-error: true | |
- name: Setup Vulkan SDK | |
if: ${{ matrix.platform == 'macos' }} | |
run: | | |
sh ./.github/install_vulkan_sdk_macos.sh | |
- name: Set up Emscripten latest | |
if: ${{ matrix.platform == 'web' || matrix.deploy-platform == 'web'}} | |
uses: mymindstorm/setup-emsdk@d233ac12b0102f74ca199f5dad7a4e2c13a8a745 # v13 | |
with: | |
version: ${{env.EM_VERSION}} | |
actions-cache-folder: ${{env.EM_CACHE_FOLDER}} | |
- name: Verify Emscripten setup | |
if: ${{ matrix.platform == 'web' || matrix.deploy-platform == 'web'}} | |
run: | | |
emcc -v | |
shell: bash | |
- name: Setup python, scons and golang | |
uses: ./.github/actions/godot-deps | |
with: | |
godot-ref: ${{ env.GODOT_REF }} | |
godot-repository: ${{ env.GODOT_REPOSITORY }} | |
- name: Set up .NET Sdk | |
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4.0.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: Compilation | |
if: ${{ matrix.deploy-platform == 'windows' || matrix.deploy-platform == 'web' }} | |
uses: ./.github/actions/godot-build | |
with: | |
sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }} | |
platform: ${{ matrix.platform }} | |
target: ${{ matrix.target }} | |
tests: false | |
deploy: false | |
deploy-platform: ${{ matrix.platform }} | |
deploy-platform-target: ${{ matrix.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_${{ matrix.deploy-platform }} | |
chmod +x ${{ matrix.bin }} | |
${{ matrix.bin }} --headless --xr-mode off --export-pack ${{ matrix.export-platform }} `pwd`/${{ env.GAME_NAME }}${{ matrix.deploy-platform }}.pck --path . || true | |
timeout-minutes: 10 | |
shell: bash | |
- name: Prepare artifacts | |
if: ${{ matrix.deploy }} | |
run: | | |
ls | |
# Check if the .pck file exists | |
if [ ! -f ./${{ env.GAME_NAME }}${{ matrix.deploy-platform }}.pck ]; then | |
echo "Error: ${{ env.GAME_NAME }}${{ matrix.deploy-platform }}.pck does not exist." | |
exit 1 | |
fi | |
# Check if the path to the .pck file is correct | |
if [ ! -f `pwd`/${{ env.GAME_NAME }}${{ matrix.deploy-platform }}.pck ]; then | |
echo "Error: The path to ${{ env.GAME_NAME }}${{ matrix.deploy-platform }}.pck is incorrect." | |
exit 1 | |
fi | |
rm -rf ${{ env.GAME_NAME }}${{ matrix.deploy-platform }} | |
export TARGET=${{ env.GAME_NAME }}${{ matrix.deploy-platform }} | |
mkdir -p $TARGET | |
# If deploy platform is windows, append .exe to the binary | |
if [ "${{ matrix.deploy-platform }}" == "windows" ]; then | |
cp -rf ${{ matrix.deploy-bin }} $TARGET/${{ env.GAME_NAME }}${{ matrix.deploy-platform }}.exe | |
else | |
cp -rf ${{ matrix.deploy-bin }} $TARGET/${{ env.GAME_NAME }}${{ matrix.deploy-platform }} | |
fi | |
cp -rf `pwd`/${{ env.GAME_NAME }}${{ matrix.deploy-platform }}.pck $TARGET/${{ env.GAME_NAME }}${{ matrix.deploy-platform }}.pck | |
7z a -r $TARGET.zip $TARGET | |
shell: bash | |
- name: Upload Godot Artifact Export | |
if: ${{ matrix.deploy }} | |
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0 | |
with: | |
name: ${{ env.GAME_NAME }}${{ matrix.deploy-platform }} | |
path: | | |
${{ env.GAME_NAME }}${{ matrix.deploy-platform }} | |
- name: Generate C# glue | |
if: ${{ matrix.build-mono }} | |
run: | | |
${{ matrix.bin }} --headless --generate-mono-glue ./modules/mono/glue || true | |
shell: bash | |
- name: Build .NET solutions | |
if: ${{ matrix.build-mono }} | |
run: | | |
./modules/mono/build_scripts/build_assemblies.py --godot-output-dir=./bin --godot-platform=linuxbsd | |
shell: bash | |
- name: Unit tests | |
if: ${{ matrix.tests }} | |
run: | | |
${{ matrix.bin }} --version | |
${{ matrix.bin }} --help | |
${{ matrix.bin }} --test --headless | |
shell: bash | |
- 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$' | |
shell: bash | |
- 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 | |
shell: bash | |
- name: Prepare artifact | |
if: ${{ matrix.artifact }} | |
run: | | |
chmod +x godot/bin/godot.* || true | |
shell: bash | |
- name: Upload artifact | |
uses: ./.github/actions/upload-artifact | |
if: ${{ matrix.artifact }} | |
with: | |
name: ${{ matrix.cache-name }} | |
release: | |
needs: [build] | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1 | |
with: | |
egress-policy: audit | |
- name: Download Artifacts | |
uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0 | |
- name: List files | |
run: | | |
ls -R ${{ env.GAME_NAME }}windows${{ matrix.arch }} | |
ls -R ${{ env.GAME_NAME }}linux${{ matrix.arch }} | |
ls -R linux-editor-deploy-windows-editor | |
ls -R linux-editor-deploy-linux-editor | |
ls -R macos-editor-deploy-macos-editor | |
shell: bash | |
- name: Archive files | |
run: | | |
zip -r ${{ env.GAME_NAME }}windows${{ matrix.arch }}.zip ${{ env.GAME_NAME }}windows${{ matrix.arch }} | |
zip -r ${{ env.GAME_NAME }}linux${{ matrix.arch }}.zip ${{ env.GAME_NAME }}linux${{ matrix.arch }} | |
zip -r linux-editor-deploy-windows-editor.zip linux-editor-deploy-windows-editor | |
zip -r linux-editor-deploy-linux-editor.zip linux-editor-deploy-linux-editor | |
zip -r macos-editor-deploy-macos-editor.zip macos-editor-deploy-macos-editor | |
- name: Create and Upload Release | |
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1 | |
with: | |
files: | | |
${{ env.GAME_NAME }}windows${{ matrix.arch }}.zip | |
${{ env.GAME_NAME }}linux${{ matrix.arch }}.zip | |
linux-editor-deploy-windows-editor.zip | |
linux-editor-deploy-linux-editor.zip | |
macos-editor-deploy-macos-editor.zip | |
generate_release_notes: true | |
draft: false | |
prerelease: true | |
append_body: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.VSEKAI_GITHUB_TOKEN }} |