name: e2e

on:
  repository_dispatch:
    types: [cluster_image_build_success, dockerize_runtime_success]
  workflow_dispatch:
  push:
    branches:
      - main
    paths:
      - "e2e/**"
      - ".github/workflows/e2e.yml"

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

env:
  DOMAIN: 127.0.0.1.nip.io

jobs:
  e2e:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Remove builtin docker
        run: |
          sudo apt-get remove -y moby-engine moby-cli moby-buildx moby-compose

      - name: Deploy laf
        env:
          DOMAIN: ${{ env.DOMAIN }}
        working-directory: deploy
        run: sudo sh install-on-linux.sh $DOMAIN # this script will install sealos and laf

      - name: Run E2E Test
        working-directory: e2e
        run: |
          sudo sh e2e.sh
