diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 8836d93c89..18f273adc1 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -260,6 +260,85 @@ jobs: - name: Validate Documents run: graphql-inspector validate './src/GraphQl/**/*.ts' './talawa-api/schema.graphql' + Start-App-Without-Docker: + name: Check if Talawa Admin app starts (No Docker) + runs-on: ubuntu-latest + needs: [Code-Quality-Checks, Test-Application] + if: github.actor != 'dependabot' + steps: + - name: Checkout the Repository + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + + - name: Install Dependencies + run: npm install + + - name: Build Production App + run: npm run build + + - name: Start Production App + run: | + npm run preview & + echo $! > .pidfile_prod + + - name: Check if Production App is running + run: | + timeout=120 + echo "Starting production health check with ${timeout}s timeout" + while ! nc -z localhost 4173 && [ $timeout -gt 0 ]; do + sleep 1 + timeout=$((timeout-1)) + if [ $((timeout % 10)) -eq 0 ]; then + echo "Still waiting for production app to start... ${timeout}s remaining" + fi + done + + if [ $timeout -eq 0 ]; then + echo "Timeout waiting for production application to start" + exit 1 + fi + echo "Production app started successfully" + + - name: Stop Production App + run: | + if [ -f .pidfile_prod ]; then + kill "$(cat .pidfile_prod)" + fi + + - name: Start Development App + run: | + npm run serve & + echo $! > .pidfile_dev + + - name: Check if Development App is running + run: | + timeout=120 + echo "Starting development health check with ${timeout}s timeout" + while ! nc -z localhost 4321 && [ $timeout -gt 0 ]; do + sleep 1 + timeout=$((timeout-1)) + if [ $((timeout % 10)) -eq 0 ]; then + echo "Still waiting for development app to start... ${timeout}s remaining" + fi + done + + if [ $timeout -eq 0 ]; then + echo "Timeout waiting for development application to start" + exit 1 + fi + echo "Development app started successfully" + + - name: Stop Development App + if: always() + run: | + if [ -f .pidfile_dev ]; then + kill "$(cat .pidfile_dev)" + fi + Docker-Start-Check: name: Check if Talawa Admin app starts in Docker runs-on: ubuntu-latest