Merge pull request #3 from castle-engine/dependabot/github_actions/gc… #14
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
# ---------------------------------------------------------------------------- | |
# GitHub Actions workflow to build this application. | |
# Using latest Castle Game Engine ( https://castle-engine.io/ ) snapshot. | |
# For multiple platforms (Linux, Windows, macOS, Android). | |
# | |
# This uses GitHub-hosted runners, that is: you don't need to set up any server | |
# infrastructure, GitHub provides it all for free for open-source projects. | |
# | |
# See docs: | |
# - https://castle-engine.io/github_actions | |
# - https://docs.github.com/en/actions | |
# ---------------------------------------------------------------------------- | |
name: Build | |
on: [push, pull_request] | |
jobs: | |
# Build for platforms supported by | |
# CGE Docker image https://hub.docker.com/r/kambi/castle-engine-cloud-builds-tools/ . | |
# | |
# Since setting up Docker image takes majority of time (5-6 mins) | |
# compared to actually getting and compiling CGE (1 min) | |
# and building application (~1 min for each platform), | |
# we build all platforms possible within one job. | |
build-using-docker: | |
name: Build Using Docker | |
runs-on: ubuntu-latest | |
container: kambi/castle-engine-cloud-builds-tools:cge-none | |
steps: | |
- uses: actions/checkout@v4 | |
# Set env CASTLE_ENGINE_PATH following | |
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files | |
# https://brandur.org/fragments/github-actions-env-vars-in-env-vars | |
- name: Castle Game Engine - Setup environment | |
run: echo "CASTLE_ENGINE_PATH=$GITHUB_WORKSPACE/castle-engine" >> $GITHUB_ENV | |
- name: Castle Game Engine - Clone snapshot | |
run: git clone --depth 1 --single-branch --branch snapshot https://github.com/castle-engine/castle-engine/ | |
- name: Castle Game Engine - Build | |
run: cd $CASTLE_ENGINE_PATH/tools/build-tool/ && ./castle-engine_compile.sh | |
- name: Package Windows - radiance_transfer | |
run: cd radiance_transfer && $CASTLE_ENGINE_PATH/tools/build-tool/castle-engine package --os=win64 --cpu=x86_64 --verbose | |
- name: Package Windows - precompute | |
run: cd precompute && $CASTLE_ENGINE_PATH/tools/build-tool/castle-engine package --os=win64 --cpu=x86_64 --verbose | |
- name: Package Windows - visualize_spherical_harmonics | |
run: cd visualize_spherical_harmonics && $CASTLE_ENGINE_PATH/tools/build-tool/castle-engine package --os=win64 --cpu=x86_64 --verbose | |
- name: Archive Artifacts | |
# See https://github.com/actions/upload-artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: windows-build | |
path: | | |
radiance_transfer/*-win64-x86_64.zip | |
precompute/*-win64-x86_64.zip | |
visualize_spherical_harmonics/*-win64-x86_64.zip | |
if-no-files-found: error | |
- name: Package Linux - radiance_transfer | |
run: cd radiance_transfer && $CASTLE_ENGINE_PATH/tools/build-tool/castle-engine package --os=linux --cpu=x86_64 --verbose | |
- name: Package Linux - precompute | |
run: cd precompute && $CASTLE_ENGINE_PATH/tools/build-tool/castle-engine package --os=linux --cpu=x86_64 --verbose | |
- name: Package Linux - visualize_spherical_harmonics | |
run: cd visualize_spherical_harmonics && $CASTLE_ENGINE_PATH/tools/build-tool/castle-engine package --os=linux --cpu=x86_64 --verbose | |
- name: Archive Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: linux-build | |
path: | | |
radiance_transfer/*-linux-x86_64.tar.gz | |
precompute/*-linux-x86_64.tar.gz | |
visualize_spherical_harmonics/*-linux-x86_64.tar.gz | |
if-no-files-found: error | |
- name: Package Android - radiance_transfer | |
run: cd radiance_transfer && $CASTLE_ENGINE_PATH/tools/build-tool/castle-engine package --target=android --verbose | |
# precompute is cli, not on Android | |
# - name: Package Android - precompute | |
# run: cd precompute && $CASTLE_ENGINE_PATH/tools/build-tool/castle-engine package --target=android --verbose | |
- name: Package Android - visualize_spherical_harmonics | |
run: cd visualize_spherical_harmonics && $CASTLE_ENGINE_PATH/tools/build-tool/castle-engine package --target=android --verbose | |
- name: Archive Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: android-build | |
path: | | |
radiance_transfer/*.apk | |
visualize_spherical_harmonics/*.apk | |
if-no-files-found: error | |
# Build for platforms supported from macOS. | |
# This means to build for macOS and (maybe in the future) iOS. | |
build-macos: | |
name: Build Using macOS | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install FPC+Lazarus | |
uses: gcarreno/[email protected] | |
with: | |
lazarus-version: stable | |
- name: Castle Game Engine - Setup environment | |
run: echo "CASTLE_ENGINE_PATH=$GITHUB_WORKSPACE/castle-engine" >> $GITHUB_ENV | |
- name: Castle Game Engine - Clone snapshot | |
run: git clone --depth 1 --single-branch --branch snapshot https://github.com/castle-engine/castle-engine/ | |
- name: Castle Game Engine - Build | |
run: cd $CASTLE_ENGINE_PATH/tools/build-tool/ && ./castle-engine_compile.sh | |
- name: Package macOS - radiance_transfer | |
run: cd radiance_transfer && $CASTLE_ENGINE_PATH/tools/build-tool/castle-engine package --os=darwin --cpu=x86_64 --verbose | |
- name: Package macOS - precompute | |
run: cd precompute && $CASTLE_ENGINE_PATH/tools/build-tool/castle-engine package --os=darwin --cpu=x86_64 --verbose | |
- name: Package macOS - visualize_spherical_harmonics | |
run: cd visualize_spherical_harmonics && $CASTLE_ENGINE_PATH/tools/build-tool/castle-engine package --os=darwin --cpu=x86_64 --verbose | |
- name: Archive Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: macos-build | |
path: | | |
radiance_transfer/*-darwin-x86_64.zip | |
precompute/*-darwin-x86_64.zip | |
visualize_spherical_harmonics/*-darwin-x86_64.zip | |
if-no-files-found: error |