update ci cd android toml #138
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
| name: cmake-desktop-multiplatform-workflow | |
| permissions: | |
| contents: read | |
| on: | |
| push: | |
| branches: [main] | |
| paths: &paths | |
| - "src/**" | |
| - "include/**" | |
| - "cmake/**" | |
| - "**/*.cmake" | |
| - "**/*.cpp" | |
| - "**/*.hpp" | |
| - "**/*.c" | |
| - "**/*.h" | |
| - "**/*.cxx" | |
| - "**/*.hxx" | |
| - "**/CMakeLists.txt" | |
| - "CMakePresets.json" | |
| - ".github/workflows/**" | |
| - "android-project/**" | |
| pull_request: | |
| branches: [main] | |
| paths: *paths | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| CPM_SOURCE_CACHE: ${{ github.workspace }}/.cpm_cache | |
| jobs: | |
| native: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| preset: clang-full | |
| artifact-name: linux-clang | |
| - os: ubuntu-latest | |
| preset: gcc-full | |
| artifact-name: linux-gcc | |
| - os: windows-latest | |
| preset: msvc-full | |
| artifact-name: windows-msvc | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: install linux deps | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -y --no-install-recommends \ | |
| libwayland-dev libxkbcommon-dev \ | |
| libegl1-mesa-dev libgles2-mesa-dev libgl1-mesa-dev \ | |
| libdbus-1-dev libudev-dev libasound2-dev \ | |
| ninja-build clang | |
| - uses: actions/cache@v4 | |
| with: | |
| path: .cpm_cache | |
| key: cpm-${{ matrix.artifact-name }}-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} | |
| restore-keys: cpm-${{ matrix.artifact-name }}- | |
| - name: build (${{ matrix.preset }}) | |
| run: cmake --workflow --preset ${{ matrix.preset }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact-name }}-zip | |
| path: build/**/*.zip | |
| if-no-files-found: ignore | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact-name }}-tgz | |
| path: build/**/*.tar.gz | |
| if-no-files-found: ignore | |
| cross-windows: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - preset: llvm-mingw-x86_64-full | |
| artifact-name: windows-mingw-x86_64 | |
| - preset: llvm-mingw-i686-full | |
| artifact-name: windows-mingw-i686 | |
| - preset: llvm-mingw-aarch64-full | |
| artifact-name: windows-mingw-aarch64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: install build tools | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -y --no-install-recommends ninja-build | |
| - uses: actions/cache@v4 | |
| with: | |
| path: | | |
| .llvm-mingw-cache | |
| llvm_mingw | |
| key: llvm-mingw-${{ hashFiles('cmake/toolchains/llvm_mingw.cmake') }} | |
| - uses: actions/cache@v4 | |
| with: | |
| path: .cpm_cache | |
| key: cpm-${{ matrix.artifact-name }}-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} | |
| restore-keys: cpm-${{ matrix.artifact-name }}- | |
| - name: build (${{ matrix.preset }}) | |
| run: cmake --workflow --preset ${{ matrix.preset }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact-name }}-txz | |
| path: build/**/*.tar.xz | |
| if-no-files-found: ignore | |
| build-apk: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - build-type: debug | |
| gradle-task: assembleDebug | |
| abi: x86_64 | |
| # - build-type: debug | |
| # gradle-task: assembleDebug | |
| # abi: arm64-v8a | |
| # - build-type: release | |
| # gradle-task: assembleRelease | |
| # abi: arm64-v8a | |
| env: | |
| ANDROID_PROJECT_DIR: android-project | |
| GRADLE_OPTS: >- | |
| -Dorg.gradle.daemon=false | |
| -Dorg.gradle.parallel=true | |
| -Dorg.gradle.configureondemand=true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| java-version: "17" | |
| distribution: temurin | |
| cache: gradle | |
| - uses: actions/cache@v4 | |
| with: | |
| path: .cpm_cache | |
| key: cpm-android-${{ matrix.abi }}-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} | |
| restore-keys: cpm-android-${{ matrix.abi }}- | |
| - name: build apk (${{ matrix.abi }} ${{ matrix.build-type }}) | |
| working-directory: ${{ env.ANDROID_PROJECT_DIR }} | |
| run: | | |
| chmod +x gradlew | |
| ./gradlew --stacktrace \ | |
| :app:${{ matrix.gradle-task }} \ | |
| -Pandroid.injected.build.abi=${{ matrix.abi }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: android-${{ matrix.abi }}-${{ matrix.build-type }}-apk | |
| path: ${{ env.ANDROID_PROJECT_DIR }}/app/build/outputs/apk/**/*.apk |