name: Backend Live Tests
on: [pull_request, workflow_dispatch]
permissions:
  contents: read
  issues: none
  pull-requests: none
concurrency:
  group: duplicati-ci-livetests
  cancel-in-progress: false
jobs:
  check_secrets:
    runs-on: ubuntu-latest
    outputs:
      s3_secrets_available: "${{ steps.check_s3.outputs.available }}"
      dropbox_secrets_available: "${{ steps.check_dropbox.outputs.available }}"
      azure_secrets_available: "${{ steps.check_azure.outputs.available }}"
      testcontainers_secrets_available: "${{ steps.check_testcontainers.outputs.available }}"
      google_secrets_available: "${{ steps.check_google.outputs.available }}"
      pcloud_secrets_available: "${{ steps.check_pcloud.outputs.available }}"
      b2_secrets_available: "${{ steps.check_b2.outputs.available }}"
      box_secrets_available: "${{ steps.check_box.outputs.available }}"
      filen_secrets_available: "${{ steps.check_filen.outputs.available }}"
      filejump_secrets_available: "${{ steps.check_filejump.outputs.available }}"
      onedrive_secrets_available: "${{ steps.check_onedrive.outputs.available }}"
      idrivee2_secrets_available: "${{ steps.check_idrivee2.outputs.available }}"
      gcs_secrets_available: "${{ steps.check_gcs.outputs.available }}"
      cloudstack_secrets_available: "${{ steps.check_cloudstack.outputs.available }}"
    steps:
      - id: check_pcloud
        name: Check pCloud secrets
        shell: bash
        run: |
          echo "Starting pCloud secrets check..."
          if [[ -n "${{ secrets.TESTCREDENTIAL_PCLOUD_SERVER }}" ]] && \
            [[ -n "${{ secrets.TESTCREDENTIAL_PCLOUD_TOKEN }}" ]] && \
            [[ -n "${{ secrets.TESTCREDENTIAL_PCLOUD_FOLDER }}" ]]; then
            echo "All pCloud secrets found"
            echo "available=true" >> $GITHUB_OUTPUT
          else
            echo "Missing some pCloud secrets"
            echo "available=false" >> $GITHUB_OUTPUT
          fi
          echo "pCloud check completed"
      - id: check_s3
        name: Check S3 secrets
        shell: bash
        run: |
          echo "Starting S3 secrets check..."
          if [[ -n "${{ secrets.TESTCREDENTIAL_S3_BUCKETNAME }}" ]] && \
            [[ -n "${{ secrets.TESTCREDENTIAL_S3_KEY }}" ]] && \
            [[ -n "${{ secrets.TESTCREDENTIAL_S3_REGION }}" ]] && \
            [[ -n "${{ secrets.TESTCREDENTIAL_S3_SECRET }}" ]]; then
            echo "All S3 secrets found"
            echo "available=true" >> $GITHUB_OUTPUT
          else
            echo "Missing some S3 secrets"
            echo "available=false" >> $GITHUB_OUTPUT
          fi
          echo "S3 check completed"
      - id: check_dropbox
        name: Check Dropbox secrets
        shell: bash
        run: |
          echo "Starting Dropbox secrets check..."
          if [[ -n "${{ secrets.TESTCREDENTIAL_DROPBOX_FOLDER }}" ]] && \
            [[ -n "${{ secrets.TESTCREDENTIAL_DROPBOX_TOKEN }}" ]]; then
            echo "All Dropbox secrets found"
            echo "available=true" >> $GITHUB_OUTPUT
          else
            echo "Missing some Dropbox secrets"
            echo "available=false" >> $GITHUB_OUTPUT
          fi
          echo "Dropbox check completed"
      - id: check_azure
        name: Check Azure secrets
        shell: bash
        run: |
          echo "Starting Azure secrets check..."
          if [[ -n "${{ secrets.TESTCREDENTIAL_AZURE_ACCOUNTNAME }}" ]] && \
            [[ -n "${{ secrets.TESTCREDENTIAL_AZURE_ACCESSKEY }}" ]] && \
            [[ -n "${{ secrets.TESTCREDENTIAL_AZURE_CONTAINERNAME }}" ]]; then
            echo "All Azure secrets found"
            echo "available=true" >> $GITHUB_OUTPUT
          else
            echo "Missing some Azure secrets"
            echo "available=false" >> $GITHUB_OUTPUT
          fi
          echo "Azure check completed"
      - id: check_testcontainers
        name: Check TestContainers secret
        shell: bash
        run: |
          echo "Starting TestContainers secrets check..."
          if [[ -n "${{ secrets.TC_CLOUD_TOKEN }}" ]]; then
            echo "All TestContainers secrets found"
            echo "available=true" >> $GITHUB_OUTPUT
          else
            echo "Missing TestContainers token"
            echo "available=false" >> $GITHUB_OUTPUT
          fi
          echo "Testcontainers check completed"

      - id: check_google
        name: Check Google secrets
        shell: bash
        run: |
          echo "Starting Google secrets check..."
          if [[ -n "${{ secrets.TESTCREDENTIAL_GOOGLEDRIVE_TOKEN }}" ]] && \
            [[ -n "${{ secrets.TESTCREDENTIAL_GOOGLEDRIVE_FOLDER }}" ]]; then
            echo "All Google secrets found"
            echo "available=true" >> $GITHUB_OUTPUT
          else
            echo "Missing some Google secrets"
            echo "available=false" >> $GITHUB_OUTPUT
          fi
          echo "Google check completed"

      - id: check_b2
        name: Check B2 secrets
        shell: bash
        run: |
          echo "Starting B2 secrets check..."
          if [[ -n "${{ secrets.TESTCREDENTIAL_B2_BUCKET }}" ]] && \
             [[ -n "${{ secrets.TESTCREDENTIAL_B2_FOLDER }}" ]] && \
             [[ -n "${{ secrets.TESTCREDENTIAL_B2_USERNAME }}" ]] && \
             [[ -n "${{ secrets.TESTCREDENTIAL_B2_PASSWORD }}" ]]; then
            echo "All B2 secrets found"
            echo "available=true" >> $GITHUB_OUTPUT
          else
            echo "Missing some B2 secrets"
            echo "available=false" >> $GITHUB_OUTPUT
          fi
          echo "B2 check completed"
      - id: check_box
        name: Check Box.com secrets
        shell: bash
        run: |
          echo "Starting Box.com secrets check..."
          if [[ -n "${{ secrets.TESTCREDENTIAL_BOX_FOLDER }}" ]] && \
              [[ -n "${{ secrets.TESTCREDENTIAL_BOX_AUTHID }}" ]]; then
            echo "All Box.com secrets found"
            echo "available=true" >> $GITHUB_OUTPUT
          else
            echo "Missing some Box.com secrets"
            echo "available=false" >> $GITHUB_OUTPUT
          fi
          echo "Box.com check completed"
      - id: check_filen
        name: Check Filen.io secrets
        shell: bash
        run: |
          echo "Starting Filen.io secrets check..."
          if [[ -n "${{ secrets.TESTCREDENTIAL_FILEN_FOLDER }}" ]] && \
             [[ -n "${{ secrets.TESTCREDENTIAL_FILEN_USERNAME }}" ]] && \
             [[ -n "${{ secrets.TESTCREDENTIAL_FILEN_PASSWORD }}" ]]; then
            echo "All Filen.io secrets found"
            echo "available=true" >> $GITHUB_OUTPUT
          else
            echo "Missing some Filen.io secrets"
            echo "available=false" >> $GITHUB_OUTPUT
          fi
          echo "Filen.io check completed"
      - id: check_filejump
        name: Check Filejump secrets
        shell: bash
        run: |
          echo "Starting Filejump secrets check..."
          if [[ -n "${{ secrets.TESTCREDENTIAL_FILEJUMP_FOLDER }}" ]] && \
             [[ -n "${{ secrets.TESTCREDENTIAL_FILEJUMP_TOKEN }}" ]]; then
            echo "All Filejump secrets found"
            echo "available=true" >> $GITHUB_OUTPUT
          else
            echo "Missing some Filejump secrets"
            echo "available=false" >> $GITHUB_OUTPUT
          fi
          echo "Filejump check completed"
      - id: check_onedrive
        name: Check OneDrive secrets
        shell: bash
        run: |
          echo "Starting OneDrive secrets check..."
          if [[ -n "${{ secrets.TESTCREDENTIAL_ONEDRIVE_FOLDER }}" ]] && \
             [[ -n "${{ secrets.TESTCREDENTIAL_ONEDRIVE_AUTHID }}" ]]; then
            echo "All OneDrive secrets found"
            echo "available=true" >> $GITHUB_OUTPUT
          else
            echo "Missing some OneDrive secrets"
            echo "available=false" >> $GITHUB_OUTPUT
          fi
          echo "OneDrive check completed"
      - id: check_idrivee2
        name: Check iDrivee2 secrets
        shell: bash
        run: |
          echo "Starting iDrivee2 secrets check..."
          if [[ -n "${{ secrets.TESTCREDENTIAL_IDRIVEE2_BUCKET }}" ]] && \
             [[ -n "${{ secrets.TESTCREDENTIAL_IDRIVEE2_ACCESS_KEY }}" ]] && \
             [[ -n "${{ secrets.TESTCREDENTIAL_IDRIVEE2_SECRET_KEY }}" ]] && \
             [[ -n "${{ secrets.TESTCREDENTIAL_IDRIVEE2_FOLDER }}" ]]; then
            echo "All iDrivee2 secrets found"
            echo "available=true" >> $GITHUB_OUTPUT
          else
            echo "Missing some iDrivee2 secrets"
            echo "available=false" >> $GITHUB_OUTPUT
          fi
          echo "iDrivee2 check completed"
      - id: check_gcs
        name: Check GCS secrets
        shell: bash
        run: |
          echo "Starting GCS secrets check..."
          if [[ -n "${{ secrets.TESTCREDENTIAL_GCS_BUCKET }}" ]] && \
             [[ -n "${{ secrets.TESTCREDENTIAL_GCS_AUTHID }}" ]] && \
             [[ -n "${{ secrets.TESTCREDENTIAL_GCS_FOLDER }}" ]]; then
            echo "All GCS secrets found"
            echo "available=true" >> $GITHUB_OUTPUT
          else
            echo "Missing some GCS secrets"
            echo "available=false" >> $GITHUB_OUTPUT
          fi
          echo "GCS check completed"
      - id: check_cloudstack
        name: Check CloudStack secrets
        shell: bash
        run: |
          echo "Starting CloudStack secrets check..."
          if [[ -n "${{ secrets.TESTCREDENTIAL_CLOUDSTACK_USERNAME }}" ]] && \
             [[ -n "${{ secrets.TESTCREDENTIAL_CLOUDSTACK_PASSWORD }}" ]] && \
             [[ -n "${{ secrets.TESTCREDENTIAL_CLOUDSTACK_LOCATION }}" ]] && \
             [[ -n "${{ secrets.TESTCREDENTIAL_CLOUDSTACK_TENANT }}" ]] && \
             [[ -n "${{ secrets.TESTCREDENTIAL_CLOUDSTACK_DOMAIN }}" ]] && \
             [[ -n "${{ secrets.TESTCREDENTIAL_CLOUDSTACK_REGION }}" ]] && \
             [[ -n "${{ secrets.TESTCREDENTIAL_CLOUDSTACK_FOLDER }}" ]]; then
            echo "All CloudStack secrets found"
            echo "available=true" >> $GITHUB_OUTPUT
          else
            echo "Missing some CloudStack secrets"
            echo "available=false" >> $GITHUB_OUTPUT
          fi
          echo "CloudStack check completed"

      - name: Debug Output
        shell: bash
        run: |
          echo "S3 Available: ${{ steps.check_s3.outputs.available }}"
          echo "Dropbox Available: ${{ steps.check_dropbox.outputs.available }}"
          echo "TestContainers Available: ${{ steps.check_testcontainers.outputs.available }}"
          echo "Google Available: ${{ steps.check_google.outputs.available }}"
          echo "pCloud Available: ${{ steps.check_pcloud.outputs.available }}"
          echo "Azure Available: ${{ steps.check_azure.outputs.available }}"
          echo "B2 Available: ${{ steps.check_b2.outputs.available }}"
          echo "Box.com Available: ${{ steps.check_box.outputs.available }}"
          echo "Filen.io Available: ${{ steps.check_filen.outputs.available }}"
          echo "Filejump Available: ${{ steps.check_filejump.outputs.available }}"
          echo "OneDrive Available: ${{ steps.check_onedrive.outputs.available }}"
          echo "iDrivee2 Available: ${{ steps.check_idrivee2.outputs.available }}"
          echo "GCS Available: ${{ steps.check_gcs.outputs.available }}"
          echo "CloudStack Available: ${{ steps.check_cloudstack.outputs.available }}"
  test_ftp:
    needs: check_secrets
    if: needs.check_secrets.outputs.testcontainers_secrets_available == 'true'
    name: FTP Tests
    runs-on: "${{ matrix.os }}"
    strategy:
      fail-fast: false
      max-parallel: 1
      matrix:
        os:
          - ubuntu-latest
          - windows-latest
          - macos-latest
    steps:
      - name: Set up .NET
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: 10.x
      - name: Checkout source
        uses: actions/checkout@v4
      - name: Restore NuGet dependencies
        run: >-
          dotnet restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Build project
        run: >-
          dotnet build --no-restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Setup Testcontainers Cloud Client
        uses: atomicjar/testcontainers-cloud-setup-action@v1
        with:
          token: "${{ secrets.TC_CLOUD_TOKEN }}"
      - name: Run FTP tests
        env:
          TC_CLOUD_TOKEN: "${{ secrets.TC_CLOUD_TOKEN }}"
        run: >-
          dotnet test --no-build --filter="ClassName~FtpTests"
          --logger:"console;verbosity=detailed"
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx

  test_pcloud:
    needs: check_secrets
    if: needs.check_secrets.outputs.pcloud_secrets_available == 'true'
    name: pCloud Tests
    runs-on: "${{ matrix.os }}"
    strategy:
      max-parallel: 1
      fail-fast: false
      matrix:
        os:
          - ubuntu-latest
          - windows-latest
          - macos-latest
    steps:
      - name: Set up .NET
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: 10.x
      - name: Checkout source
        uses: actions/checkout@v4
      - name: Restore NuGet dependencies
        run: >-
          dotnet restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Build project
        run: >-
          dotnet build --no-restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Run pCloud tests
        env:
          TESTCREDENTIAL_PCLOUD_SERVER: "${{ secrets.TESTCREDENTIAL_PCLOUD_SERVER }}"
          TESTCREDENTIAL_PCLOUD_TOKEN: "${{ secrets.TESTCREDENTIAL_PCLOUD_TOKEN }}"
          TESTCREDENTIAL_PCLOUD_FOLDER: "${{ secrets.TESTCREDENTIAL_PCLOUD_FOLDER }}"
        run: >-
          dotnet test --no-build --filter="ClassName~pCloudTests"
          --logger:"console;verbosity=detailed"
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx

  test_s3:
    needs: check_secrets
    if: needs.check_secrets.outputs.s3_secrets_available == 'true'
    name: S3 Tests
    runs-on: "${{ matrix.os }}"
    strategy:
      max-parallel: 1
      fail-fast: false
      matrix:
        os:
          - ubuntu-latest
          - windows-latest
          - macos-latest
    steps:
      - name: Set up .NET
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: 10.x
      - name: Checkout source
        uses: actions/checkout@v4
      - name: Restore NuGet dependencies
        run: >-
          dotnet restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Build project
        run: >-
          dotnet build --no-restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Run S3 tests
        env:
          TC_CLOUD_TOKEN: "${{ secrets.TC_CLOUD_TOKEN }}"
          TESTCREDENTIAL_S3_BUCKETNAME: "${{ secrets.TESTCREDENTIAL_S3_BUCKETNAME }}"
          TESTCREDENTIAL_S3_KEY: "${{ secrets.TESTCREDENTIAL_S3_KEY }}"
          TESTCREDENTIAL_S3_REGION: "${{ secrets.TESTCREDENTIAL_S3_REGION }}"
          TESTCREDENTIAL_S3_SECRET: "${{ secrets.TESTCREDENTIAL_S3_SECRET }}"
        run: >-
          dotnet test --no-build --filter="ClassName~S3Tests"
          --logger:"console;verbosity=detailed"
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
  test_azure:
    needs: check_secrets
    if: needs.check_secrets.outputs.azure_secrets_available == 'true'
    name: Azure Tests
    runs-on: "${{ matrix.os }}"
    strategy:
      max-parallel: 1
      fail-fast: false
      matrix:
        os:
          - ubuntu-latest
          - windows-latest
          - macos-latest
    steps:
      - name: Set up .NET
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: 10.x
      - name: Checkout source
        uses: actions/checkout@v4
      - name: Restore NuGet dependencies
        run: >-
          dotnet restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Build project
        run: >-
          dotnet build --no-restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Run Azure tests
        env:
          READ_WRITE_TIMEOUT_SECONDS: 18000
          TESTCREDENTIAL_AZURE_ACCOUNTNAME: "${{ secrets.TESTCREDENTIAL_AZURE_ACCOUNTNAME }}"
          TESTCREDENTIAL_AZURE_ACCESSKEY: "${{ secrets.TESTCREDENTIAL_AZURE_ACCESSKEY }}"
          TESTCREDENTIAL_AZURE_CONTAINERNAME: "${{ secrets.TESTCREDENTIAL_AZURE_CONTAINERNAME }}"
        run: >-
          dotnet test --no-build --filter="ClassName~AzureTests"
          --logger:"console;verbosity=detailed"
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
  test_webdav:
    needs: check_secrets
    if: needs.check_secrets.outputs.testcontainers_secrets_available == 'true'
    name: Webdav Tests
    runs-on: "${{ matrix.os }}"
    strategy:
      max-parallel: 1
      fail-fast: false
      matrix:
        os:
          - ubuntu-latest
          - windows-latest
          - macos-latest
    steps:
      - name: Set up .NET
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: 10.x
      - name: Checkout source
        uses: actions/checkout@v4
      - name: Restore NuGet dependencies
        run: >-
          dotnet restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Build project
        run: >-
          dotnet build --no-restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Setup Testcontainers Cloud Client
        uses: atomicjar/testcontainers-cloud-setup-action@v1
        with:
          token: "${{ secrets.TC_CLOUD_TOKEN }}"
      - name: Run Webdav tests
        env:
          TC_CLOUD_TOKEN: "${{ secrets.TC_CLOUD_TOKEN }}"
        run: >-
          dotnet test --no-build --filter="ClassName~WebDavTests"
          --logger:"console;verbosity=detailed"
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
  test_dropbox:
    needs: check_secrets
    if: needs.check_secrets.outputs.dropbox_secrets_available == 'true'
    name: DropBox Tests
    runs-on: "${{ matrix.os }}"
    strategy:
      max-parallel: 1
      fail-fast: false
      matrix:
        os:
          - ubuntu-latest
          - windows-latest
          - macos-latest
    steps:
      - name: Set up .NET
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: 10.x
      - name: Checkout source
        uses: actions/checkout@v4
      - name: Restore NuGet dependencies
        run: >-
          dotnet restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Build project
        run: >-
          dotnet build --no-restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Run Dropbox tests
        env:
          TC_CLOUD_TOKEN: "${{ secrets.TC_CLOUD_TOKEN }}"
          TESTCREDENTIAL_DROPBOX_FOLDER: "${{ secrets.TESTCREDENTIAL_DROPBOX_FOLDER }}"
          TESTCREDENTIAL_DROPBOX_TOKEN: "${{ secrets.TESTCREDENTIAL_DROPBOX_TOKEN }}"
        run: >-
          dotnet test --no-build --filter="ClassName~DropBoxTests"
          --logger:"console;verbosity=detailed"
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
  test_ssh:
    needs: check_secrets
    if: needs.check_secrets.outputs.testcontainers_secrets_available == 'true'
    name: SSH Tests
    runs-on: "${{ matrix.os }}"
    strategy:
      fail-fast: false
      max-parallel: 1
      matrix:
        os:
          - ubuntu-latest
          - windows-latest
          - macos-latest
    steps:
      - name: Set up .NET
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: 10.x
      - name: Checkout source
        uses: actions/checkout@v4
      - name: Restore NuGet dependencies
        run: >-
          dotnet restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Build project
        run: >-
          dotnet build --no-restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Setup Testcontainers Cloud Client
        uses: atomicjar/testcontainers-cloud-setup-action@v1
        with:
          token: "${{ secrets.TC_CLOUD_TOKEN }}"
      - name: Run SSH tests
        env:
          TC_CLOUD_TOKEN: "${{ secrets.TC_CLOUD_TOKEN }}"
        run: >-
          dotnet test --no-build --filter="ClassName~SshTests"
          --logger:"console;verbosity=detailed"
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx

  test_sftp:
    needs: check_secrets
    if: needs.check_secrets.outputs.testcontainers_secrets_available == 'true'
    name: SFTP Tests
    runs-on: "${{ matrix.os }}"
    strategy:
      fail-fast: false
      max-parallel: 1
      matrix:
        os:
          - ubuntu-latest
          - windows-latest
          - macos-latest
    steps:
      - name: Set up .NET
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: 10.x
      - name: Checkout source
        uses: actions/checkout@v4
      - name: Restore NuGet dependencies
        run: >-
          dotnet restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Build project
        run: >-
          dotnet build --no-restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Setup Testcontainers Cloud Client
        uses: atomicjar/testcontainers-cloud-setup-action@v1
        with:
          token: "${{ secrets.TC_CLOUD_TOKEN }}"
      - name: Run SFTP tests
        env:
          TC_CLOUD_TOKEN: "${{ secrets.TC_CLOUD_TOKEN }}"
        run: >-
          dotnet test --no-build --filter="ClassName~SshTests"
          --logger:"console;verbosity=detailed"
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
  test_googledrive:
    needs: check_secrets
    if: needs.check_secrets.outputs.google_secrets_available == 'true'
    name: Google Drive Tests
    runs-on: "${{ matrix.os }}"
    strategy:
      max-parallel: 1
      fail-fast: false
      matrix:
        os:
          - ubuntu-latest
          - windows-latest
          - macos-latest
    steps:
      - name: Set up .NET
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: 10.x
      - name: Checkout source
        uses: actions/checkout@v4
      - name: Restore NuGet dependencies
        run: >-
          dotnet restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Build project
        run: >-
          dotnet build --no-restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Run Googledrive tests
        env:
          TESTCREDENTIAL_GOOGLEDRIVE_TOKEN: "${{ secrets.TESTCREDENTIAL_GOOGLEDRIVE_TOKEN }}"
          TESTCREDENTIAL_GOOGLEDRIVE_FOLDER: "${{ secrets.TESTCREDENTIAL_GOOGLEDRIVE_FOLDER }}"
        run: >-
          dotnet test --no-build --filter="ClassName~GoogleDriveTests"
          --logger:"console;verbosity=detailed"
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
  test_cifs:
    needs: check_secrets
    if: needs.check_secrets.outputs.testcontainers_secrets_available == 'true'
    name: CIFS Tests
    runs-on: "${{ matrix.os }}"
    strategy:
      max-parallel: 1
      fail-fast: false
      matrix:
        os:
          - ubuntu-latest
    steps:
      - name: Set up .NET
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: 10.x
      - name: Checkout source
        uses: actions/checkout@v4
      - name: Restore NuGet dependencies
        run: >-
          dotnet restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Build project
        run: >-
          dotnet build --no-restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Run CIFS tests
        run: >-
          dotnet test --no-build --filter="ClassName~CIFSTests"
          --logger:"console;verbosity=detailed"
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
  test_b2:
    needs: check_secrets
    if: needs.check_secrets.outputs.b2_secrets_available == 'true'
    name: Backblaze B2 Tests
    runs-on: "${{ matrix.os }}"
    strategy:
      max-parallel: 1
      fail-fast: false
      matrix:
        os:
          - ubuntu-latest
          - windows-latest
          - macos-latest
    steps:
      - name: Set up .NET
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: 10.x
      - name: Checkout source
        uses: actions/checkout@v4
      - name: Restore NuGet dependencies
        run: >-
          dotnet restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Build project
        run: >-
          dotnet build --no-restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Run B2 tests
        env:
          TESTCREDENTIAL_B2_BUCKET: "${{ secrets.TESTCREDENTIAL_B2_BUCKET }}"
          TESTCREDENTIAL_B2_FOLDER: "${{ secrets.TESTCREDENTIAL_B2_FOLDER }}"
          TESTCREDENTIAL_B2_USERNAME: "${{ secrets.TESTCREDENTIAL_B2_USERNAME }}"
          TESTCREDENTIAL_B2_PASSWORD: "${{ secrets.TESTCREDENTIAL_B2_PASSWORD }}"
        run: >-
          dotnet test --no-build --filter="ClassName~B2Tests"
          --logger:"console;verbosity=detailed"
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
  test_box:
    needs: check_secrets
    if: needs.check_secrets.outputs.box_secrets_available == 'true'
    name: Box.com Tests
    runs-on: "${{ matrix.os }}"
    strategy:
      max-parallel: 1
      fail-fast: false
      matrix:
        os:
          - ubuntu-latest
          - windows-latest
          - macos-latest
    steps:
      - name: Set up .NET
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: 10.x
      - name: Checkout source
        uses: actions/checkout@v4
      - name: Restore NuGet dependencies
        run: >-
          dotnet restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Build project
        run: >-
          dotnet build --no-restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Run Box.com tests
        env:
          TESTCREDENTIAL_BOX_FOLDER: "${{ secrets.TESTCREDENTIAL_BOX_FOLDER }}"
          TESTCREDENTIAL_BOX_AUTHID: "${{ secrets.TESTCREDENTIAL_BOX_AUTHID }}"
        run: >-
          dotnet test --no-build --filter="ClassName~Box.BoxTests"
          --logger:"console;verbosity=detailed"
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
  test_filen:
    needs: check_secrets
    if: needs.check_secrets.outputs.filen_secrets_available == 'true'
    name: Filen.io Tests
    runs-on: "${{ matrix.os }}"
    strategy:
      max-parallel: 1
      fail-fast: false
      matrix:
        os:
          - ubuntu-latest
          - windows-latest
          - macos-latest
    steps:
      - name: Set up .NET
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: 10.x
      - name: Checkout source
        uses: actions/checkout@v4
      - name: Restore NuGet dependencies
        run: >-
          dotnet restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Build project
        run: >-
          dotnet build --no-restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Run Filen.io tests
        env:
          TESTCREDENTIAL_FILEN_FOLDER: "${{ secrets.TESTCREDENTIAL_FILEN_FOLDER }}"
          TESTCREDENTIAL_FILEN_USERNAME: "${{ secrets.TESTCREDENTIAL_FILEN_USERNAME }}"
          TESTCREDENTIAL_FILEN_PASSWORD: "${{ secrets.TESTCREDENTIAL_FILEN_PASSWORD }}"
        run: >-
          dotnet test --no-build --filter="ClassName~Filen.FilenTests"
          --logger:"console;verbosity=detailed"
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
  # test_filejump:
  #   needs: check_secrets
  #   if: needs.check_secrets.outputs.filejump_secrets_available == 'true'
  #   name: Filejump Tests
  #   runs-on: "${{ matrix.os }}"
  #   strategy:
  #     max-parallel: 1
  #     fail-fast: false
  #     matrix:
  #       os:
  #         - ubuntu-latest
  #         - windows-latest
  #         - macos-latest
  #   steps:
  #     - name: Set up .NET
  #       uses: actions/setup-dotnet@v4
  #       with:
  #         dotnet-version: 10.x
  #     - name: Checkout source
  #       uses: actions/checkout@v4
  #     - name: Restore NuGet dependencies
  #       run: >-
  #         dotnet restore
  #         LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
  #     - name: Build project
  #       run: >-
  #         dotnet build --no-restore
  #         LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
  #     - name: Run Filejump tests
  #       env:
  #         TESTCREDENTIAL_FILEJUMP_FOLDER: "${{ secrets.TESTCREDENTIAL_FILEJUMP_FOLDER }}"
  #         TESTCREDENTIAL_FILEJUMP_TOKEN: "${{ secrets.TESTCREDENTIAL_FILEJUMP_TOKEN }}"
  #       run: >-
  #         dotnet test --no-build --filter="ClassName~Filejump.FilejumpTests"
  #         --logger:"console;verbosity=detailed"
  #         LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
  test_onedrive:
    needs: check_secrets
    if: needs.check_secrets.outputs.onedrive_secrets_available == 'true'
    name: OneDrive Tests
    runs-on: "${{ matrix.os }}"
    strategy:
      max-parallel: 1
      fail-fast: false
      matrix:
        os:
          - ubuntu-latest
          - windows-latest
          - macos-latest
    steps:
      - name: Set up .NET
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: 10.x
      - name: Checkout source
        uses: actions/checkout@v4
      - name: Restore NuGet dependencies
        run: >-
          dotnet restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Build project
        run: >-
          dotnet build --no-restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Run OneDrive tests
        env:
          TESTCREDENTIAL_ONEDRIVE_FOLDER: "${{ secrets.TESTCREDENTIAL_ONEDRIVE_FOLDER }}"
          TESTCREDENTIAL_ONEDRIVE_AUTHID: "${{ secrets.TESTCREDENTIAL_ONEDRIVE_AUTHID }}"
        run: >-
          dotnet test --no-build --filter="ClassName~OneDrive.OneDriveTests"
          --logger:"console;verbosity=detailed"
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx

  test_idrivee2:
    needs: check_secrets
    if: needs.check_secrets.outputs.idrivee2_secrets_available == 'true'
    name: iDrivee2 Tests
    runs-on: "${{ matrix.os }}"
    strategy:
      max-parallel: 1
      fail-fast: false
      matrix:
        os:
          - ubuntu-latest
          - windows-latest
          - macos-latest
    steps:
      - name: Set up .NET
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: 10.x
      - name: Checkout source
        uses: actions/checkout@v4
      - name: Restore NuGet dependencies
        run: >-
          dotnet restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Build project
        run: >-
          dotnet build --no-restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Run iDrivee2 tests
        env:
          TESTCREDENTIAL_IDRIVEE2_BUCKET: "${{ secrets.TESTCREDENTIAL_IDRIVEE2_BUCKET }}"
          TESTCREDENTIAL_IDRIVEE2_ACCESS_KEY: "${{ secrets.TESTCREDENTIAL_IDRIVEE2_ACCESS_KEY }}"
          TESTCREDENTIAL_IDRIVEE2_SECRET_KEY: "${{ secrets.TESTCREDENTIAL_IDRIVEE2_SECRET_KEY }}"
          TESTCREDENTIAL_IDRIVEE2_FOLDER: "${{ secrets.TESTCREDENTIAL_IDRIVEE2_FOLDER }}"

        run: >-
          dotnet test --no-build --filter="ClassName~iDrivee2.iDrivee2Tests"
          --logger:"console;verbosity=detailed"
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
  test_gcs:
    needs: check_secrets
    if: needs.check_secrets.outputs.gcs_secrets_available == 'true'
    name: GCS Tests
    runs-on: "${{ matrix.os }}"
    strategy:
      max-parallel: 1
      fail-fast: false
      matrix:
        os:
          - ubuntu-latest
          - windows-latest
          - macos-latest
    steps:
      - name: Set up .NET
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: 10.x
      - name: Checkout source
        uses: actions/checkout@v4
      - name: Restore NuGet dependencies
        run: >-
          dotnet restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Build project
        run: >-
          dotnet build --no-restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Run GCS tests
        env:
          TESTCREDENTIAL_GCS_BUCKET: "${{ secrets.TESTCREDENTIAL_GCS_BUCKET }}"
          TESTCREDENTIAL_GCS_AUTHID: "${{ secrets.TESTCREDENTIAL_GCS_AUTHID}}"
          TESTCREDENTIAL_GCS_FOLDER: "${{ secrets.TESTCREDENTIAL_GCS_FOLDER }}"

        run: >-
          dotnet test --no-build --filter="ClassName~GCS.GCSTests"
          --logger:"console;verbosity=detailed"
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
  test_cloudstack:
    needs: check_secrets
    if: needs.check_secrets.outputs.cloudstack_secrets_available == 'true'
    name: CloudStack Tests
    runs-on: "${{ matrix.os }}"
    strategy:
      max-parallel: 1
      fail-fast: false
      matrix:
        os:
          - ubuntu-latest
          - windows-latest
          - macos-latest
    steps:
      - name: Set up .NET
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: 10.x
      - name: Checkout source
        uses: actions/checkout@v4
      - name: Restore NuGet dependencies
        run: >-
          dotnet restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Build project
        run: >-
          dotnet build --no-restore
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
      - name: Run CloudStack tests
        env:
          TESTCREDENTIAL_CLOUDSTACK_USERNAME: "${{ secrets.TESTCREDENTIAL_CLOUDSTACK_USERNAME }}"
          TESTCREDENTIAL_CLOUDSTACK_PASSWORD: "${{ secrets.TESTCREDENTIAL_CLOUDSTACK_PASSWORD }}"
          TESTCREDENTIAL_CLOUDSTACK_LOCATION: "${{ secrets.TESTCREDENTIAL_CLOUDSTACK_LOCATION }}"
          TESTCREDENTIAL_CLOUDSTACK_TENANT: "${{ secrets.TESTCREDENTIAL_CLOUDSTACK_TENANT }}"
          TESTCREDENTIAL_CLOUDSTACK_DOMAIN: "${{ secrets.TESTCREDENTIAL_CLOUDSTACK_DOMAIN }}"
          TESTCREDENTIAL_CLOUDSTACK_REGION: "${{ secrets.TESTCREDENTIAL_CLOUDSTACK_REGION }}"
          TESTCREDENTIAL_CLOUDSTACK_FOLDER: "${{ secrets.TESTCREDENTIAL_CLOUDSTACK_FOLDER }}"
        run: >-
          dotnet test --no-build --filter="ClassName~CloudStack.CloudStackTests"
          --logger:"console;verbosity=detailed"
          LiveTests/Duplicati.Backend.Tests/Duplicati.Backend.Tests.slnx
