# Licensed to the Apache Software Foundation (ASF) under one or more
# license agreements; and to You under the Apache License, version 2.0:
#
#   https://www.apache.org/licenses/LICENSE-2.0
#
# This file is part of the Apache Pekko project, which was derived from Akka.
#

name: Nightly Aeron Tests

on:
  schedule:
    - cron: "0 0 * * *"
  workflow_dispatch:

permissions: {}

jobs:

  pekko-artery-aeron-tests:
    name: Pekko Artery Aeron Tests
    runs-on: ubuntu-22.04
    if: github.repository == 'apache/pekko'
    strategy:
      fail-fast: false
      matrix:
        command:
          - remote/test remote-tests/test
          - cluster/test cluster-typed/test
    steps:
      - name: Checkout
        uses: actions/checkout@v5
        with:
          # we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves
          fetch-depth: 0
          fetch-tags: true

      - name: Setup Java 17
        uses: actions/setup-java@v5
        with:
          distribution: temurin
          java-version: 17

      - name: Install sbt
        uses: sbt/setup-sbt@17575ea4e18dd928fe5968dbe32294b97923d65b # v1.1.13

      - name: Cache Coursier cache
        uses: coursier/cache-action@4e2615869d13561d626ed48655e1a39e5b192b3c # v6.4.7

      - name: Enable jvm-opts
        run: cp .jvmopts-ci .jvmopts

      - name: sbt ${{ matrix.command }}
        env:
          DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
        # note that this is not running any multi-jvm tests because multi-in-test=false
        run: |-
          sbt \
          -Djava.security.egd=file:/dev/./urandom \
          -Dpekko.remote.artery.transport=aeron-udp \
          -Dpekko.test.timefactor=2 \
          -Dpekko.actor.testkit.typed.timefactor=2 \
          -Dpekko.test.tags.exclude=gh-exclude,gh-exclude-aeron,timing \
          -Dpekko.test.multi-in-test=false \
          -Dpekko.cluster.assert=on \
          -Dio.netty.leakDetection.level=PARANOID \
          -Daeron.dir=/opt/volumes/media-driver \
          -Daeron.term.buffer.length=33554432 \
          clean ${{ matrix.command }}
