name: e2e tests
on:
  push:
    branches:
      - develop
  pull_request:
  workflow_dispatch:
jobs:
  e2e:
    runs-on: ubuntu-22.04
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
      - name: Install Go
        uses: actions/setup-go@v3
        with:
          go-version: 1.23
          cache: true
      # Fails: because ffmpeg can't be downloaded anymore. Installing VHS and its deps manually. Longer, but works.
      # - name: VHS Action
      #   uses: charmbracelet/vhs-action@v2.1.0
      #   with:
      #     version: v0.9.0
      - name: Install VHS dependencies
        run: sudo apt update > /dev/null && sudo apt-get install -y ffmpeg jq > /dev/null && sudo snap install ttyd --classic > /dev/null
      - name: Install VHS utility
        run: go install github.com/charmbracelet/vhs@v0.9.0 > /dev/null && vhs -v
      - name: Build Binary
        run: go build -o gg ./cmd/goto/*.go && cp gg /usr/local/bin && gg -v
      - name: Run integration tests
        run: ./e2e/run.sh
