---
name: Functional Test
on:
  workflow_dispatch:
  # push:
  #  branches: [main]
  # pull_request:
  #  branches: [main]
jobs:
  test:
    strategy:
      fail-fast: false
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Set up Go
        uses: actions/setup-go@v5
        with:
          go-version: '1.24'  # Match your go.mod
      - name: Build dalfox
        run: go build -o dalfox .
      - name: Setup Ruby
        uses: ruby/setup-ruby@v1.213.0
        with:
          ruby-version: 3.4.0  # Match bundle path
          bundler-cache: true
          cache-version: 1
      - name: Install Ruby dependencies
        run: bundle install  # Default gem location
      - name: Run RSpec tests
        run: bundle exec rspec
        env:
          PATH: ${{ github.workspace }}:$PATH  # Ensure dalfox is in PATH
