name: tests

on:
  pull_request:

  push:
    branches:
      - main
  
  schedule:
    - cron:  '0 0 * * *'

  workflow_dispatch:

permissions:
  contents: none

jobs:

  compatibility:
    strategy:
      fail-fast: false
      matrix:
        go-version: [oldstable, stable]
        platform: [ubuntu-latest, macos-latest, windows-latest, ubuntu-24.04-arm]

    runs-on: ${{ matrix.platform }}
    steps:
      - name: Checkout
        uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
      - name: Setup Go
        uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
        with:
          go-version: ${{ matrix.go-version }}
      - name: Run Tests
        run: make test
      - run: make bench

  tests:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
      - name: Setup Go
        uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
        with:
          go-version: stable
      - name: Run benchmarks
        run: make bench
      - name: Run fuzzers
        env:
          # Run for 2 minutes to ensure it is working. Long runs happens nightly.
          FUZZ_TIME: 2m
        run: make fuzz
