ci: don't upload debug build to cf, too big, and a bunch of fixes #43
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: compile_godot | |
# inspired by: | |
# - https://github.com/godotengine/godot/tree/master/.github, | |
# - https://github.com/bruvzg/gdsdecomp/blob/master/.github. | |
# Also see https://docs.godotengine.org/en/latest/contributing/development/compiling/index.html. | |
# The action runtimes should be (+- ~20%): | |
# No cache: | |
# - web: 35 minutes | |
# - linuxbsd: 25 minutes | |
# - windows: 35 minutes | |
# - macos: 25 minutes | |
# That will cost (35+25) + 35*2 + 25*10 = 380 minutes per run | |
# See https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions | |
# With cache (best case, 100% cache hits): | |
# - web: 6 minutes | |
# - linuxbsd: 5 minutes | |
# - windows: 2 minutes | |
# - macos: 2 minutes | |
on: | |
push: | |
paths: | |
- deploy/godot/* | |
- .github/workflows/compile_godot.yaml | |
env: | |
EMSCRIPTEN_VERSION: 3.1.39 | |
GODOT_VERSION: 4.2.2 | |
VULKAN_SDK_VERSION: 1.3.290.0 | |
SCONS_CACHE: "${{ github.workspace }}/.scons-cache/" | |
SCONS_CACHE_LIMIT: 7168 # See https://github.com/godotengine/godot/blob/4.2/.github/actions/godot-build/action.yml | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
compile-web: | |
name: Compile web | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Clone Godot | |
uses: actions/checkout@v4 | |
with: | |
repository: godotengine/godot | |
ref: ${{env.GODOT_VERSION}}-stable | |
path: godot_sources | |
- name: Install Scons | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: scons | |
- name: Install Emscripten | |
uses: mymindstorm/setup-emsdk@v14 | |
with: | |
version: ${{ env.EMSCRIPTEN_VERSION }} | |
actions-cache-folder: 'emsdk-cache' | |
- name: Cache Godot compile | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.SCONS_CACHE }} | |
key: web-${{ env.GODOT_VERSION }} | |
- name: Compile template | |
run: | | |
cd godot_sources | |
rm -r editor # Make sure we don't accidentally build editor stuff | |
scons platform=web target=template_release profile=../deploy/godot/release_custom.py | |
scons platform=web target=template_debug profile=../deploy/godot/debug_custom.py | |
mv bin/godot.web.template_release.wasm32.dlink.zip bin/web_dlink_release.zip | |
mv bin/godot.web.template_debug.wasm32.dlink.zip bin/web_dlink_debug.zip | |
- name: Upload templates | |
uses: actions/upload-artifact@v4 | |
with: | |
name: templates-web-${{env.GODOT_VERSION}} | |
path: | | |
godot_sources/bin/web_dlink_release.zip | |
godot_sources/bin/web_dlink_debug.zip | |
compile-linux: | |
name: Compile linuxbsd | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Clone Godot | |
uses: actions/checkout@v4 | |
with: | |
repository: godotengine/godot | |
ref: ${{env.GODOT_VERSION}}-stable | |
path: godot_sources | |
- name: Install Linux dependencies | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: build-essential scons pkg-config libx11-dev libxcursor-dev libxinerama-dev libgl1-mesa-dev libglu1-mesa-dev libasound2-dev libpulse-dev libudev-dev libxi-dev libxrandr-dev | |
- name: Cache Godot compile | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.SCONS_CACHE }} | |
key: linux-${{ env.GODOT_VERSION }} | |
- name: Compile templates | |
run: | | |
cd godot_sources | |
rm -r editor # Make sure we don't accidentally build editor stuff | |
scons platform=linuxbsd target=template_release profile=../deploy/godot/release_custom.py arch=x86_64 | |
scons platform=linuxbsd target=template_debug profile=../deploy/godot/debug_custom.py arch=x86_64 | |
mv bin/godot.linuxbsd.template_release.x86_64 bin/linux_release.x86_64 | |
mv bin/godot.linuxbsd.template_debug.x86_64 bin/linux_debug.x86_64 | |
- name: Upload templates | |
uses: actions/upload-artifact@v4 | |
with: | |
name: templates-linuxbsd-${{env.GODOT_VERSION}} | |
path: | | |
godot_sources/bin/linux_release.x86_64 | |
godot_sources/bin/linux_debug.x86_64 | |
compile-windows: | |
name: Compile windows | |
runs-on: windows-2022 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Clone Godot | |
uses: actions/checkout@v4 | |
with: | |
repository: godotengine/godot | |
ref: ${{env.GODOT_VERSION}}-stable | |
path: godot_sources | |
- name: Install Scons | |
run: | | |
python -m pip install scons | |
- name: Cache Godot compile | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.SCONS_CACHE }} | |
key: windows-${{ env.GODOT_VERSION }} | |
- name: Compile templates | |
run: | | |
cd godot_sources | |
rm -r editor # Make sure we don't accidentally build editor stuff | |
scons platform=windows target=template_release profile=../deploy/godot/release_custom.py arch=x86_64 | |
scons platform=windows target=template_debug profile=../deploy/godot/debug_custom.py arch=x86_64 | |
mv bin/godot.windows.template_release.x86_64.exe bin/windows_release_x86_64.exe | |
mv bin/godot.windows.template_release.x86_64.console.exe bin/windows_release_x86_64_console.exe | |
mv bin/godot.windows.template_debug.x86_64.exe bin/windows_debug_x86_64.exe | |
mv bin/godot.windows.template_debug.x86_64.console.exe bin/windows_debug_x86_64_console.exe | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: templates-windows-${{env.GODOT_VERSION}} | |
path: | | |
godot_sources/bin/windows_release_x86_64.exe | |
godot_sources/bin/windows_release_x86_64_console.exe | |
godot_sources/bin/windows_debug_x86_64.exe | |
godot_sources/bin/windows_debug_x86_64_console.exe | |
compile-macos: | |
name: Compile macos | |
runs-on: macos-14 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Clone Godot | |
uses: actions/checkout@v4 | |
with: | |
repository: godotengine/godot | |
ref: ${{env.GODOT_VERSION}}-stable | |
path: godot_sources | |
- name: Install macos dependencies | |
run: | | |
brew install scons | |
# shamelessly copied from https://github.com/bruvzg/gdsdecomp/blob/master/.github/actions/install-swiftshader/action.yml | |
wget --no-verbose "https://sdk.lunarg.com/sdk/download/${VULKAN_SDK_VERSION}/mac/vulkansdk-macos-${VULKAN_SDK_VERSION}.dmg?Human=true" -O vulkansdk.dmg | |
hdiutil attach vulkansdk.dmg | |
sudo /Volumes/vulkansdk-macos-${VULKAN_SDK_VERSION}/InstallVulkan.app/Contents/MacOS/InstallVulkan --root $GITHUB_WORKSPACE/vulkansdk-macos-${VULKAN_SDK_VERSION} --accept-licenses --default-answer --confirm-command install | |
hdiutil detach /Volumes/vulkansdk-macos-${VULKAN_SDK_VERSION} | |
echo "VULKAN_SDK_PATH=$GITHUB_WORKSPACE/vulkansdk-macos-${VULKAN_SDK_VERSION}" >> $GITHUB_ENV | |
echo "VULKAN_SDK=$VULKAN_SDK_PATH/macOS" >> $GITHUB_ENV | |
echo "DYLD_LIBRARY_PATH=$VULKAN_SDK/lib:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV | |
echo "PATH=$VULKAN_SDK/bin:$PATH" >> $GITHUB_ENV | |
- name: Cache Godot compile | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.SCONS_CACHE }} | |
key: macos-${{ env.GODOT_VERSION }} | |
- name: Compile template | |
run: | | |
cd godot_sources | |
rm -r editor # Make sure we don't accidentally build editor stuff | |
scons platform=macos target=template_release profile=../deploy/godot/release_custom.py arch=x86_64 vulkan_sdk_path=$VULKAN_SDK_PATH | |
scons platform=macos target=template_debug profile=../deploy/godot/debug_custom.py arch=x86_64 vulkan_sdk_path=$VULKAN_SDK_PATH | |
scons platform=macos target=template_release profile=../deploy/godot/release_custom.py arch=arm64 vulkan_sdk_path=$VULKAN_SDK_PATH | |
scons platform=macos target=template_debug profile=../deploy/godot/debug_custom.py arch=arm64 vulkan_sdk_path=$VULKAN_SDK_PATH | |
lipo -create bin/godot.macos.template_release.x86_64 bin/godot.macos.template_release.arm64 -output bin/godot.macos.template_release.universal | |
lipo -create bin/godot.macos.template_debug.x86_64 bin/godot.macos.template_debug.arm64 -output bin/godot.macos.template_debug.universal | |
cp -r misc/dist/macos_template.app . | |
mkdir -p macos_template.app/Contents/MacOS | |
cp bin/godot.macos.template_release.universal macos_template.app/Contents/MacOS/godot_macos_release.universal | |
cp bin/godot.macos.template_debug.universal macos_template.app/Contents/MacOS/godot_macos_debug.universal | |
chmod +x macos_template.app/Contents/MacOS/godot_macos* | |
zip -q -9 -r macos.zip macos_template.app | |
- name: Upload template | |
uses: actions/upload-artifact@v4 | |
with: | |
name: templates-macos-${{env.GODOT_VERSION}} | |
path: godot_sources/macos.zip | |
build-export-archive: | |
name: Build export archive | |
runs-on: ubuntu-22.04 | |
needs: [compile-linux, compile-web, compile-macos, compile-windows] | |
steps: | |
- name: Download all builds | |
uses: actions/download-artifact@v4 | |
with: | |
path: templates | |
merge-multiple: true | |
- name: Upload export templates | |
uses: actions/upload-artifact@v4 | |
with: | |
name: templates-${{env.GODOT_VERSION}} | |
path: templates | |
publish-web: | |
name: Publish web engine to cloudflare | |
runs-on: ubuntu-22.04 | |
environment: main | |
needs: [compile-web] | |
steps: | |
- name: Download web templates | |
uses: actions/download-artifact@v4 | |
with: | |
name: templates-web-${{ env.GODOT_VERSION }} | |
- name: Prepare Upload | |
run: | | |
unzip web_dlink_release.zip -d release_files | |
mkdir release_engine | |
mv release_files/godot.side.wasm release_engine/index.side.wasm | |
release_hash=($(sha256sum release_engine/index.side.wasm)) | |
echo "RELEASE_HASH=${release_hash[1]}" >> $GITHUB_ENV | |
unzip web_dlink_debug.zip -d debug_files | |
mkdir debug_engine | |
mv debug_files/godot.side.wasm debug_engine/index.side.wasm | |
debug_hash=($(sha256sum debug_engine/index.side.wasm)) | |
echo "DEBUG_HASH=${debug_hash[1]}" >> $GITHUB_ENV | |
# Only Upload the engine if it doesn't exist already | |
curl --head --fail https://godot-engine.static.ilus.pw/release_${{ env.GODOT_VERSION }}_${{ env.RELEASE_HASH }}/index.side.wasm || EXIT_CODE=$? | |
if [ -n "$EXIT_CODE" ]; then | |
echo "UPLOAD_ENGINE=true" >> $GITHUB_ENV | |
else | |
echo "UPLOAD_ENGINE=false" >> $GITHUB_ENV | |
fi | |
- name: Upload release engine to R2 | |
if: env.UPLOAD_ENGINE == 'true' | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --delete | |
env: | |
AWS_S3_ENDPOINT: https://${{ secrets.R2_ACCOUNT_ID }}.r2.cloudflarestorage.com | |
AWS_S3_BUCKET: ${{ secrets.R2_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} | |
AWS_REGION: auto | |
SOURCE_DIR: release_engine | |
DEST_DIR: release_${{ env.GODOT_VERSION }}_${{ env.RELEASE_HASH }} | |
# - name: Upload debug engine to R2 | |
# if: ${{ env.UPLOAD_ENGINE == 'true' }} | |
# uses: jakejarvis/s3-sync-action@master | |
# with: | |
# args: --delete | |
# env: | |
# AWS_S3_ENDPOINT: https://${{ secrets.R2_ACCOUNT_ID }}.r2.cloudflarestorage.com | |
# AWS_S3_BUCKET: ${{ secrets.R2_BUCKET }} | |
# AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }} | |
# AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} | |
# AWS_REGION: auto | |
# SOURCE_DIR: debug_engine | |
# DEST_DIR: debug_${{ env.GODOT_VERSION }}_${{ env.DEBUG_HASH }} |