name: Unit tests
on:
  [push, pull_request]
jobs:
  unit-tests:
    runs-on: ubuntu-latest
    defaults:
      run:
        shell: bash

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 3

      - name: Update the system
        run: |
          sudo apt update -y

      - name: Install dependencies
        run: |
          sudo apt install -y shunit2 bc sqlite3 bsdmainutils libxml-xpath-perl fish

      - name: Prepare for tests
        run: |
          ./run_tests.sh prepare
          git config --global user.email "kw@kworkflow.net"
          git config --global user.name "Kworkflow"

      - name: Unit tests
        run: |
          ./run_tests.sh --unit
