|
| 1 | +name: 📊 Static Checks -> 🔧 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 | + SCONS_CACHE: ${{ github.workspace }}/.scons-cache/ |
| 8 | + ANDROID_SDK_ROOT: /usr/local/lib/android/sdk/ |
| 9 | + |
| 10 | +jobs: |
| 11 | + static-checks: |
| 12 | + name: 📊 Static Checks |
| 13 | + runs-on: ubuntu-22.04 |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v4 |
| 16 | + - uses: DoozyX/clang-format-lint-action@v0.18.2 |
| 17 | + with: |
| 18 | + source: "src" |
| 19 | + extensions: "h,cpp" |
| 20 | + clangFormatVersion: 18 |
| 21 | + |
| 22 | + build: |
| 23 | + runs-on: ${{ matrix.os }} |
| 24 | + name: 🔧 Build |
| 25 | + needs: static-checks |
| 26 | + strategy: |
| 27 | + fail-fast: false |
| 28 | + matrix: |
| 29 | + include: |
| 30 | + # Anrdoid |
| 31 | + - platform: android |
| 32 | + arch: 'x86_64' |
| 33 | + sconsflags: '' |
| 34 | + os: 'ubuntu-22.04' |
| 35 | + cache-name: android-x86_64 |
| 36 | + - platform: android |
| 37 | + arch: 'arm64' |
| 38 | + sconsflags: '' |
| 39 | + os: 'ubuntu-22.04' |
| 40 | + cache-name: android-arm64 |
| 41 | + |
| 42 | + # Linux |
| 43 | + - platform: linux |
| 44 | + arch: x86_32 |
| 45 | + buildroot: i686-godot-linux-gnu_sdk-buildroot |
| 46 | + sconsflags: "" |
| 47 | + os: ubuntu-22.04 |
| 48 | + cache-name: linux-x86_32 |
| 49 | + - platform: linux |
| 50 | + arch: x86_64 |
| 51 | + buildroot: x86_64-godot-linux-gnu_sdk-buildroot |
| 52 | + sconsflags: "" |
| 53 | + os: ubuntu-22.04 |
| 54 | + cache-name: linux-x86_64 |
| 55 | + - platform: linux |
| 56 | + arch: arm32 |
| 57 | + buildroot: arm-godot-linux-gnueabihf_sdk-buildroot |
| 58 | + sconsflags: "" |
| 59 | + os: ubuntu-22.04 |
| 60 | + cache-name: linux-arm32 |
| 61 | + - platform: linux |
| 62 | + arch: arm64 |
| 63 | + buildroot: aarch64-godot-linux-gnu_sdk-buildroot |
| 64 | + sconsflags: "" |
| 65 | + os: ubuntu-22.04 |
| 66 | + cache-name: linux-arm64 |
| 67 | + |
| 68 | + # macOS |
| 69 | + - platform: macos |
| 70 | + arch: universal |
| 71 | + sconsflags: "" |
| 72 | + os: macos-latest |
| 73 | + cache-name: macos-universal |
| 74 | + |
| 75 | + # Windows |
| 76 | + - platform: windows |
| 77 | + arch: x86_32 |
| 78 | + msvc-arch: x86 |
| 79 | + sconsflags: "" |
| 80 | + os: windows-latest |
| 81 | + cache-name: win-x86_32 |
| 82 | + - platform: windows |
| 83 | + arch: x86_64 |
| 84 | + msvc-arch: x64 |
| 85 | + sconsflags: "" |
| 86 | + os: windows-latest |
| 87 | + cache-name: win-x86_64 |
| 88 | + - platform: windows |
| 89 | + arch: arm64 |
| 90 | + msvc-arch: amd64_arm64 |
| 91 | + sconsflags: "" |
| 92 | + os: windows-latest |
| 93 | + cache-name: win-arm64 |
| 94 | + |
| 95 | + env: |
| 96 | + SCONSFLAGS: ${{ matrix.sconsflags }} platform=${{ matrix.platform }} arch=${{ matrix.arch }} debug_symbols=no |
| 97 | + |
| 98 | + defaults: |
| 99 | + run: |
| 100 | + shell: bash |
| 101 | + |
| 102 | + steps: |
| 103 | + - uses: actions/checkout@v4 |
| 104 | + with: |
| 105 | + submodules: recursive |
| 106 | + |
| 107 | + - name: Setup Godot build cache |
| 108 | + uses: ./godot-cpp/.github/actions/godot-cache |
| 109 | + with: |
| 110 | + cache-name: ${{ matrix.cache-name }} |
| 111 | + continue-on-error: true |
| 112 | + |
| 113 | + - name: Install Linux build dependencies |
| 114 | + if: ${{ matrix.platform == 'linux' }} |
| 115 | + run: | |
| 116 | + sudo apt-get update |
| 117 | + sudo apt-get install build-essential gcc-multilib g++-multilib wget |
| 118 | +
|
| 119 | + - name: Setup Linux buildroot toolchain cache |
| 120 | + if: ${{ matrix.platform == 'linux' }} |
| 121 | + uses: actions/cache@v4 |
| 122 | + with: |
| 123 | + path: | |
| 124 | + ${{ matrix.buildroot }}.tar.bz2 |
| 125 | + key: linux-${{ matrix.buildroot }}-buildroot |
| 126 | + |
| 127 | + - name: Setup Android dependencies |
| 128 | + if: ${{ matrix.platform == 'android' }} |
| 129 | + uses: nttld/setup-ndk@v1 |
| 130 | + with: |
| 131 | + ndk-version: r23c |
| 132 | + link-to-sdk: true |
| 133 | + |
| 134 | + - name: Set up Python 3.x |
| 135 | + uses: actions/setup-python@v5 |
| 136 | + with: |
| 137 | + python-version: 3.x |
| 138 | + architecture: x64 |
| 139 | + |
| 140 | + - name: Configuring Python packages |
| 141 | + run: | |
| 142 | + python -c "import sys; print(sys.version)" |
| 143 | + python -m pip install scons |
| 144 | +
|
| 145 | + - name: Apply build profile patches |
| 146 | + run: | |
| 147 | + patch -p1 < misc/patches/build_profile.diff |
| 148 | +
|
| 149 | + - name: Setup Linux toolchains |
| 150 | + if: ${{ matrix.platform == 'linux' }} |
| 151 | + run: | |
| 152 | + if [ ! -f ${{ matrix.buildroot }}.tar.bz2 ]; then |
| 153 | + wget https://github.com/godotengine/buildroot/releases/download/godot-2023.08.x-4/${{ matrix.buildroot }}.tar.bz2 |
| 154 | + fi |
| 155 | + tar -xjf ${{ matrix.buildroot }}.tar.bz2 |
| 156 | + ${{ matrix.buildroot }}/relocate-sdk.sh |
| 157 | + rm ${{ matrix.buildroot }}/bin/cmake |
| 158 | + echo "$GITHUB_WORKSPACE/${{ matrix.buildroot }}/bin" >> $GITHUB_PATH |
| 159 | + echo "PKG_CONFIG=$GITHUB_WORKSPACE/${{ matrix.buildroot }}/share/pkgconfig/" >> $GITHUB_ENV |
| 160 | +
|
| 161 | + - name: Use updated windows tools, patch libgit2. |
| 162 | + if: ${{ matrix.platform == 'windows' }} |
| 163 | + run: | |
| 164 | + rm /usr/bin/link # GNU linkker conflicts with MSVC linkes |
| 165 | + patch -p1 < misc/patches/libgit_linker_flags.diff |
| 166 | + cp misc/patches/windows.py godot-cpp/tools/windows.py |
| 167 | + cp misc/patches/common_compiler_flags.py godot-cpp/tools/common_compiler_flags.py |
| 168 | +
|
| 169 | + - name: Print tools versions |
| 170 | + run: | |
| 171 | + python --version |
| 172 | + scons --version |
| 173 | + cmake --version |
| 174 | +
|
| 175 | + - name: Compile Extension - editor - ${{ matrix.platform }} - ${{ matrix.arch }} |
| 176 | + run: | |
| 177 | + scons target=editor build_profile=build_profile.json |
| 178 | +
|
| 179 | + - uses: actions/upload-artifact@v4 |
| 180 | + with: |
| 181 | + name: ${{ github.job }}-${{ matrix.platform }}-${{ matrix.arch }} |
| 182 | + path: | |
| 183 | + bin/addons/godot-git-plugin/ |
| 184 | +
|
| 185 | + package: |
| 186 | + name: 📦 Package |
| 187 | + needs: build |
| 188 | + runs-on: "ubuntu-latest" |
| 189 | + steps: |
| 190 | + - uses: actions/checkout@v4 |
| 191 | + with: |
| 192 | + submodules: recursive |
| 193 | + |
| 194 | + - uses: actions/download-artifact@v4 |
| 195 | + with: |
| 196 | + path: artifacts |
| 197 | + |
| 198 | + - name: Bundle licenses. |
| 199 | + run: | |
| 200 | + cp LICENSE artifacts/LICENSE.godot-git-plugin |
| 201 | + cp thirdparty/libgit2/COPYING artifacts/LICENSE.libgit2 |
| 202 | + cp thirdparty/libssh2/COPYING artifacts/LICENSE.libssh2 |
| 203 | + cp thirdparty/mbedtls/LICENSE artifacts/LICENSE.mbedtls |
| 204 | +
|
| 205 | + - name: Package artifacts for release |
| 206 | + env: |
| 207 | + DESTINATION: "release" |
| 208 | + run: | |
| 209 | + mkdir release |
| 210 | + ./misc/scripts/package_release.sh |
| 211 | + ls -R release |
| 212 | +
|
| 213 | + - uses: actions/upload-artifact@v4 |
| 214 | + with: |
| 215 | + name: godot-git-plugin |
| 216 | + path: release |
0 commit comments