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:
        distribution: 'temurin'
        java-version: '17'

    - name: Install BaseX
      run: |
        wget https://files.basex.org/releases/10.7/BaseX107.zip
        unzip BaseX107.zip -d /usr/local/
        echo "BASEX_ROOT=/usr/local/basex" >> $GITHUB_ENV 
        echo "PATH=$PATH:/usr/local/basex/bin" >> $GITHUB_ENV
      
    - name: Verify PATH
      run: |
        echo path: $PATH$ 
        echo basex: $BASEX_ROOT 
        echo ""
        basex -c "SHOW OPTIONS"

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

    - name: Build package
      run: |
        basex scripts/install.bxs
      
    - name: run tests
      run: |
        basex -Wt src/test

