name: Test Erlang Git Master
on:
  schedule:
  - cron: '0 2 * * *'
  workflow_dispatch:
jobs:
  test-erlang-git:
    name: Test (Erlang Git Master)
    runs-on: ubuntu-22.04
    timeout-minutes: 120
    steps:
    - name: CHECKOUT REPOSITORY
      uses: actions/checkout@v4
    - name: CONFIGURE BAZEL
      run: |
        if [ -n "${{ secrets.BUILDBUDDY_API_KEY }}" ]; then
        cat << EOF >> user.bazelrc
          build:buildbuddy --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_API_KEY }}
        EOF
        fi
        cat << EOF >> user.bazelrc
          build:buildbuddy --build_metadata=ROLE=CI
          build:buildbuddy --build_metadata=VISIBILITY=PUBLIC
          build:buildbuddy --color=yes

          build:rbe --platforms=//bazel/platforms:erlang_linux_git_master_platform
        EOF

        bazelisk info release
    #! - name: Setup tmate session
    #!   uses: mxschmitt/action-tmate@v3
    - name: RUN TESTS
      run: |
        sudo sysctl -w net.ipv4.tcp_keepalive_time=60
        sudo ethtool -K eth0 tso off gso off gro off tx off rx off lro off
        bazelisk test //... \
          --config=rbe \
          --test_tag_filters=-mixed-version-cluster,-aws,-docker \
          --build_tests_only \
          --verbose_failures
