name: Run BaseX Tests

on:
  workflow_dispatch: # Enables manual trigger
  push:
    branches:
      - main
    paths:
      - '.gitea/workflows/trigger/release'

  
jobs:
 test:
    runs-on: ubuntu-22.04
    steps:
    - name: Set up Java
      uses: actions/setup-java@v4
      with:
        java-version: '17'

    - name: Install BaseX
      run: |
        wget https://files.basex.org/releases/10.7/BaseX107.zip
        unzip BaseX107.zip -d basex

    - name: Checkout repository
      uses: actions/checkout@v4

    - name: Build package
      run: |
        ./basex/bin/basex /scripts/make-fat-jar.xq
        
    - name: Run BaseX Tests
      run: |
        ./basex/bin/basex -t /src/test