From f6f84267b67ba6f6015ad82eb07e6736b3c6eb4e Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Sat, 7 Feb 2026 18:50:18 +0800 Subject: [PATCH] [Feat] (workflow): merge two workflows --- .github/workflows/build.yml | 136 ++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..65fa8487 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,136 @@ +name: Build-Test-Benchmark + +on: + push: + branches: + - dev + - Feat/Backend-Direct-GLES + +jobs: + build: + runs-on: ubuntu-latest + env: + BUILD_ROOT: ${{github.workspace}} + BUILD_TYPE: ${{ secrets.ACTIONS_STEP_DEBUG == 'true' && 'Debug' || 'Release' }} + + 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: Update glslang external sources + working-directory: ${{env.BUILD_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 + + - 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.BUILD_ROOT}} + run: | + cmake -S . -B build-ci -G Ninja -DCMAKE_C_COMPILER=clang-20 -DCMAKE_CXX_COMPILER=clang++-20 -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON -DBENCHMARK_ENABLE_TESTING=OFF -DMOBILEGL_BUILD_TEST=ON -DMOBILEGL_BUILD_BENCHMARK=ON -DCMAKE_POLICY_VERSION_MINIMUM=3.5 + + - name: Build + working-directory: ${{env.BUILD_ROOT}}/build-ci + run: cmake --build . + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: build-ci + path: ${{env.BUILD_ROOT}}/build-ci + + test: + runs-on: ubuntu-latest + needs: build + env: + TEST_ROOT: ${{github.workspace}} + BUILD_TYPE: ${{ secrets.ACTIONS_STEP_DEBUG == 'true' && 'Debug' || 'Release' }} + + 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: 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 + + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + name: build-ci + path: ${{env.TEST_ROOT}}/build-ci + + - name: Test + working-directory: ${{env.TEST_ROOT}}/build-ci/MobileGL/MG_Test + run: | + if [ "${{ secrets.ACTIONS_STEP_DEBUG }}" == "true" ]; then + ctest -V + else + ctest + fi + + benchmark: + runs-on: ubuntu-latest + needs: build + env: + BENCH_ROOT: ${{github.workspace}} + BUILD_TYPE: ${{ secrets.ACTIONS_STEP_DEBUG == 'true' && 'Debug' || 'Release' }} + + 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: 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 + + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + name: build-ci + path: ${{env.BENCH_ROOT}}/build-ci + + - name: Benchmark + working-directory: ${{env.BENCH_ROOT}}/build-ci/MobileGL/MG_Benchmark + run: ctest -V -C ${{env.BUILD_TYPE}}