name: Endurance Test
on:
  push:
    branches: [ master ]
    tags:
      - v*
  schedule:
    # run every 2 hours
    - cron:  '12 */2 * * *'
concurrency: 
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
jobs:
  endurance-test:
    env:
      KOPIA_KEEP_LOGS: true
    name: Endurance Test
    if: ${{ github.repository == 'kopia/kopia' }}
    runs-on: ubuntu-latest
    steps:
    - name: Check out repository
      uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
      with:
        fetch-depth: 0
    - name: Set up Go
      uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
      with:
        go-version-file: 'go.mod'
        check-latest: true
      id: go
    - name: Endurance Tests
      run: make endurance-tests
    - name: Upload Logs
      uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
      with:
        name: logs
        path: .logs/**/*.log
        if-no-files-found: ignore
      if: ${{ always() }}