|
| 1 | +name: 🔧 Build -> Package 📦 |
| 2 | +on: [push, pull_request] |
| 3 | + |
| 4 | +env: |
| 5 | + # Only used for the cache key. Increment version to force clean build. |
| 6 | + GODOT_BASE_BRANCH: master |
| 7 | + # LLVM version |
| 8 | + MINGW_LLVM_VERSION: "20260616" |
| 9 | + # Hardcoding this seem to be the only way |
| 10 | + ANDROID_NDK_ROOT: /usr/local/lib/android/sdk/ndk/28.1.13356709/ |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + runs-on: ${{ matrix.os }} |
| 15 | + name: 🔧 Build |
| 16 | + strategy: |
| 17 | + fail-fast: false |
| 18 | + matrix: |
| 19 | + include: |
| 20 | + # Android |
| 21 | + - platform: android |
| 22 | + arch: 'x86_64' |
| 23 | + gdnative_flags: 'android_arch=x86_64' |
| 24 | + sconsflags: '' |
| 25 | + os: 'ubuntu-22.04' |
| 26 | + cache-name: android-x86_64 |
| 27 | + - platform: android |
| 28 | + arch: 'arm64' |
| 29 | + gdnative_flags: 'android_arch=arm64v8' |
| 30 | + sconsflags: '' |
| 31 | + os: 'ubuntu-22.04' |
| 32 | + cache-name: android-arm64 |
| 33 | + |
| 34 | + # Linux |
| 35 | + - platform: linux |
| 36 | + arch: 'x86_32' |
| 37 | + buildroot: 'i686-godot-linux-gnu_sdk-buildroot' |
| 38 | + gdnative_flags: 'bits=32' |
| 39 | + sconsflags: '' |
| 40 | + os: 'ubuntu-22.04' |
| 41 | + cache-name: linux-x86_32 |
| 42 | + - platform: linux |
| 43 | + arch: 'x86_64' |
| 44 | + buildroot: 'x86_64-godot-linux-gnu_sdk-buildroot' |
| 45 | + gdnative_flags: 'bits=64' |
| 46 | + sconsflags: '' |
| 47 | + os: 'ubuntu-22.04' |
| 48 | + cache-name: linux-x86_64 |
| 49 | + - platform: linux |
| 50 | + arch: 'arm32' |
| 51 | + buildroot: 'arm-godot-linux-gnueabihf_sdk-buildroot' |
| 52 | + gdnative_flags: 'bits=32' |
| 53 | + sconsflags: '' |
| 54 | + os: 'ubuntu-22.04' |
| 55 | + cache-name: linux-arm32 |
| 56 | + - platform: linux |
| 57 | + arch: 'arm64' |
| 58 | + buildroot: 'aarch64-godot-linux-gnu_sdk-buildroot' |
| 59 | + gdnative_flags: 'bits=64' |
| 60 | + sconsflags: '' |
| 61 | + os: 'ubuntu-22.04' |
| 62 | + cache-name: linux-arm64 |
| 63 | + |
| 64 | + # macOS |
| 65 | + - platform: macos |
| 66 | + arch: 'universal' |
| 67 | + gdnative_flags: 'macos_arch=universal bits=64' |
| 68 | + sconsflags: '' |
| 69 | + os: 'macos-latest' |
| 70 | + cache-name: macos-universal |
| 71 | + |
| 72 | + # Windows |
| 73 | + - platform: windows |
| 74 | + arch: 'x86_32' |
| 75 | + gdnative_flags: 'bits=32' |
| 76 | + sconsflags: 'use_mingw=yes' |
| 77 | + os: 'ubuntu-22.04' |
| 78 | + cache-name: win-x86_32 |
| 79 | + - platform: windows |
| 80 | + arch: 'x86_64' |
| 81 | + gdnative_flags: 'bits=64' |
| 82 | + sconsflags: 'use_mingw=yes' |
| 83 | + os: 'ubuntu-22.04' |
| 84 | + cache-name: win-x86_64 |
| 85 | + - platform: windows |
| 86 | + arch: 'arm64' |
| 87 | + sconsflags: 'use_mingw=yes use_llvm=yes' |
| 88 | + os: 'ubuntu-22.04' |
| 89 | + cache-name: win-arm64 |
| 90 | + skip_gdnative: true |
| 91 | + |
| 92 | + env: |
| 93 | + SCONS_CACHE: ${{ github.workspace }}/.scons-cache/ |
| 94 | + SCONSFLAGS: ${{ matrix.sconsflags }} platform=${{ matrix.platform }} arch=${{ matrix.arch }} build_profile=build_profile.json target=editor api_version=4.3 target_path=out/addons/godot-git-plugin/ --jobs=2 |
| 95 | + |
| 96 | + defaults: |
| 97 | + run: |
| 98 | + shell: bash |
| 99 | + |
| 100 | + steps: |
| 101 | + - uses: actions/checkout@v6 |
| 102 | + with: |
| 103 | + submodules: recursive |
| 104 | + |
| 105 | + - name: Restore Godot build cache |
| 106 | + uses: ./godot-cpp/.github/actions/godot-cache-restore |
| 107 | + with: |
| 108 | + cache-name: ${{ matrix.cache-name }} |
| 109 | + scons-cache: ${{ env.SCONS_CACHE }} |
| 110 | + continue-on-error: true |
| 111 | + |
| 112 | + - name: Setup Windows MinGW toolchain cache |
| 113 | + if: ${{ matrix.platform == 'windows' && matrix.arch == 'arm64' }} |
| 114 | + uses: actions/cache@v5 |
| 115 | + with: |
| 116 | + path: | |
| 117 | + llvm-mingw-$MINGW_LLVM_VERSION-ucrt-ubuntu-22.04-x86_64.tar.bz2 |
| 118 | + key: llvm-mingw-$MINGW_LLVM_VERSION-ucrt-ubuntu-22.04-x86_64 |
| 119 | + |
| 120 | + - name: Install mingw-LLVM |
| 121 | + if: ${{ matrix.platform == 'windows' && matrix.arch == 'arm64' }} |
| 122 | + run: | |
| 123 | + NAME=llvm-mingw-$MINGW_LLVM_VERSION-ucrt-ubuntu-22.04-x86_64 |
| 124 | + URL="https://github.com/mstorsjo/llvm-mingw/releases/download/$MINGW_LLVM_VERSION/$NAME.tar.xz" |
| 125 | + if [ ! -f $NAME.bz2 ]; then |
| 126 | + wget $URL |
| 127 | + fi |
| 128 | + tar -xJf $NAME.tar.xz |
| 129 | + echo "$GITHUB_WORKSPACE/$NAME/bin" >> $GITHUB_PATH |
| 130 | +
|
| 131 | + - name: Install mingw-GCC |
| 132 | + if: ${{ matrix.platform == 'windows' && matrix.arch != 'arm64' }} |
| 133 | + run: | |
| 134 | + sudo apt-get update |
| 135 | + sudo apt-get install build-essential mingw-w64 |
| 136 | + sudo update-alternatives --set i686-w64-mingw32-gcc /usr/bin/i686-w64-mingw32-gcc-posix |
| 137 | + sudo update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix |
| 138 | + sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix |
| 139 | + sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix |
| 140 | + dpkg -l | grep ii | grep mingw |
| 141 | + update-alternatives --get-selections | grep mingw |
| 142 | +
|
| 143 | + - name: Install Linux build dependencies |
| 144 | + if: ${{ matrix.platform == 'linux' }} |
| 145 | + run: | |
| 146 | + sudo apt-get update |
| 147 | + sudo apt-get install build-essential gcc-multilib g++-multilib wget |
| 148 | +
|
| 149 | + - name: Setup Linux buildroot toolchain cache |
| 150 | + if: ${{ matrix.platform == 'linux' }} |
| 151 | + uses: actions/cache@v5 |
| 152 | + with: |
| 153 | + path: | |
| 154 | + ${{ matrix.buildroot }}.tar.bz2 |
| 155 | + key: linux-${{ matrix.buildroot }}-buildroot |
| 156 | + |
| 157 | + - name: Set up Python 3.x |
| 158 | + uses: actions/setup-python@v6 |
| 159 | + with: |
| 160 | + python-version: '3.x' |
| 161 | + architecture: 'x64' |
| 162 | + |
| 163 | + - name: Configuring Python packages |
| 164 | + run: | |
| 165 | + python -c "import sys; print(sys.version)" |
| 166 | + python -m pip install scons |
| 167 | +
|
| 168 | + - name: Setup Linux toolchains |
| 169 | + if: ${{ matrix.platform == 'linux' }} |
| 170 | + run: | |
| 171 | + if [ ! -f ${{ matrix.buildroot }}.tar.bz2 ]; then |
| 172 | + wget https://github.com/godotengine/buildroot/releases/download/godot-2023.08.x-4/${{ matrix.buildroot }}.tar.bz2 |
| 173 | + fi |
| 174 | + tar -xjf ${{ matrix.buildroot }}.tar.bz2 |
| 175 | + ${{ matrix.buildroot }}/relocate-sdk.sh |
| 176 | + rm ${{ matrix.buildroot }}/bin/cmake |
| 177 | + echo "$GITHUB_WORKSPACE/${{ matrix.buildroot }}/bin" >> $GITHUB_PATH |
| 178 | + echo "PKG_CONFIG=$GITHUB_WORKSPACE/${{ matrix.buildroot }}/share/pkgconfig/" >> $GITHUB_ENV |
| 179 | +
|
| 180 | + - name: Setup Android dependencies |
| 181 | + if: ${{ matrix.platform == 'android' }} |
| 182 | + uses: nttld/setup-ndk@v1 |
| 183 | + with: |
| 184 | + ndk-version: r28b |
| 185 | + link-to-sdk: true |
| 186 | + |
| 187 | + - name: Print tools versions |
| 188 | + run: | |
| 189 | + python --version |
| 190 | + scons --version |
| 191 | + cmake --version |
| 192 | +
|
| 193 | + - name: Compile Extension (4.3+) - ${{ matrix.platform }} - ${{ matrix.arch }} |
| 194 | + run: | |
| 195 | + scons |
| 196 | +
|
| 197 | + - name: Save Godot build cache |
| 198 | + uses: ./godot-cpp/.github/actions/godot-cache-save |
| 199 | + with: |
| 200 | + cache-name: ${{ matrix.cache-name }} |
| 201 | + scons-cache: ${{ env.SCONS_CACHE }} |
| 202 | + continue-on-error: true |
| 203 | + |
| 204 | + - uses: actions/upload-artifact@v7 |
| 205 | + with: |
| 206 | + name: ${{ github.job }}-${{ matrix.platform }}-${{ matrix.arch }} |
| 207 | + path: | |
| 208 | + out/ |
| 209 | +
|
| 210 | + package: |
| 211 | + name: 📦 Package |
| 212 | + needs: build |
| 213 | + runs-on: "ubuntu-latest" |
| 214 | + steps: |
| 215 | + - uses: actions/checkout@v6 |
| 216 | + with: |
| 217 | + submodules: recursive |
| 218 | + |
| 219 | + - uses: actions/download-artifact@v8 |
| 220 | + with: |
| 221 | + path: artifacts |
| 222 | + |
| 223 | + - name: Bundle licenses. |
| 224 | + run: | |
| 225 | + cp LICENSE artifacts/LICENSE.godot-git-plugin |
| 226 | + cp thirdparty/mbedtls/LICENSE artifacts/LICENSE.mbedtls |
| 227 | + cp thirdparty/ssh2/libssh2/COPYING artifacts/LICENSE.libssh2 |
| 228 | + cp thirdparty/git2/libgit2/COPYING artifacts/LICENSE.libgit2 |
| 229 | +
|
| 230 | + - name: Package artifacts for release |
| 231 | + env: |
| 232 | + DESTINATION: "release" |
| 233 | + run: | |
| 234 | + mkdir release |
| 235 | + ./misc/scripts/package_release.sh |
| 236 | + ls -R release |
| 237 | +
|
| 238 | + - uses: actions/upload-artifact@v7 |
| 239 | + with: |
| 240 | + name: godot-git-plugin |
| 241 | + path: release/godot-git-plugin.zip |
0 commit comments