Skip to content

Test externally

Test externally #1559

name: Test externally
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
test_externally:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
bazel: [6.x, 7.x, last_green]
bazel_mode: [workspace, module]
os: [ubuntu-latest, macos-13, macos-latest, windows-2019]
jdk: [8, 11, 17, 21]
exclude:
- bazel: 6.x
jdk: 11
- bazel: 6.x
jdk: 17
- bazel: 6.x
bazel_mode: module
- bazel: last_green
jdk: 8
- bazel: last_green
jdk: 11
- bazel: last_green
jdk: 17
- bazel_mode: workspace
jdk: 17
- bazel_mode: workspace
jdk: 21
include:
- os: ubuntu-latest
cache: "/home/runner/.cache/bazel-disk"
- os: macos-13
cache: "/private/var/tmp/bazel-disk"
- os: macos-latest
cache: "/private/var/tmp/bazel-disk"
- os: windows-2019
cache: "C:\\tmp\\bazel-disk"
- bazel_mode: module
bazel_extra_args: "--config=bzlmod"
- bazel_mode: workspace
bazel_extra_args: "--config=workspace"
name: Test externally (${{ matrix.os }}, Bazel ${{ matrix.bazel }} ${{ matrix.bazel_mode }}, JDK ${{ matrix.jdk }})
env:
BAZELISK_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ matrix.jdk }}
- name: Mount Bazel disk cache
uses: actions/cache@v4
with:
path: ${{ matrix.cache }}
key: bazel-disk-cache-${{ matrix.bazel }}-${{ matrix.os }}-${{ matrix.jdk }}
- name: Clear WORKSPACE
if: matrix.bazel_mode == 'module'
working-directory: ./tests
run: echo 'workspace(name = "fmeum_rules_jni_tests")' > WORKSPACE
- name: Run tests externally
env:
USE_BAZEL_VERSION: ${{ matrix.bazel }}
working-directory: ./tests
run: bazelisk test --config=ci --disk_cache=${{ matrix.cache }} --profile=${{ github.workspace }}/profile.gz ${{ matrix.bazel_extra_args }} //... @fmeum_rules_jni//jni/...
- name: Check coverage
if: ${{ (matrix.os == 'ubuntu-latest') && (matrix.jdk == '8' || matrix.jdk == '21') }}
env:
USE_BAZEL_VERSION: ${{ matrix.bazel }}
working-directory: ./tests
run: |
sudo apt install clang-14 llvm-14
bazelisk coverage --config=ci --disk_cache=${{ matrix.cache }} --profile=${{ github.workspace }}/profile.gz ${{ matrix.bazel_extra_args }} //...
./verify_coverage.sh