Blog Post: How to Deploy NestJS to AWS Lambda Using CDK and GitHub Actions #73
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Visual Regression Tests | |
| on: | |
| pull_request: | |
| branches: [main, master] | |
| jobs: | |
| test: | |
| timeout-minutes: 60 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 21 | |
| - name: Install dependencies | |
| run: npm install -g yarn && yarn | |
| - name: Install Playwright Browsers | |
| run: yarn playwright install --with-deps | |
| - name: Wait for Netlify deployment (PR) | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| PREVIEW_URL="https://deploy-preview-${{ github.event.pull_request.number }}--ajeetchaulagain.netlify.app" | |
| echo "Waiting for $PREVIEW_URL to be ready..." | |
| for i in {1..20}; do | |
| if curl -f "$PREVIEW_URL" > /dev/null 2>&1; then | |
| echo "✓ Netlify preview is ready!" | |
| exit 0 | |
| fi | |
| echo "Attempt $i/20: Waiting for deployment..." | |
| sleep 10 | |
| done | |
| echo "✗ Deployment did not become ready in time" | |
| exit 1 | |
| - name: Run Playwright tests (PR preview) | |
| if: github.event_name == 'pull_request' | |
| run: PLAYWRIGHT_JSON_OUTPUT_NAME=results.json yarn playwright test --reporter=html --reporter=json | |
| id: test-run | |
| env: | |
| CI: true #Prevents snapshot updates on CI | |
| PLAYWRIGHT_TEST_BASE_URL: https://deploy-preview-${{ github.event.pull_request.number }}--ajeetchaulagain.netlify.app | |
| - uses: daun/playwright-report-summary@v3 | |
| if: always() | |
| with: | |
| report-file: results.json | |
| - uses: actions/upload-artifact@v4 | |
| if: ${{ !cancelled() }} | |
| with: | |
| name: playwright-report | |
| path: playwright-report/ | |
| retention-days: 30 |