| name: Build-Test-Upload |
| |
| on: |
| push: |
| branches: [ master ] |
| pull_request: |
| branches: [ master ] |
| schedule: |
| - cron: 0 6 * * 1 # Each Monday at 06:00 UTC |
| |
| defaults: |
| run: |
| shell: bash |
| |
| permissions: |
| contents: read |
| |
| concurrency: |
| group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} |
| |
| jobs: |
| build: |
| if: ${{ !contains(github.event.pull_request.labels.*.name, 'CI:none') }} |
| runs-on: ${{ matrix.os || 'ubuntu-latest' }} |
| strategy: |
| fail-fast: false |
| matrix: |
| include: |
| - name: cmake:clang |
| mode: cmake |
| env: CC=/usr/bin/clang CXX=/usr/bin/clang++ |
| |
| - name: cmake:clang-arm |
| mode: cmake |
| env: CC=/usr/bin/clang CXX=/usr/bin/clang++ |
| os: ubuntu-26.04-arm |
| |
| - name: cmake:gcc |
| mode: cmake |
| env: CC=/usr/bin/gcc CXX=/usr/bin/g++ |
| |
| - name: cmake:gcc-arm |
| mode: cmake |
| env: CC=/usr/bin/gcc CXX=/usr/bin/g++ |
| os: ubuntu-26.04-arm |
| |
| - name: cmake:android:arm64-v8a |
| mode: cmake |
| cmake_params: >- |
| -DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK/build/cmake/android.toolchain.cmake" |
| -DANDROID_ABI=arm64-v8a |
| -DANDROID_NATIVE_API_LEVEL=25 |
| -DBUILD_TESTING=off |
| |
| - name: cmake:wasm |
| mode: cmake |
| wasm: true |
| # TODO(eustas): enable tests |
| cmake_params: >- |
| -DCMAKE_TOOLCHAIN_FILE="$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake" |
| -DBUILD_TESTING=off |
| env: emcmake |
| |
| - name: cmake:win:default |
| mode: cmake |
| upload_artifacts: true |
| os: windows-latest |
| |
| - name: cmake:osx:default |
| mode: cmake |
| os: macos-latest |
| |
| - name: bazel |
| mode: bazel |
| |
| env: |
| EM_VERSION: 6.0.2 |
| NODE_VERSION: 26 |
| |
| steps: |
| - name: Checkout |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| with: |
| submodules: recursive |
| persist-credentials: false |
| |
| - name: Install node |
| if: ${{ matrix.wasm }} |
| uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 |
| with: |
| node-version: ${{env.NODE_VERSION}} |
| |
| - name: Get non-EMSDK node path |
| if: ${{ matrix.wasm }} |
| run: which node >> $HOME/.base_node_path |
| |
| - name: Install emsdk |
| if: ${{ matrix.wasm }} |
| uses: mymindstorm/setup-emsdk@6ab9eb1bda2574c4ddb79809fc9247783eaf9021 # v14 |
| # TODO(eustas): We could cache this action but it doesn't work when running |
| # in a matrix. |
| with: |
| version: ${{env.EM_VERSION}} |
| no-cache: true |
| |
| - name: Set EMSDK node version |
| if: ${{ matrix.wasm }} |
| run: | |
| echo "NODE_JS='$(cat $HOME/.base_node_path)'" >> $EMSDK/.emscripten |
| emsdk construct_env |
| |
| - name: Configure @ CMake |
| if: ${{ matrix.mode == 'cmake' }} |
| run: ${{ matrix.env }} cmake -DCMAKE_BUILD_TYPE=Release ${{ matrix.cmake_params }} -B out |
| |
| - name: Build @ CMake |
| if: ${{ matrix.mode == 'cmake' }} |
| run: cmake --build out --config Release -j 2 |
| |
| - name: Test @ CMake |
| if: ${{ matrix.mode == 'cmake' }} |
| run: cd out && ctest -j 2 |
| |
| - name: Build @ Bazel |
| if: ${{ matrix.mode == 'bazel' }} |
| run: | |
| bazelisk build -c opt :all |
| cd java |
| bazelisk build -c opt ...:all |
| |
| - name: Test @ Bazel |
| if: ${{ matrix.mode == 'bazel' }} |
| run: | |
| bazelisk test -c opt :all |
| cd java |
| bazelisk test -c opt ...:all |
| |
| - name: upload |
| if: ${{ matrix.upload_artifacts }} |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| with: |
| name: ${{ matrix.os }} |
| path: out/artifacts |