name: Functional Test

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
  workflow_call:

jobs:
  build-and-test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Set up Go
        uses: actions/setup-go@v4
        with:
          go-version: "1.24"
      - name: Build Sif
        run: make
      - name: Run Sif with features
        run: |
          ./sif -u https://example.com -dnslist small -dirlist small -dork -git -whois -cms -framework
          if [ $? -eq 0 ]; then
            echo "Sif ran successfully"
          else
            echo "Sif exited with an error"
            exit 1
          fi

      - name: Test module system
        run: |
          echo "Listing modules..."
          ./sif -lm
          echo "Running all modules..."
          ./sif -u https://example.com -am
          if [ $? -eq 0 ]; then
            echo "Module system working"
          else
            echo "Module system failed"
            exit 1
          fi
