name: "Nightly test"
on:
  schedule:
    - cron: '0 11 * * *'

jobs:
  run-uftrace-tests:
    if: github.repository == 'namhyung/uftrace'
    strategy:
      max-parallel: 1
      matrix:
        os: [ubuntu-24.04, ubuntu-22.04]
    runs-on: ${{ matrix.os }}
    steps:
      - name: "checkout"
        uses: actions/checkout@v4

      - name: "install dependencies"
        run: sudo ./misc/install-deps.sh -y

      - name: "configure build env"
        run: ./configure

      - name: "build the source"
        run: make DEBUG=1

      - name: "setup run-time env"
        run: |
          sudo sh -c "echo 1 > /proc/sys/kernel/perf_event_paranoid"
          sudo sh -c "echo 0 > /proc/sys/kernel/kptr_restrict"
          sudo sh -c "chmod +x /sys/kernel/tracing"

      - name: "run tests"
        run: make test -j1 TESTARG='--color on' RUNTESTARG='--quiet'
