|
| 1 | +# .github/workflows/e2e_tests_rhelai.yaml |
| 2 | +name: RHEL AI E2E Tests |
| 3 | + |
| 4 | +on: |
| 5 | + schedule: |
| 6 | + - cron: "0 0 * * *" # Runs once a day at midnight UTC |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +jobs: |
| 10 | + e2e_tests: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + environment: [ "rhelai" ] |
| 15 | + env: |
| 16 | + RHEL_AI_URL: ${{ secrets.RHEL_AI_URL }} |
| 17 | + RHEL_AI_PORT: ${{ secrets.RHEL_AI_PORT }} |
| 18 | + RHEL_AI_API_KEY: ${{ secrets.RHEL_AI_API_KEY }} |
| 19 | + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} |
| 20 | + RHEL_AI_MODEL: ${{ vars.RHEL_AI_MODEL }} |
| 21 | + |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + with: |
| 25 | + # On PR_TARGET → the fork (or same repo) that opened the PR. |
| 26 | + # On push → falls back to the current repository. |
| 27 | + repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} |
| 28 | + |
| 29 | + # On PR_TARGET → the PR head *commit* (reproducible). |
| 30 | + # On push → the pushed commit that triggered the workflow. |
| 31 | + ref: ${{ github.event.pull_request.head.ref || github.sha }} |
| 32 | + |
| 33 | + # Don’t keep credentials when running untrusted PR code under PR_TARGET. |
| 34 | + persist-credentials: ${{ github.event_name != 'pull_request_target' }} |
| 35 | + |
| 36 | + - name: Verify actual git checkout result |
| 37 | + run: | |
| 38 | + echo "=== Git Status After Checkout ===" |
| 39 | + echo "Remote URLs:" |
| 40 | + git remote -v |
| 41 | + echo "" |
| 42 | + echo "Current branch: $(git branch --show-current 2>/dev/null || echo 'detached HEAD')" |
| 43 | + echo "Current commit: $(git rev-parse HEAD)" |
| 44 | + echo "Current commit message: $(git log -1 --oneline)" |
| 45 | + echo "" |
| 46 | + echo "=== Recent commits (should show setup-metrics commits) ===" |
| 47 | + git log --oneline -5 |
| 48 | +
|
| 49 | + |
| 50 | + with: |
| 51 | + path: '.' |
| 52 | + isAbsolutePath: false |
| 53 | + file: 'lightspeed-stack.yaml' |
| 54 | + content: | |
| 55 | + name: Lightspeed Core Service (LCS) |
| 56 | + service: |
| 57 | + host: 0.0.0.0 |
| 58 | + port: 8080 |
| 59 | + auth_enabled: false |
| 60 | + workers: 1 |
| 61 | + color_log: true |
| 62 | + access_log: true |
| 63 | + llama_stack: |
| 64 | + # Uses a remote llama-stack service |
| 65 | + # The instance would have already been started with a llama-stack-run.yaml file |
| 66 | + use_as_library_client: false |
| 67 | + # Alternative for "as library use" |
| 68 | + # use_as_library_client: true |
| 69 | + # library_client_config_path: <path-to-llama-stack-run.yaml-file> |
| 70 | + url: http://llama-stack:8321 |
| 71 | + api_key: xyzzy |
| 72 | + user_data_collection: |
| 73 | + feedback_enabled: true |
| 74 | + feedback_storage: "/tmp/data/feedback" |
| 75 | + transcripts_enabled: true |
| 76 | + transcripts_storage: "/tmp/data/transcripts" |
| 77 | +
|
| 78 | + authentication: |
| 79 | + module: "noop" |
| 80 | +
|
| 81 | + - name: Select and configure run.yaml |
| 82 | + env: |
| 83 | + CONFIG_ENVIRONMENT: ${{ matrix.environment || 'rhelai' }} |
| 84 | + run: | |
| 85 | + CONFIGS_DIR="tests/e2e/configs" |
| 86 | + ENVIRONMENT="$CONFIG_ENVIRONMENT" |
| 87 | + |
| 88 | + echo "Looking for configurations in $CONFIGS_DIR/" |
| 89 | + |
| 90 | + # List available configurations |
| 91 | + if [ -d "$CONFIGS_DIR" ]; then |
| 92 | + echo "Available configurations:" |
| 93 | + ls -la "$CONFIGS_DIR"/*.yaml 2>/dev/null || echo "No YAML files found in $CONFIGS_DIR/" |
| 94 | + else |
| 95 | + echo "Configs directory '$CONFIGS_DIR' not found!" |
| 96 | + exit 1 |
| 97 | + fi |
| 98 | + |
| 99 | + # Determine which config file to use |
| 100 | + CONFIG_FILE="$CONFIGS_DIR/run-$ENVIRONMENT.yaml" |
| 101 | + |
| 102 | + echo "Looking for: $CONFIG_FILE" |
| 103 | + |
| 104 | + if [ -f "$CONFIG_FILE" ]; then |
| 105 | + echo "Found config for environment: $ENVIRONMENT" |
| 106 | + cp "$CONFIG_FILE" run.yaml |
| 107 | + else |
| 108 | + echo "Configuration file not found: $CONFIG_FILE" |
| 109 | + echo "Available files in $CONFIGS_DIR:" |
| 110 | + ls -la "$CONFIGS_DIR/" |
| 111 | + exit 1 |
| 112 | + fi |
| 113 | + |
| 114 | + # Update paths for container environment (relative -> absolute) |
| 115 | + sed -i 's|db_path: \.llama/distributions|db_path: /app-root/.llama/distributions|g' run.yaml |
| 116 | + sed -i 's|db_path: tmp/|db_path: /app-root/.llama/distributions/|g' run.yaml |
| 117 | + |
| 118 | + echo "Successfully configured for environment: $ENVIRONMENT" |
| 119 | + echo "Using configuration: $(basename "$CONFIG_FILE")" |
| 120 | +
|
| 121 | + - name: Test RHEL_AI connectivity |
| 122 | + run: | |
| 123 | + echo $RHEL_AI_MODEL |
| 124 | + curl -f ${RHEL_AI_URL}:${RHEL_AI_PORT}/v1/models -H "Authorization: Bearer ${RHEL_AI_API_KEY}" |
| 125 | +
|
| 126 | + - name: Run service manually |
| 127 | + run: | |
| 128 | + docker compose version |
| 129 | + docker compose up -d |
| 130 | + |
| 131 | + # Check for errors and show logs if any services failed |
| 132 | + if docker compose ps | grep -E 'Exit|exited|stopped'; then |
| 133 | + echo "Some services failed to start - showing logs:" |
| 134 | + docker compose logs |
| 135 | + exit 1 |
| 136 | + else |
| 137 | + echo "All services started successfully" |
| 138 | + fi |
| 139 | +
|
| 140 | + - name: Wait for services |
| 141 | + run: | |
| 142 | + echo "Waiting for services to be healthy..." |
| 143 | + sleep 20 # adjust depending on boot time |
| 144 | +
|
| 145 | + - name: Quick connectivity test |
| 146 | + run: | |
| 147 | + echo "Testing basic connectivity before full test suite..." |
| 148 | + curl -f http://localhost:8080/v1/models || { |
| 149 | + echo "❌ Basic connectivity failed - showing logs before running full tests" |
| 150 | + docker compose logs --tail=30 |
| 151 | + exit 1 |
| 152 | + } |
| 153 | +
|
| 154 | + - name: Run e2e tests |
| 155 | + run: | |
| 156 | + echo "Installing test dependencies..." |
| 157 | + pip install uv |
| 158 | + uv sync |
| 159 | +
|
| 160 | + echo "Running comprehensive e2e test suite..." |
| 161 | + make test-e2e |
| 162 | +
|
| 163 | + - name: Show logs on failure |
| 164 | + if: failure() |
| 165 | + run: | |
| 166 | + echo "=== Test failure logs ===" |
| 167 | + echo "=== llama-stack logs ===" |
| 168 | + docker compose logs llama-stack |
| 169 | + |
| 170 | + echo "" |
| 171 | + echo "=== lightspeed-stack logs ===" |
| 172 | + docker compose logs lightspeed-stack |
0 commit comments