name: Sims Nightly (Long)
# Release Sims workflow runs long-lived (multi-seed & large block size) simulations
# This workflow only runs mightly at 8am UTC and on releases
on:
  schedule:
    - cron: "0 8 * * *"
  release:
    types: [published]

permissions:
  contents: read

concurrency:
  group: ci-${{ github.ref }}-sims-nightly-long
  cancel-in-progress: true

jobs:
  test-sim-multi-seed-long:
    runs-on: depot-ubuntu-22.04-4
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-go@v7
        with:
          go-version-file: "go.mod"
      - name: test-sim-multi-seed-long
        env:
          GOMEMLIMIT: 14GiB # reserve 2 GiB as buffer for GC to avoid OOM
        run: |
          make test-sim-multi-seed-long

  test-sim-import-export:
    runs-on: depot-ubuntu-22.04-4
    timeout-minutes: 60
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-go@v7
        with:
          go-version-file: "go.mod"
      - name: test-sim-import-export
        env:
          GOMEMLIMIT: 14GiB # reserve 2 GiB as buffer for GC to avoid OOM
        run: |
          make test-sim-import-export

  sims-notify-failure:
    permissions:
      contents: none
    needs: [test-sim-multi-seed-long]
    runs-on: depot-ubuntu-22.04-4
    if: ${{ failure() }}
    steps:
      - name: Notify Slack on failure
        uses: rtCamp/action-slack-notify@33ca3be66c6f378fe1610fd1d5258632dbed5e58 # v2.4.0
        env:
          SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
          SLACK_CHANNEL: sdk-sims
          SLACK_USERNAME: Sim Tests
          SLACK_ICON_EMOJI: ":skull:"
          SLACK_COLOR: danger
          SLACK_MESSAGE: Sims Nightly (Long) are failing
          SLACK_FOOTER: ""
