|  | 
|  | 1 | +name: Continuous integration | 
|  | 2 | +on: | 
|  | 3 | +  workflow_call: | 
|  | 4 | + | 
|  | 5 | +env: | 
|  | 6 | +  # Only used for the cache key. Increment version to force clean build. | 
|  | 7 | +  GODOT_BASE_BRANCH: master | 
|  | 8 | +  # Used to select the version of Godot to run the tests with. | 
|  | 9 | +  GODOT_TEST_VERSION: master | 
|  | 10 | +  # Use UTF-8 on Linux. | 
|  | 11 | +  LANG: en_US.UTF-8 | 
|  | 12 | +  LC_ALL: en_US.UTF-8 | 
|  | 13 | + | 
|  | 14 | +concurrency: | 
|  | 15 | +  group: ci-cmake-${{ github.actor }}-${{ github.head_ref || github.run_number }}-${{ github.ref }} | 
|  | 16 | +  cancel-in-progress: true | 
|  | 17 | + | 
|  | 18 | +jobs: | 
|  | 19 | +  build-cmake: | 
|  | 20 | +    name: ${{ matrix.name }} | 
|  | 21 | +    runs-on: ${{ matrix.os }} | 
|  | 22 | +    env: | 
|  | 23 | +      EM_VERSION: 3.1.39 | 
|  | 24 | +      config-flags: | 
|  | 25 | +        -DCMAKE_C_COMPILER_LAUNCHER=sccache | 
|  | 26 | +        -DCMAKE_CXX_COMPILER_LAUNCHER=sccache | 
|  | 27 | +        -DGODOTCPP_ENABLE_TESTING=ON | 
|  | 28 | +        -DGODOTCPP_BUILD_PROFILE="test/build_profile.json" | 
|  | 29 | +      SCCACHE_GHA_ENABLED: "true" | 
|  | 30 | + | 
|  | 31 | +    strategy: | 
|  | 32 | +      fail-fast: false | 
|  | 33 | +      matrix: | 
|  | 34 | +        include: | 
|  | 35 | +          - name: 🐧 Linux (GCC, Makefiles) | 
|  | 36 | +            os: ubuntu-22.04 | 
|  | 37 | +            platform: linux | 
|  | 38 | +            config-flags: -DCMAKE_BUILD_TYPE=Release | 
|  | 39 | +            artifact-name: godot-cpp-linux-glibc2.27-x86_64-release.cmake | 
|  | 40 | +            artifact-path: cmake-build/bin/libgodot-cpp.linux.template_release.x86_64.a | 
|  | 41 | +            run-tests: true | 
|  | 42 | + | 
|  | 43 | +          - name: 🐧 Linux (GCC, Makefiles, Double Precision) | 
|  | 44 | +            os: ubuntu-22.04 | 
|  | 45 | +            platform: linux | 
|  | 46 | +            config-flags: -DCMAKE_BUILD_TYPE=Release -DGODOTCPP_PRECISION=double | 
|  | 47 | +            artifact-name: godot-cpp-linux-glibc2.27-x86_64-double-release.cmake | 
|  | 48 | +            artifact-path: cmake-build/bin/libgodot-cpp.linux.template_release.double.x86_64.a | 
|  | 49 | +            flags: precision=double | 
|  | 50 | +            run-tests: false | 
|  | 51 | + | 
|  | 52 | +          - name: 🏁 Windows (x86_64, MSVC) | 
|  | 53 | +            os: windows-2019 | 
|  | 54 | +            platform: windows | 
|  | 55 | +            compiler: msvc | 
|  | 56 | +            build-flags: --config Release | 
|  | 57 | +            artifact-name: godot-cpp-windows-msvc2019-x86_64-release.cmake | 
|  | 58 | +            artifact-path: cmake-build/bin/libgodot-cpp.windows.template_release.x86_64.lib | 
|  | 59 | +            run-tests: false | 
|  | 60 | + | 
|  | 61 | +          - name: 🏁 Windows (x86_64, MinGW, Ninja) | 
|  | 62 | +            os: windows-2019 | 
|  | 63 | +            platform: windows | 
|  | 64 | +            compiler: mingw | 
|  | 65 | +            config-flags: | 
|  | 66 | +              -GNinja -DCMAKE_BUILD_TYPE=Release | 
|  | 67 | +              -DCMAKE_CXX_COMPILER=cc -DCMAKE_CXX_COMPILER=c++ | 
|  | 68 | +            artifact-name: godot-cpp-linux-mingw-x86_64-release.cmake | 
|  | 69 | +            artifact-path: cmake-build/bin/libgodot-cpp.windows.template_release.x86_64.a | 
|  | 70 | +            run-tests: false | 
|  | 71 | + | 
|  | 72 | +          - name: 🍎 macOS (universal, Makefiles) | 
|  | 73 | +            os: macos-latest | 
|  | 74 | +            platform: macos | 
|  | 75 | +            config-flags: -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" | 
|  | 76 | +            artifact-name: godot-cpp-macos-universal-release.cmake | 
|  | 77 | +            artifact-path: cmake-build/bin/libgodot-cpp.macos.template_release.universal.a | 
|  | 78 | +            run-tests: false | 
|  | 79 | + | 
|  | 80 | +          - name: 🤖 Android (arm64, Ninja) | 
|  | 81 | +            os: ubuntu-22.04 | 
|  | 82 | +            platform: android | 
|  | 83 | +            config-flags: | 
|  | 84 | +              -G Ninja -DCMAKE_BUILD_TYPE=Release | 
|  | 85 | +              --toolchain ${ANDROID_HOME}/ndk/23.2.8568313/build/cmake/android.toolchain.cmake | 
|  | 86 | +              -DANDROID_PLATFORM=21 -DANDROID_ABI=arm64-v8a | 
|  | 87 | +            artifact-name: godot-cpp-android-arm64-release.cmake | 
|  | 88 | +            artifact-path: cmake-build/bin/libgodot-cpp.android.template_release.arm64.a | 
|  | 89 | +            flags: arch=arm64 | 
|  | 90 | +            run-tests: false | 
|  | 91 | + | 
|  | 92 | +          - name: 🍏 iOS (arm64, XCode) | 
|  | 93 | +            os: macos-latest | 
|  | 94 | +            platform: ios | 
|  | 95 | +            config-flags: | 
|  | 96 | +              -G Xcode | 
|  | 97 | +              --toolchain cmake/ios.toolchain.cmake | 
|  | 98 | +              -DPLATFORM=OS64 | 
|  | 99 | +            build-flags: --config Release | 
|  | 100 | +            artifact-name: godot-cpp-ios-arm64-release.cmake | 
|  | 101 | +            artifact-path: cmake-build/bin/libgodot-cpp.ios.template_release.arm64.a | 
|  | 102 | +            flags: arch=arm64 | 
|  | 103 | +            run-tests: false | 
|  | 104 | + | 
|  | 105 | +          - name: 🌐 Web (wasm32, Ninja) | 
|  | 106 | +            os: ubuntu-22.04 | 
|  | 107 | +            platform: web | 
|  | 108 | +            config-flags: | 
|  | 109 | +              -G Ninja  -DCMAKE_BUILD_TYPE=Release | 
|  | 110 | +              --toolchain ${EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake | 
|  | 111 | +            artifact-name: godot-cpp-web-wasm32-release.cmake | 
|  | 112 | +            artifact-path: cmake-build/bin/libgodot-cpp.web.template_release.wasm32.a | 
|  | 113 | +            run-tests: false | 
|  | 114 | + | 
|  | 115 | +    steps: | 
|  | 116 | +      - name: Checkout | 
|  | 117 | +        uses: actions/checkout@v4 | 
|  | 118 | +        with: | 
|  | 119 | +          submodules: recursive | 
|  | 120 | + | 
|  | 121 | +      - name: Run sccache-cache | 
|  | 122 | +        uses: mozilla-actions/[email protected] | 
|  | 123 | + | 
|  | 124 | +      - name: Setup godot-cpp | 
|  | 125 | +        uses: ./.github/actions/setup-godot-cpp | 
|  | 126 | +        with: | 
|  | 127 | +          platform: ${{ matrix.platform }} | 
|  | 128 | +          windows-compiler: ${{ matrix.compiler }} | 
|  | 129 | +          buildtool: cmake | 
|  | 130 | + | 
|  | 131 | +      - name: Configure godot-cpp-test with template_debug | 
|  | 132 | +        run: > | 
|  | 133 | +          cmake --log-level=VERBOSE -S . -B cmake-build ${{ env.config-flags }} ${{ matrix.config-flags }} | 
|  | 134 | +
 | 
|  | 135 | +      - name: Build godot-cpp-test (template_debug) | 
|  | 136 | +        run: > | 
|  | 137 | +          cmake --build cmake-build --verbose  --target godot-cpp-test ${{ matrix.build-flags }} | 
|  | 138 | +
 | 
|  | 139 | +      - name: Configure godot-cpp-test with template_release | 
|  | 140 | +        run: > | 
|  | 141 | +          cmake --fresh --log-level=VERBOSE -S . -B cmake-build | 
|  | 142 | +          -DGODOTCPP_TARGET=template_release ${{ env.config-flags }} ${{ matrix.config-flags }} | 
|  | 143 | +
 | 
|  | 144 | +      - name: Build godot-cpp-test (template_release) | 
|  | 145 | +        run: > | 
|  | 146 | +          cmake --build cmake-build --verbose  --target godot-cpp-test ${{ matrix.build-flags }} | 
|  | 147 | +
 | 
|  | 148 | +      - name: Run sccache stat for check | 
|  | 149 | +        shell: bash | 
|  | 150 | +        run: ${SCCACHE_PATH} --show-stats | 
|  | 151 | + | 
|  | 152 | +      - name: Download latest Godot artifacts | 
|  | 153 | +        uses: dsnopek/action-download-artifact@1322f74e2dac9feed2ee76a32d9ae1ca3b4cf4e9 | 
|  | 154 | +        if: matrix.run-tests && env.GODOT_TEST_VERSION == 'master' | 
|  | 155 | +        with: | 
|  | 156 | +          repo: godotengine/godot | 
|  | 157 | +          branch: master | 
|  | 158 | +          event: push | 
|  | 159 | +          workflow: linux_builds.yml | 
|  | 160 | +          workflow_conclusion: success | 
|  | 161 | +          name: linux-editor-mono | 
|  | 162 | +          search_artifacts: true | 
|  | 163 | +          check_artifacts: true | 
|  | 164 | +          ensure_latest: true | 
|  | 165 | +          path: godot-artifacts | 
|  | 166 | + | 
|  | 167 | +      - name: Prepare Godot artifacts for testing | 
|  | 168 | +        if: matrix.run-tests && env.GODOT_TEST_VERSION == 'master' | 
|  | 169 | +        run: | | 
|  | 170 | +          chmod +x ./godot-artifacts/godot.linuxbsd.editor.x86_64.mono | 
|  | 171 | +          echo "GODOT=$(pwd)/godot-artifacts/godot.linuxbsd.editor.x86_64.mono" >> $GITHUB_ENV | 
|  | 172 | +
 | 
|  | 173 | +      - name: Download requested Godot version for testing | 
|  | 174 | +        if: matrix.run-tests && env.GODOT_TEST_VERSION != 'master' | 
|  | 175 | +        run: | | 
|  | 176 | +          wget "https://github.com/godotengine/godot-builds/releases/download/${GODOT_TEST_VERSION}/Godot_v${GODOT_TEST_VERSION}_linux.x86_64.zip" -O Godot.zip | 
|  | 177 | +          unzip -a Godot.zip | 
|  | 178 | +          chmod +x "Godot_v${GODOT_TEST_VERSION}_linux.x86_64" | 
|  | 179 | +          echo "GODOT=$(pwd)/Godot_v${GODOT_TEST_VERSION}_linux.x86_64" >> $GITHUB_ENV | 
|  | 180 | +
 | 
|  | 181 | +      - name: Run tests | 
|  | 182 | +        if: matrix.run-tests | 
|  | 183 | +        run: | | 
|  | 184 | +          $GODOT --headless --version | 
|  | 185 | +          cd test | 
|  | 186 | +          # Need to run the editor so .godot is generated... but it crashes! Ignore that :-) | 
|  | 187 | +          (cd project && (timeout 30 $GODOT --import --headless >/dev/null 2>&1 || true)) | 
|  | 188 | +          ./run-tests.sh | 
|  | 189 | +
 | 
|  | 190 | +      - name: Upload artifact | 
|  | 191 | +        uses: actions/upload-artifact@v4 | 
|  | 192 | +        with: | 
|  | 193 | +          name: ${{ matrix.artifact-name }} | 
|  | 194 | +          path: ${{ matrix.artifact-path }} | 
|  | 195 | +          if-no-files-found: error | 
0 commit comments