|
| 1 | +name: E2E Tests |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [main] |
| 6 | + push: |
| 7 | + branches: [main] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: read |
| 12 | + |
| 13 | +concurrency: |
| 14 | + group: e2e-${{ github.head_ref || github.run_id }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +jobs: |
| 18 | + e2e: |
| 19 | + name: E2E Test Suite |
| 20 | + runs-on: ubuntu-24.04 |
| 21 | + timeout-minutes: 20 |
| 22 | + strategy: |
| 23 | + matrix: |
| 24 | + include: |
| 25 | + - {mode: "live-mode"} |
| 26 | + - {mode: "offline-mode"} |
| 27 | + env: |
| 28 | + JOB_NAME: "${{ matrix.mode }}" |
| 29 | + steps: |
| 30 | + - name: Check out code into the Go module directory |
| 31 | + uses: actions/checkout@v4 |
| 32 | + |
| 33 | + - name: Set up Go |
| 34 | + uses: actions/setup-go@v5 |
| 35 | + with: |
| 36 | + go-version-file: go.mod |
| 37 | + cache: false |
| 38 | + id: go |
| 39 | + |
| 40 | + - name: Install dependencies |
| 41 | + run: | |
| 42 | + set -x |
| 43 | + # Check if jinjanator is already available |
| 44 | + if ! command -v jinjanate &> /dev/null; then |
| 45 | + echo "jinjanator not found, installing..." |
| 46 | + sudo apt-get update |
| 47 | + sudo apt-get install -y pipx |
| 48 | + pipx install jinjanator |
| 49 | + pipx ensurepath |
| 50 | + echo "$HOME/.local/bin" >> $GITHUB_PATH |
| 51 | + else |
| 52 | + echo "jinjanator already installed" |
| 53 | + fi |
| 54 | +
|
| 55 | + - name: Verify jinjanator installation |
| 56 | + run: | |
| 57 | + set -x |
| 58 | + which jinjanate |
| 59 | + jinjanate --version |
| 60 | +
|
| 61 | + - name: Build |
| 62 | + run: make build |
| 63 | + |
| 64 | + - name: Deploy KIND |
| 65 | + run: | |
| 66 | + if [ "${{ matrix.mode }}" == "live-mode" ]; then |
| 67 | + make deploy-kind-ovnk |
| 68 | + fi |
| 69 | +
|
| 70 | + - name: Run E2E tests |
| 71 | + run: | |
| 72 | + if [ "${{ matrix.mode }}" == "live-mode" ]; then |
| 73 | + make run-e2e MCP_MODE="Live Mode" |
| 74 | + else |
| 75 | + make run-e2e MCP_MODE="Offline Mode" |
| 76 | + fi |
| 77 | +
|
| 78 | + - name: Export kind logs |
| 79 | + if: always() && matrix.mode == 'live-mode' |
| 80 | + run: | |
| 81 | + set -x |
| 82 | + # Only export logs if kind CLI exists and cluster is running |
| 83 | + if command -v kind &> /dev/null && kind get clusters 2>/dev/null | grep -q '^ovn$'; then |
| 84 | + mkdir -p /tmp/kind/logs |
| 85 | + kind export logs --name ovn --verbosity 4 /tmp/kind/logs |
| 86 | + else |
| 87 | + echo "KIND cluster 'ovn' not found or kind CLI not available, skipping log export" |
| 88 | + fi |
| 89 | +
|
| 90 | + - name: Upload kind logs |
| 91 | + if: always() && matrix.mode == 'live-mode' |
| 92 | + uses: actions/upload-artifact@v4 |
| 93 | + with: |
| 94 | + name: kind-logs-e2e-${{ github.run_id }} |
| 95 | + path: /tmp/kind/logs |
| 96 | + if-no-files-found: ignore |
| 97 | + |
| 98 | + - name: Cleanup KIND cluster |
| 99 | + if: always() && matrix.mode == 'live-mode' |
| 100 | + run: | |
| 101 | + set -x |
| 102 | + kind delete cluster --name ovn || true |
0 commit comments