name: Reusable build workflow on: workflow_call: inputs: ref: type: string required: true flags: type: string default: "" required: false modules-path: type: string required: true name: type: string required: true build-name: type: string required: true concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.ref }} cancel-in-progress: true env: BUILD_NAME: ${{ inputs.build-name }} ref: ${{ inputs.ref }} flags: ${{ inputs.flags }} modules: ${{ inputs.modules-path }} jobs: linux: name: Linux temps runs-on: ubuntu-20.04 strategy: matrix: target: [template_release, template_debug] bits: [64] steps: - name: Compilation uses: bend-n/godot-builds/.github/actions/build-godot@main with: target: ${{ matrix.target }} flags: bits=${{ matrix.bits }} ${{ env.flags }} platform: linuxbsd - name: Upload artifact uses: bend-n/godot-builds/.github/actions/upload-artifact@main with: path: godot/bin/*.x86_64 windows: strategy: matrix: target: [template_release, template_debug] bits: [64] name: Win temps runs-on: windows-latest steps: - name: Compilation uses: bend-n/godot-builds/.github/actions/build-godot@main with: target: ${{ matrix.target }} flags: bits=${{ matrix.bits }} ${{ env.flags }} platform: windows - name: Upload artifact uses: bend-n/godot-builds/.github/actions/upload-artifact@main with: path: godot/bin/*.exe android: name: Android temps runs-on: ubuntu-20.04 strategy: matrix: target: [template_release, template_debug] steps: - name: Set up Java 11 uses: actions/setup-java@v3 with: java-version: 11 distribution: temurin - name: Compilation (armv7) uses: bend-n/godot-builds/.github/actions/build-godot@main with: target: ${{ matrix.target }} flags: android_arch=armv7 ${{ env.flags }} platform: android - name: Compilation (arm64v8) uses: bend-n/godot-builds/.github/actions/build-godot@main with: target: ${{ matrix.target }} flags: android_arch=arm64v8 ${{ env.flags }} platform: android - name: Generate Godot templates run: | cd godot (cd platform/android/java && ./gradlew generateGodotTemplates) - name: Upload artifact uses: bend-n/godot-builds/.github/actions/upload-artifact@main with: path: godot/bin/*.apk macos: strategy: matrix: target: [template_release, template_debug] name: macOS temps runs-on: macos-latest steps: - name: Install MoltenVK run: | # curl https://raw.githubusercontent.com/godotengine/godot/master/misc/scripts/install_vulkan_sdk_macos.sh curl -L "https://sdk.lunarg.com/sdk/download/latest/mac/vulkan-sdk.dmg" -o /tmp/vulkan-sdk.dmg hdiutil attach /tmp/vulkan-sdk.dmg -mountpoint /Volumes/vulkan-sdk /Volumes/vulkan-sdk/InstallVulkan.app/Contents/MacOS/InstallVulkan \ --accept-licenses --default-answer --confirm-command install cnt=5 until hdiutil detach -force /Volumes/vulkan-sdk do [[ cnt -eq "0" ]] && break sleep 1 ((cnt--)) done rm -f /tmp/vulkan-sdk.dmg echo 'Vulkan SDK installed successfully! You can now build Godot by running "scons".' - name: Compilation(x86_64) uses: bend-n/godot-builds/.github/actions/build-godot@main with: flags: arch=x86_64 ${{ env.flags }} target: ${{ matrix.target }} platform: macos - name: Compilation(arm64) uses: bend-n/godot-builds/.github/actions/build-godot@main with: flags: arch=arm64 ${{ env.flags }} target: ${{ matrix.target }} platform: macos - name: Create universal run: | [[ "${{ matrix.target }}" == *"debug"* ]] && target='.debug' cd godot intel=bin/godot.macos.*.x86_64 arm=bin/godot.macos.*.arm64 lipo -create $intel $arm -output "bin/godot.macos.opt$target.universal" strip "bin/godot.macos.opt$target.universal" - name: Upload artifact uses: bend-n/godot-builds/.github/actions/upload-artifact@main with: path: godot/bin/*.universal web: strategy: matrix: target: [template_release, template_debug] flags: [dlink_enabled=yes, ""] name: JS temps runs-on: ubuntu-20.04 steps: - name: Set up Emscripten 3.1.18 uses: mymindstorm/setup-emsdk@v11 with: version: 3.1.18 - name: Verify Emscripten setup run: emcc -v - name: Compilation uses: bend-n/godot-builds/.github/actions/build-godot@main with: target: ${{ matrix.target }} flags: ${{ env.flags }} ${{ matrix.flags }} platform: web - name: Upload artifact uses: bend-n/godot-builds/.github/actions/upload-artifact@main with: path: godot/bin/*.zip templates: needs: [web, macos, windows, linux, android] name: Bundle all templates runs-on: ubuntu-latest env: tmps: "templates" steps: - name: Download all artifacts uses: actions/download-artifact@v3 - name: List all downloaded files run: ls -R - name: Getdot uses: actions/checkout@v3 with: repository: godotengine/godot ref: ${{ inputs.ref }} path: godot-repo - name: Prepare files run: | rel="template_release" bug="template_debug" mkdir -vp "$tmps" echo "Preparing linux" linux="godot.linuxbsd" mv "linux/$linux.$bug.x86_64" "$tmps/linux_debug.x86_64" mv "linux/$linux.$rel.x86_64" "$tmps/linux_release.x86_64" echo "Preparing windows" windows="godot.windows" mv "windows/$windows.$bug.x86_64.console.exe" "$tmps/windows_debug_x86_64_console.exe" mv "windows/$windows.$bug.x86_64.exe" "$tmps/windows_debug_x86_64.exe" mv "windows/$windows.$rel.x86_64.console.exe" "$tmps/windows_release_x86_64_console.exe" mv "windows/$windows.$rel.x86_64.exe" "$tmps/windows_release_x86_64.exe" echo "Preparing android" mv "android/android_debug.apk" "$tmps/android_debug.apk" mv "android/android_release.apk" "$tmps/android_release.apk" echo "Preparing macos" mac="godot.macos.opt" cp -r "godot-repo/misc/dist/macos_template.app" "." mkdir -p "macos_template.app/Contents/MacOS" cp "macos/$mac.universal" "macos_template.app/Contents/MacOS/godot_macos_release.universal" cp "macos/$mac.debug.universal" "macos_template.app/Contents/MacOS/godot_macos_debug.universal" chmod +x macos_template.app/Contents/MacOS/godot_macos_*.universal zip -q -9 -r "$tmps/macos.zip" "macos_template.app" echo "Preparing web" web="godot.web" mv "web/$web.$rel.wasm32.zip" "$tmps/web_release.zip" mv "web/$web.$bug.wasm32.zip" "$tmps/web_debug.zip" mv "web/$web.$rel.wasm32.dlink.zip" "$tmps/web_dlink_release.zip" mv "web/$web.$bug.wasm32.dlink.zip" "$tmps/web_dlink_debug.zip" - name: Prepare bundle run: cd "${tmps}" && zip -qr9 templates.tpz ./* - name: Upload artifact uses: bend-n/godot-builds/.github/actions/upload-artifact@main with: path: ${{ env.tmps }}/templates.tpz editor: name: Linux editor runs-on: ubuntu-20.04 steps: - name: Compilation uses: bend-n/godot-builds/.github/actions/build-godot@main with: platform: linuxbsd target: editor - name: Upload artifact uses: bend-n/godot-builds/.github/actions/upload-artifact@main with: name: linuxbsd-editor-release path: godot/bin/*.x86_64 image: permissions: write-all name: Docker image runs-on: ubuntu-latest needs: [editor, templates] steps: - uses: bend-n/godot-builds/.github/actions/build-upload-image@main with: github-token: ${{ secrets.GITHUB_TOKEN }} name: ${{ inputs.name }} release: name: Create/update a release runs-on: ubuntu-latest needs: [editor, templates] steps: - uses: bend-n/godot-builds/.github/actions/release@main with: github-token: ${{ secrets.GITHUB_TOKEN }} name: ${{ inputs.name }}