|
| 1 | +name: Smoke |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: main |
| 6 | + pull_request: |
| 7 | + branches: main |
| 8 | + schedule: |
| 9 | + - cron: '0 0 * * *' # Run daily at midnight UTC |
| 10 | + |
| 11 | +jobs: |
| 12 | + smoke: |
| 13 | + name: ${{ matrix.os }} / Node ${{ matrix.node }} |
| 14 | + runs-on: ${{ matrix.os }} |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 19 | + node: [20, 22] |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Checkout |
| 23 | + uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Setup Node.js |
| 26 | + uses: actions/setup-node@v4 |
| 27 | + with: |
| 28 | + node-version: ${{ matrix.node }} |
| 29 | + |
| 30 | + - name: Install dependencies (root) |
| 31 | + run: npm install |
| 32 | + |
| 33 | + - name: Install dependencies (agent) |
| 34 | + run: | |
| 35 | + cd agent |
| 36 | + npm install |
| 37 | +
|
| 38 | + - name: Build |
| 39 | + run: npm run build || echo "No build script in root" |
| 40 | + - name: Start and check main app (Linux/macOS) |
| 41 | + if: runner.os != 'Windows' |
| 42 | + run: | |
| 43 | + # Start the server in background |
| 44 | + npm start & |
| 45 | + SERVER_PID=$! |
| 46 | + |
| 47 | + # Wait for server to start (max 30 seconds) |
| 48 | + timeout=30 |
| 49 | + elapsed=0 |
| 50 | + started=false |
| 51 | + |
| 52 | + while [ $elapsed -lt $timeout ] && [ "$started" = false ]; do |
| 53 | + if curl -s http://localhost:3000 > /dev/null 2>&1; then |
| 54 | + started=true |
| 55 | + echo "✅ Main app started successfully" |
| 56 | + else |
| 57 | + sleep 1 |
| 58 | + elapsed=$((elapsed + 1)) |
| 59 | + fi |
| 60 | + done |
| 61 | + |
| 62 | + # Clean up background process |
| 63 | + kill $SERVER_PID 2>/dev/null || true |
| 64 | + |
| 65 | + if [ "$started" = false ]; then |
| 66 | + echo "❌ Main app failed to start within 30 seconds" |
| 67 | + exit 1 |
| 68 | + fi |
| 69 | + shell: bash |
| 70 | + |
| 71 | + - name: Start and check main app (Windows) |
| 72 | + if: runner.os == 'Windows' |
| 73 | + run: | |
| 74 | + # Start the server in background |
| 75 | + npm start & |
| 76 | + |
| 77 | + # Wait for server to start (max 30 seconds) |
| 78 | + $timeout = 30 |
| 79 | + $elapsed = 0 |
| 80 | + $started = $false |
| 81 | + |
| 82 | + while ($elapsed -lt $timeout -and -not $started) { |
| 83 | + try { |
| 84 | + $response = Invoke-WebRequest -Uri "http://localhost:3000" -TimeoutSec 1 -ErrorAction SilentlyContinue |
| 85 | + if ($response.StatusCode -eq 200) { |
| 86 | + $started = $true |
| 87 | + Write-Host "✅ Main app started successfully" |
| 88 | + } |
| 89 | + } catch { |
| 90 | + Start-Sleep -Seconds 1 |
| 91 | + $elapsed++ |
| 92 | + } |
| 93 | + } |
| 94 | + |
| 95 | + if (-not $started) { |
| 96 | + Write-Host "❌ Main app failed to start within 30 seconds" |
| 97 | + exit 1 |
| 98 | + } |
| 99 | + shell: pwsh |
| 100 | + |
| 101 | + notify-slack: |
| 102 | + name: Notify Slack on Failure |
| 103 | + runs-on: ubuntu-latest |
| 104 | + needs: smoke |
| 105 | + if: | |
| 106 | + failure() && |
| 107 | + github.event_name == 'schedule' |
| 108 | + steps: |
| 109 | + - name: Notify Slack |
| 110 | + |
| 111 | + with: |
| 112 | + webhook: ${{ secrets.SLACK_WEBHOOK_URL }} |
| 113 | + webhook-type: incoming-webhook |
| 114 | + payload: | |
| 115 | + { |
| 116 | + "text": ":warning: *Smoke test failed for `with-langgraph-js` :warning:.*", |
| 117 | + "blocks": [ |
| 118 | + { |
| 119 | + "type": "section", |
| 120 | + "text": { |
| 121 | + "type": "mrkdwn", |
| 122 | + "text": ":warning: *Smoke test failed for <https://github.com/copilotkit/with-langgraph-js|with-langgraph-js> :warning:*\n\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View run details>" |
| 123 | + } |
| 124 | + } |
| 125 | + ] |
| 126 | + } |
0 commit comments