|
| 1 | +# ---------------------------------------------------------------------------- |
| 2 | +# GitHub Actions workflow to build this application. |
| 3 | +# Using latest Castle Game Engine ( https://castle-engine.io/ ) snapshot. |
| 4 | +# For multiple platforms (Linux, Windows, macOS, Android). |
| 5 | +# |
| 6 | +# This uses GitHub-hosted runners, that is: you don't need to set up any server |
| 7 | +# infrastructure, GitHub provides it all for free for open-source projects. |
| 8 | +# |
| 9 | +# See docs: |
| 10 | +# - https://castle-engine.io/github_actions |
| 11 | +# - https://docs.github.com/en/actions |
| 12 | +# ---------------------------------------------------------------------------- |
| 13 | + |
| 14 | +name: Build |
| 15 | +on: [push, pull_request] |
| 16 | + |
| 17 | +jobs: |
| 18 | + # Build for platforms supported by |
| 19 | + # CGE Docker image https://hub.docker.com/r/kambi/castle-engine-cloud-builds-tools/ . |
| 20 | + # |
| 21 | + # Since setting up Docker image takes majority of time (5-6 mins) |
| 22 | + # compared to actually getting and compiling CGE (1 min) |
| 23 | + # and building application (~1 min for each platform), |
| 24 | + # we build all platforms possible within one job. |
| 25 | + build-using-docker: |
| 26 | + name: Build Using Docker |
| 27 | + runs-on: ubuntu-latest |
| 28 | + container: kambi/castle-engine-cloud-builds-tools:cge-none |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v4 |
| 31 | + # Set env CASTLE_ENGINE_PATH following |
| 32 | + # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files |
| 33 | + # https://brandur.org/fragments/github-actions-env-vars-in-env-vars |
| 34 | + - name: Castle Game Engine - Setup environment |
| 35 | + run: echo "CASTLE_ENGINE_PATH=$GITHUB_WORKSPACE/castle-engine" >> $GITHUB_ENV |
| 36 | + - name: Castle Game Engine - Clone snapshot |
| 37 | + run: git clone --depth 1 --single-branch --branch snapshot https://github.com/castle-engine/castle-engine/ |
| 38 | + - name: Castle Game Engine - Build |
| 39 | + run: cd $CASTLE_ENGINE_PATH/tools/build-tool/ && ./castle-engine_compile.sh |
| 40 | + |
| 41 | + - name: Package Windows |
| 42 | + run: $CASTLE_ENGINE_PATH/tools/build-tool/castle-engine package --os=win64 --cpu=x86_64 --verbose |
| 43 | + - name: Archive Artifacts |
| 44 | + # See https://github.com/actions/upload-artifact |
| 45 | + uses: actions/upload-artifact@v4 |
| 46 | + with: |
| 47 | + name: windows-build |
| 48 | + # Note: Keep paths that start with asterisk in double qoutes, to avoid misinterpreting as YAML reference. |
| 49 | + # See https://stackoverflow.com/questions/19109912/yaml-do-i-need-quotes-for-strings-in-yaml |
| 50 | + # https://yamlchecker.com/ |
| 51 | + path: "*-win64-x86_64.zip" |
| 52 | + if-no-files-found: error |
| 53 | + |
| 54 | + - name: Package Linux |
| 55 | + run: $CASTLE_ENGINE_PATH/tools/build-tool/castle-engine package --os=linux --cpu=x86_64 --verbose |
| 56 | + - name: Archive Artifacts |
| 57 | + uses: actions/upload-artifact@v4 |
| 58 | + with: |
| 59 | + name: linux-build |
| 60 | + path: "*-linux-x86_64.tar.gz" |
| 61 | + if-no-files-found: error |
| 62 | + |
| 63 | + - name: Package Android |
| 64 | + run: $CASTLE_ENGINE_PATH/tools/build-tool/castle-engine package --target=android --verbose |
| 65 | + - name: Archive Artifacts |
| 66 | + uses: actions/upload-artifact@v4 |
| 67 | + with: |
| 68 | + name: android-build |
| 69 | + path: "*.apk" |
| 70 | + if-no-files-found: error |
| 71 | + |
| 72 | + # Build for platforms supported from macOS. |
| 73 | + # This means to build for macOS and (maybe in the future) iOS. |
| 74 | + build-macos: |
| 75 | + name: Build Using macOS |
| 76 | + runs-on: macos-latest |
| 77 | + steps: |
| 78 | + - uses: actions/checkout@v4 |
| 79 | + - name: Install FPC+Lazarus |
| 80 | + |
| 81 | + with: |
| 82 | + lazarus-version: stable |
| 83 | + - name: Castle Game Engine - Setup environment |
| 84 | + run: echo "CASTLE_ENGINE_PATH=$GITHUB_WORKSPACE/castle-engine" >> $GITHUB_ENV |
| 85 | + - name: Castle Game Engine - Clone snapshot |
| 86 | + run: git clone --depth 1 --single-branch --branch snapshot https://github.com/castle-engine/castle-engine/ |
| 87 | + - name: Castle Game Engine - Build |
| 88 | + run: cd $CASTLE_ENGINE_PATH/tools/build-tool/ && ./castle-engine_compile.sh |
| 89 | + |
| 90 | + - name: Package macOS |
| 91 | + run: $CASTLE_ENGINE_PATH/tools/build-tool/castle-engine package --os=darwin --cpu=x86_64 --verbose |
| 92 | + - name: Archive Artifacts |
| 93 | + uses: actions/upload-artifact@v4 |
| 94 | + with: |
| 95 | + name: macos-build |
| 96 | + path: "*-darwin-x86_64.zip" |
| 97 | + if-no-files-found: error |
0 commit comments