|
| 1 | +name: Test |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - '*' |
| 7 | + - '*/**' |
| 8 | + paths-ignore: |
| 9 | + - 'README.md' |
| 10 | + - '.gitignore' |
| 11 | + - 'LICENSE' |
| 12 | + - '.github/workflows/publish.yml' |
| 13 | + |
| 14 | +env: |
| 15 | + BUILD_TYPE: Release |
| 16 | + NDK_VER: 21.3.6528147 |
| 17 | + NDK_ARCH: x86_64 |
| 18 | + NDK_API: 29 |
| 19 | + |
| 20 | +jobs: |
| 21 | + desktop: |
| 22 | + runs-on: ${{ matrix.os }} |
| 23 | + strategy: |
| 24 | + fail-fast: false |
| 25 | + matrix: |
| 26 | + include: |
| 27 | + - os: macos-latest |
| 28 | + java: '8' |
| 29 | + - os: macos-latest |
| 30 | + java: '11' |
| 31 | + - os: macos-latest |
| 32 | + java: '17' |
| 33 | + - os: macos-latest |
| 34 | + java: '21' |
| 35 | + - os: windows-latest |
| 36 | + java: '8' |
| 37 | + - os: windows-latest |
| 38 | + java: '11' |
| 39 | + - os: windows-latest |
| 40 | + java: '17' |
| 41 | + - os: windows-latest |
| 42 | + java: '21' |
| 43 | + - os: ubuntu-latest |
| 44 | + java: '8' |
| 45 | + compiler: 'gcc-11|g++-11' |
| 46 | + - os: ubuntu-latest |
| 47 | + java: '8' |
| 48 | + compiler: 'gcc-12|g++-12' |
| 49 | + - os: ubuntu-latest |
| 50 | + java: '8' |
| 51 | + compiler: 'gcc-13|g++-13' |
| 52 | + - os: ubuntu-latest |
| 53 | + java: '8' |
| 54 | + compiler: 'clang-13|clang++-13' |
| 55 | + - os: ubuntu-latest |
| 56 | + java: '8' |
| 57 | + compiler: 'clang-14|clang++-14' |
| 58 | + - os: ubuntu-latest |
| 59 | + java: '8' |
| 60 | + compiler: 'clang-15|clang++-15' |
| 61 | + - os: ubuntu-latest |
| 62 | + java: '17' |
| 63 | + compiler: 'gcc-11|g++-11' |
| 64 | + - os: ubuntu-latest |
| 65 | + java: '17' |
| 66 | + compiler: 'gcc-12|g++-12' |
| 67 | + - os: ubuntu-latest |
| 68 | + java: '17' |
| 69 | + compiler: 'gcc-13|g++-13' |
| 70 | + - os: ubuntu-latest |
| 71 | + java: '17' |
| 72 | + compiler: 'clang-13|clang++-13' |
| 73 | + - os: ubuntu-latest |
| 74 | + java: '17' |
| 75 | + compiler: 'clang-14|clang++-14' |
| 76 | + - os: ubuntu-latest |
| 77 | + java: '17' |
| 78 | + compiler: 'clang-15|clang++-15' |
| 79 | + - os: ubuntu-latest |
| 80 | + java: '21' |
| 81 | + compiler: 'gcc-11|g++-11' |
| 82 | + - os: ubuntu-latest |
| 83 | + java: '21' |
| 84 | + compiler: 'gcc-12|g++-12' |
| 85 | + - os: ubuntu-latest |
| 86 | + java: '21' |
| 87 | + compiler: 'gcc-13|g++-13' |
| 88 | + - os: ubuntu-latest |
| 89 | + java: '21' |
| 90 | + compiler: 'clang-13|clang++-13' |
| 91 | + - os: ubuntu-latest |
| 92 | + java: '21' |
| 93 | + compiler: 'clang-14|clang++-14' |
| 94 | + - os: ubuntu-latest |
| 95 | + java: '21' |
| 96 | + compiler: 'clang-15|clang++-15' |
| 97 | + |
| 98 | + steps: |
| 99 | + - uses: actions/checkout@v3 |
| 100 | + |
| 101 | + - name: System Setup |
| 102 | + shell: bash |
| 103 | + run: | |
| 104 | + if [[ '${{ matrix.os }}' == 'ubuntu-latest' ]]; then |
| 105 | + if [[ '${{ matrix.compiler}}' == 'clang-15|clang++-15' ]]; then |
| 106 | + sudo apt-get update |
| 107 | + sudo apt-get install -y clang-15 clang++-15 |
| 108 | + fi |
| 109 | +
|
| 110 | + if [[ '${{ matrix.compiler }}' == 'gcc-12|g++-12' ]]; then |
| 111 | + sudo apt-get update |
| 112 | + sudo apt-get install -y gcc-12 g++-12 |
| 113 | + fi |
| 114 | +
|
| 115 | + if [[ '${{ matrix.compiler }}' == 'gcc-13|g++-13' ]]; then |
| 116 | + sudo apt-get update |
| 117 | + sudo apt-get install -y gcc-13 g++-13 |
| 118 | + fi |
| 119 | + fi |
| 120 | +
|
| 121 | + - name: Set up JDK |
| 122 | + uses: actions/setup-java@v3 |
| 123 | + with: |
| 124 | + java-version: | |
| 125 | + 8 |
| 126 | + ${{ matrix.java }} |
| 127 | + distribution: 'temurin' |
| 128 | + |
| 129 | + - name: Configure CMake |
| 130 | + shell: bash |
| 131 | + run: | |
| 132 | + if [[ '${{ matrix.compiler }}' != '' ]]; then |
| 133 | + IFS='|' read -ra COMPILER <<< '${{ matrix.compiler }}' |
| 134 | + export CC=${COMPILER[0]} |
| 135 | + export CXX=${COMPILER[1]} |
| 136 | + fi |
| 137 | + cmake -S . -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE |
| 138 | +
|
| 139 | + - name: Build and Test Native |
| 140 | + shell: bash |
| 141 | + run: cmake --build build --config $BUILD_TYPE --target run-jar |
| 142 | + |
| 143 | + - name: Build and Test JniGen |
| 144 | + shell: bash |
| 145 | + run: cmake --build build --config $BUILD_TYPE --target test-jnigen |
| 146 | + |
| 147 | + android: |
| 148 | + runs-on: macos-latest |
| 149 | + |
| 150 | + steps: |
| 151 | + - name: Checkout |
| 152 | + uses: actions/checkout@v3 |
| 153 | + |
| 154 | + - name: Set up JDK |
| 155 | + uses: actions/setup-java@v3 |
| 156 | + with: |
| 157 | + java-version: 17 |
| 158 | + distribution: 'temurin' |
| 159 | + |
| 160 | + - name: AVD cache |
| 161 | + uses: actions/cache@v3 |
| 162 | + id: avd-cache |
| 163 | + with: |
| 164 | + path: | |
| 165 | + ~/.android/avd/* |
| 166 | + ~/.android/adb* |
| 167 | + key: avd-${{env.NDK_VER}}-${{env.NDK_ARCH}}-${{env.NDK_API}} |
| 168 | + |
| 169 | + - name: Create AVD and generate snapshot for caching |
| 170 | + if: steps.avd-cache.outputs.cache-hit != 'true' |
| 171 | + uses: reactivecircus/android-emulator-runner@v2 |
| 172 | + with: |
| 173 | + api-level: ${{env.NDK_API}} |
| 174 | + arch: ${{env.NDK_ARCH}} |
| 175 | + target: google_apis |
| 176 | + ndk: ${{env.NDK_VER}} |
| 177 | + sdcard-path-or-size: 1000M |
| 178 | + force-avd-creation: false |
| 179 | + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none |
| 180 | + disable-animations: false |
| 181 | + script: echo "Generated AVD snapshot for caching." |
| 182 | + |
| 183 | + - name: Configure, Build and Test |
| 184 | + uses: reactivecircus/android-emulator-runner@v2 |
| 185 | + with: |
| 186 | + api-level: ${{env.NDK_API}} |
| 187 | + arch: ${{env.NDK_ARCH}} |
| 188 | + target: google_apis |
| 189 | + ndk: ${{env.NDK_VER}} |
| 190 | + sdcard-path-or-size: 1000M |
| 191 | + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none |
| 192 | + disable-animations: true |
| 193 | + script: | |
| 194 | + echo "::group::Configure" |
| 195 | + cmake -S . -B build -DCMAKE_BUILD_TYPE:STRING=$BUILD_TYPE -DCMAKE_TOOLCHAIN_FILE:FILEPATH=$ANDROID_SDK_ROOT/ndk/$NDK_VER/build/cmake/android.toolchain.cmake -DANDROID_ABI:STRING=$NDK_ARCH -DANDROID_PLATFORM:STRING=19 -DANDROID_STL:STRING=c++_static |
| 196 | + echo "::endgroup::" |
| 197 | + echo "::group::Build and Test Native" |
| 198 | + cmake --build build --config $BUILD_TYPE --target run-dex |
| 199 | + echo "::endgroup::" |
| 200 | + echo "::group::Build and Test JniGen" |
| 201 | + cmake --build build --config $BUILD_TYPE --target test-jnigen |
| 202 | + echo "::endgroup::" |
| 203 | +
|
| 204 | + |
| 205 | + |
| 206 | + |
| 207 | + |
0 commit comments