diff --git a/.github/workflows/plugin-apk.yml b/.github/workflows/apk.yml similarity index 80% rename from .github/workflows/plugin-apk.yml rename to .github/workflows/apk.yml index 2165b285..b6e4a3c9 100644 --- a/.github/workflows/plugin-apk.yml +++ b/.github/workflows/apk.yml @@ -1,4 +1,4 @@ -name: MobileGL Plugin APK +name: MobileGL APK on: push: @@ -46,14 +46,14 @@ jobs: working-directory: 3rdparty/glslang run: python update_glslang_sources.py - - name: Build plugin APK - run: gradle --no-daemon -p android-plugin :app:assembleRelease + - name: Build APKs + run: gradle --no-daemon -p android-plugin :app:assembleRelease :app:assembleEsprytTraceRelease :app:assembleMagmaTraceRelease --parallel --max-workers "$(nproc)" env: SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }} SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} - - name: Verify signed APK + - name: Verify signed APKs run: | APKSIGNER="$(find "$ANDROID_HOME/build-tools" -name apksigner -type f | sort -V | tail -n 1)" mapfile -t APKS < <(find android-plugin/app/build/outputs/apk -type f -path '*/release/*.apk' | sort) @@ -75,6 +75,12 @@ jobs: uses: actions/upload-artifact@v4 with: name: MobileGL-plugin-${{ env.date_today }}-${{ env.short_sha }} - path: | - android-plugin/app/build/outputs/apk/release/*.apk - android-plugin/app/build/outputs/apk/**/release/*.apk + path: android-plugin/app/build/outputs/apk/*Plugin/release/*.apk + if-no-files-found: error + + - name: Upload retrace APK + uses: actions/upload-artifact@v4 + with: + name: MobileGL-retrace-apk-${{ env.date_today }}-${{ env.short_sha }} + path: android-plugin/app/build/outputs/apk/*Trace/release/*.apk + if-no-files-found: error diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 016f7ee6..00000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: Benchmark - -on: - push: - branches: - - dev - - Feat/Backend-Direct-GLES - - Feat/Backend-Direct-Vulkan - -jobs: - benchmark: - runs-on: ubuntu-latest - env: - # BENCH_ROOT: ${{github.workspace}}/MobileGL/MG_Benchmark - BENCH_ROOT: ${{github.workspace}} - - steps: - - name: Set Swap Space - uses: pierotofy/set-swap-space@master - with: - swap-size-gb: 32 - - - name: Checkout repo - uses: actions/checkout@v4 - with: - submodules: true - - - name: Get CMake - uses: lukka/get-cmake@latest - - - name: Prepare Vulkan SDK - uses: humbletim/setup-vulkan-sdk@v1.2.1 - with: - vulkan-query-version: 1.4.304.1 - vulkan-components: Vulkan-Headers, Vulkan-Loader - vulkan-use-cache: true - - - name: Update glslang external sources - working-directory: ${{env.BENCH_ROOT}}/3rdparty/glslang - run: python update_glslang_sources.py - - - name: Install clang-20 - run: | - sudo apt-get update - sudo apt-get install -y clang-20 clang++-20 lld-20 libc++-20-dev libc++abi-20-dev libvulkan-dev - - - name: Show installed toolchain - run: | - clang-20 --version - clang++-20 --version - ld.lld-20 --version || ld.lld --version || true - dpkg -l 'libc++*' || true - - - name: Configure CMake - working-directory: ${{env.BENCH_ROOT}} - run: cmake -S . -B build-bench -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang-20 -DCMAKE_CXX_COMPILER=clang++-20 -DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON -DBENCHMARK_ENABLE_TESTING=OFF -DMOBILEGL_BUILD_TEST=OFF -DMOBILEGL_BUILD_BENCHMARK=ON -DCMAKE_POLICY_VERSION_MINIMUM=3.5 - - - name: Build - working-directory: ${{env.BENCH_ROOT}}/build-bench - run: cmake --build . - - - name: Benchmark - working-directory: ${{env.BENCH_ROOT}}/build-bench/MobileGL/MG_Benchmark - run: ctest -V -C Release diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..05ca38f5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,250 @@ +name: CI + +on: + push: + branches: + - dev + - Feat/Backend-Direct-GLES + - Feat/Backend-Direct-Vulkan + workflow_dispatch: + +jobs: + build-linux: + runs-on: ubuntu-latest + env: + BUILD_DIR: build-linux + + steps: + - name: Set Swap Space + uses: pierotofy/set-swap-space@master + with: + swap-size-gb: 32 + + - name: Checkout repo + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Get CMake + uses: lukka/get-cmake@latest + + - name: Prepare Vulkan SDK + uses: humbletim/setup-vulkan-sdk@v1.2.1 + with: + vulkan-query-version: 1.4.304.1 + vulkan-components: Vulkan-Headers, Vulkan-Loader + vulkan-use-cache: true + + - name: Update glslang external sources + working-directory: 3rdparty/glslang + run: python update_glslang_sources.py + + - name: Install build dependencies + run: | + sudo apt-get update + sudo apt-get install -y clang-20 clang++-20 lld-20 libc++-20-dev libc++abi-20-dev libvulkan-dev libegl1-mesa-dev libgles2-mesa-dev libgl1-mesa-dri mesa-vulkan-drivers ninja-build + + - name: Show installed toolchain + run: | + clang-20 --version + clang++-20 --version + ld.lld-20 --version || ld.lld --version || true + dpkg -l 'libc++*' 'libegl*' 'libgles*' 'mesa*' 'vulkan*' || true + + - name: Configure CMake + run: | + if [ "${{ secrets.ACTIONS_STEP_DEBUG }}" = "true" ]; then + BUILD_TYPE=Debug + else + BUILD_TYPE=Release + fi + + cmake -S . -B "${BUILD_DIR}" -G Ninja \ + -DCMAKE_C_COMPILER=clang-20 \ + -DCMAKE_CXX_COMPILER=clang++-20 \ + -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \ + -DMOBILEGL_BUILD_TEST=ON \ + -DMOBILEGL_BUILD_BENCHMARK=ON \ + -DMOBILEGL_BUILD_TRACE_REPLAY=ON \ + -DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON \ + -DBENCHMARK_ENABLE_TESTING=OFF \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 + + - name: Build + run: cmake --build "${BUILD_DIR}" --parallel "$(nproc)" + + - name: Package Linux runtime + run: | + mkdir -p ci-artifacts + mapfile -t SHARED_LIBS < <(find "${BUILD_DIR}" -type f \( -name '*.so' -o -name '*.so.*' \) -print | sort) + tar \ + --exclude='*/CMakeFiles' \ + --exclude='*.o' \ + --exclude='*.a' \ + --exclude='*.ninja*' \ + --exclude='build.ninja' \ + --exclude='cmake_install.cmake' \ + -czf ci-artifacts/mobilegl-linux-runtime.tgz \ + "${BUILD_DIR}/CTestTestfile.cmake" \ + "${BUILD_DIR}/MobileGL/MG_Test" \ + "${BUILD_DIR}/MobileGL/MG_Benchmark" \ + "${BUILD_DIR}/tools/trace_replay" \ + "${SHARED_LIBS[@]}" \ + tools/trace_replay/fixtures + + - name: Upload Linux runtime + uses: actions/upload-artifact@v4 + with: + name: mobilegl-linux-runtime + path: ci-artifacts/mobilegl-linux-runtime.tgz + if-no-files-found: error + + test: + runs-on: ubuntu-latest + needs: build-linux + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Get CMake + uses: lukka/get-cmake@latest + + - name: Install runtime dependencies + run: | + sudo apt-get update + sudo apt-get install -y libvulkan1 libegl1 libgles2 libgl1-mesa-dri mesa-vulkan-drivers + + - name: Download Linux runtime + uses: actions/download-artifact@v4 + with: + name: mobilegl-linux-runtime + path: . + + - name: Unpack Linux runtime + run: tar -xzf mobilegl-linux-runtime.tgz + + - name: Normalize CTest command paths + run: | + python - <<'PY' + from pathlib import Path + import re + + for path in Path('build-linux').rglob('CTestTestfile.cmake'): + text = path.read_text() + text = re.sub(r'"[^"]*/cmake-[^"]*/bin/cmake"', '"cmake"', text) + path.write_text(text) + PY + + - name: Test + working-directory: build-linux/MobileGL/MG_Test + run: | + if [ "${{ secrets.ACTIONS_STEP_DEBUG }}" = "true" ]; then + ctest -V + else + ctest --output-on-failure + fi + + benchmark: + runs-on: ubuntu-latest + needs: build-linux + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Get CMake + uses: lukka/get-cmake@latest + + - name: Install runtime dependencies + run: | + sudo apt-get update + sudo apt-get install -y libvulkan1 libegl1 libgles2 libgl1-mesa-dri mesa-vulkan-drivers + + - name: Download Linux runtime + uses: actions/download-artifact@v4 + with: + name: mobilegl-linux-runtime + path: . + + - name: Unpack Linux runtime + run: tar -xzf mobilegl-linux-runtime.tgz + + - name: Normalize CTest command paths + run: | + python - <<'PY' + from pathlib import Path + import re + + for path in Path('build-linux').rglob('CTestTestfile.cmake'): + text = path.read_text() + text = re.sub(r'"[^"]*/cmake-[^"]*/bin/cmake"', '"cmake"', text) + path.write_text(text) + PY + + - name: Benchmark + working-directory: build-linux/MobileGL/MG_Benchmark + run: ctest -V -C Release + + retrace: + runs-on: ubuntu-latest + needs: build-linux + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Get CMake + uses: lukka/get-cmake@latest + + - name: Install runtime dependencies + run: | + sudo apt-get update + sudo apt-get install -y libvulkan1 libegl1 libgles2 libgl1-mesa-dri mesa-vulkan-drivers + + - name: Download Linux runtime + uses: actions/download-artifact@v4 + with: + name: mobilegl-linux-runtime + path: . + + - name: Unpack Linux runtime + run: tar -xzf mobilegl-linux-runtime.tgz + + - name: Normalize CTest command paths + run: | + python - <<'PY' + from pathlib import Path + import re + + for path in Path('build-linux').rglob('CTestTestfile.cmake'): + text = path.read_text() + text = re.sub(r'"[^"]*/cmake-[^"]*/bin/cmake"', '"cmake"', text) + path.write_text(text) + PY + + - name: Retrace and validate Espryt (DirectGLES) + working-directory: build-linux/tools/trace_replay + run: ctest -V -R MobileGLTraceReplay.OpenRA.DirectGLES + + - name: Retrace and validate Magma (DirectVulkan) + working-directory: build-linux/tools/trace_replay + run: ctest -V -R MobileGLTraceReplay.OpenRA.DirectVulkan + + - name: Upload actual image + if: always() + uses: actions/upload-artifact@v4 + with: + name: OpenRA-retrace-actual + path: | + build-linux/tools/trace_replay/openra/actual-images/openra-DirectGLES-actual.png + build-linux/tools/trace_replay/openra/actual-images/openra-DirectVulkan-actual.png + build-linux/tools/trace_replay/openra/actual-images/*.json + build-linux/tools/trace_replay/openra/actual-images/*.log + if-no-files-found: warn diff --git a/.github/workflows/retrace-apk.yml b/.github/workflows/retrace-apk.yml deleted file mode 100644 index 56646cf7..00000000 --- a/.github/workflows/retrace-apk.yml +++ /dev/null @@ -1,80 +0,0 @@ -name: Retrace APK - -on: - push: - branches: - - dev - - Feat/Backend-Direct-GLES - - Feat/Backend-Direct-Vulkan - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout repo - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Set artifact metadata - run: | - echo "date_today=$(date +'%Y-%m-%d')" >> "$GITHUB_ENV" - echo "short_sha=${GITHUB_SHA::7}" >> "$GITHUB_ENV" - - - name: Set up JDK - uses: actions/setup-java@v4 - with: - distribution: zulu - java-version: '17' - - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v4 - with: - gradle-version: 8.10.2 - - - name: Setup Android SDK - uses: android-actions/setup-android@v3 - - - name: Install Android NDK - run: | - sdkmanager "ndk;27.3.13750724" - echo "ndk.dir=$ANDROID_HOME/ndk/27.3.13750724" >> android-plugin/local.properties - - - name: Update glslang external sources - working-directory: 3rdparty/glslang - run: python update_glslang_sources.py - - - name: Build retrace APK - run: | - gradle --no-daemon -p android-plugin :app:assembleEsprytTraceRelease - gradle --no-daemon -p android-plugin :app:assembleMagmaTraceRelease - env: - SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }} - SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} - SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} - - - name: Verify signed APK - run: | - APKSIGNER="$(find "$ANDROID_HOME/build-tools" -name apksigner -type f | sort -V | tail -n 1)" - mapfile -t APKS < <(find android-plugin/app/build/outputs/apk -type f -path '*/release/*.apk' | sort) - if [ "${#APKS[@]}" -eq 0 ]; then - echo "::error::No release APKs found under android-plugin/app/build/outputs/apk" - find android-plugin/app/build/outputs/apk -type f -print || true - exit 1 - fi - - for APK in "${APKS[@]}"; do - if [[ "$APK" == *-unsigned.apk ]]; then - echo "::error::Unsigned release APK produced: $APK" - exit 1 - fi - "$APKSIGNER" verify --verbose "$APK" - done - - - name: Upload retrace APK - uses: actions/upload-artifact@v4 - with: - name: MobileGL-retrace-apk-${{ env.date_today }}-${{ env.short_sha }} - path: android-plugin/app/build/outputs/apk/**/release/*.apk diff --git a/.github/workflows/retrace.yml b/.github/workflows/retrace.yml deleted file mode 100644 index e4a11684..00000000 --- a/.github/workflows/retrace.yml +++ /dev/null @@ -1,85 +0,0 @@ -name: Retrace - -on: - push: - branches: - - dev - - Feat/Backend-Direct-GLES - - Feat/Backend-Direct-Vulkan - workflow_dispatch: - -jobs: - retrace: - runs-on: ubuntu-latest - env: - TEST_ROOT: ${{github.workspace}} - - steps: - - name: Set Swap Space - uses: pierotofy/set-swap-space@master - with: - swap-size-gb: 32 - - - name: Checkout repo - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Get CMake - uses: lukka/get-cmake@latest - - - name: Prepare Vulkan SDK - uses: humbletim/setup-vulkan-sdk@v1.2.1 - with: - vulkan-query-version: 1.4.304.1 - vulkan-components: Vulkan-Headers, Vulkan-Loader - vulkan-use-cache: true - - - name: Update glslang external sources - working-directory: ${{env.TEST_ROOT}}/3rdparty/glslang - run: python update_glslang_sources.py - - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y clang-20 clang++-20 lld-20 libc++-20-dev libc++abi-20-dev libvulkan-dev libegl1-mesa-dev libgles2-mesa-dev libgl1-mesa-dri mesa-vulkan-drivers - - - name: Show installed toolchain - run: | - clang-20 --version - clang++-20 --version - ld.lld-20 --version || ld.lld --version || true - dpkg -l 'libc++*' 'libegl*' 'libgles*' 'mesa*' || true - - - name: Configure CMake - working-directory: ${{env.TEST_ROOT}} - run: | - if [ "${{ secrets.ACTIONS_STEP_DEBUG }}" == "true" ]; then - cmake -S . -B build-retrace -G Ninja -DCMAKE_C_COMPILER=clang-20 -DCMAKE_CXX_COMPILER=clang++-20 -DCMAKE_BUILD_TYPE=Debug -DMOBILEGL_BUILD_TEST=OFF -DMOBILEGL_BUILD_BENCHMARK=OFF -DMOBILEGL_BUILD_TRACE_REPLAY=ON -DCMAKE_POLICY_VERSION_MINIMUM=3.5 - else - cmake -S . -B build-retrace -G Ninja -DCMAKE_C_COMPILER=clang-20 -DCMAKE_CXX_COMPILER=clang++-20 -DCMAKE_BUILD_TYPE=Release -DMOBILEGL_BUILD_TEST=OFF -DMOBILEGL_BUILD_BENCHMARK=OFF -DMOBILEGL_BUILD_TRACE_REPLAY=ON -DCMAKE_POLICY_VERSION_MINIMUM=3.5 - fi - - - name: Build trace replay - working-directory: ${{env.TEST_ROOT}}/build-retrace - run: cmake --build . --target mobilegl_trace_replay - - - name: Retrace and validate Espryt (DirectGLES) - working-directory: ${{env.TEST_ROOT}}/build-retrace - run: ctest -V -R MobileGLTraceReplay.OpenRA.DirectGLES - - - name: Retrace and validate Magma (DirectVulkan) - working-directory: ${{env.TEST_ROOT}}/build-retrace - run: ctest -V -R MobileGLTraceReplay.OpenRA.DirectVulkan - - - name: Upload actual image - if: always() - uses: actions/upload-artifact@v4 - with: - name: OpenRA-retrace-actual - path: | - build-retrace/tools/trace_replay/openra/actual-images/openra-DirectGLES-actual.png - build-retrace/tools/trace_replay/openra/actual-images/openra-DirectVulkan-actual.png - build-retrace/tools/trace_replay/openra/actual-images/*.json - build-retrace/tools/trace_replay/openra/actual-images/*.log - if-no-files-found: warn diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index f43f1030..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: Test - -on: - push: - branches: - - dev - - Feat/Backend-Direct-GLES - - Feat/Backend-Direct-Vulkan - -jobs: - test: - runs-on: ubuntu-latest - env: - # TEST_ROOT: ${{github.workspace}}/MobileGL/MG_Test - TEST_ROOT: ${{github.workspace}} - - steps: - - name: Set Swap Space - uses: pierotofy/set-swap-space@master - with: - swap-size-gb: 32 - - - name: Checkout repo - uses: actions/checkout@v4 - with: - submodules: true - - - name: Get CMake - uses: lukka/get-cmake@latest - - - name: Prepare Vulkan SDK - uses: humbletim/setup-vulkan-sdk@v1.2.1 - with: - vulkan-query-version: 1.4.304.1 - vulkan-components: Vulkan-Headers, Vulkan-Loader - vulkan-use-cache: true - - - name: Update glslang external sources - working-directory: ${{env.TEST_ROOT}}/3rdparty/glslang - run: python update_glslang_sources.py - - - name: Install clang-20 - run: | - sudo apt-get update - sudo apt-get install -y clang-20 clang++-20 lld-20 libc++-20-dev libc++abi-20-dev libvulkan-dev - - - name: Show installed toolchain - run: | - clang-20 --version - clang++-20 --version - ld.lld-20 --version || ld.lld --version || true - dpkg -l 'libc++*' || true - - - name: Configure CMake - working-directory: ${{env.TEST_ROOT}} - run: | - if [ "${{ secrets.ACTIONS_STEP_DEBUG }}" == "true" ]; then - cmake -S . -B build-test -G Ninja -DCMAKE_C_COMPILER=clang-20 -DCMAKE_CXX_COMPILER=clang++-20 -DCMAKE_BUILD_TYPE=Debug -DMOBILEGL_BUILD_TEST=ON -DMOBILEGL_BUILD_BENCHMARK=OFF -DCMAKE_POLICY_VERSION_MINIMUM=3.5 - else - cmake -S . -B build-test -G Ninja -DCMAKE_C_COMPILER=clang-20 -DCMAKE_CXX_COMPILER=clang++-20 -DCMAKE_BUILD_TYPE=Release -DMOBILEGL_BUILD_TEST=ON -DMOBILEGL_BUILD_BENCHMARK=OFF -DCMAKE_POLICY_VERSION_MINIMUM=3.5 - fi - - - name: Build - working-directory: ${{env.TEST_ROOT}}/build-test - run: cmake --build . - - - name: Test - working-directory: ${{env.TEST_ROOT}}/build-test/MobileGL/MG_Test - run: | - if [ "${{ secrets.ACTIONS_STEP_DEBUG }}" == "true" ]; then - ctest -V - else - ctest - fi