Skip to content

Commit

Permalink
Update CI/CD workflow for Playwright tests
Browse files Browse the repository at this point in the history
- Remove staging deployment job
- Adjust production deployment conditions
- Update workflow name to reflect current purpose

This commit updates our GitHub Actions workflow to focus on
running Playwright tests and deploying to production.
  • Loading branch information
ad956 committed Jul 15, 2024
1 parent 3f2d9d7 commit 5127409
Showing 1 changed file with 39 additions and 19 deletions.
58 changes: 39 additions & 19 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
name: Playwright Tests and Vercel Deployment
name: CI/CD Pipeline For Playwright Tests and Vercel Deployment

on:
push:
branches: [main, master]
branches: [main]
pull_request:
branches: [main, master]
branches: [main]

jobs:
deploy-and-test:
timeout-minutes: 60
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -17,24 +16,45 @@ jobs:
node-version: 18
- name: Install dependencies
run: npm ci
- name: Install Vercel CLI
run: npm install --global vercel@canary
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run linter
run: npm run lint
- name: Run Playwright tests
run: npx playwright test
run: npm test
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30
- name: Rollback Deployment on Test Failure
if: ${{ failure() }}
run: vercel rollback --token=${{ secrets.VERCEL_TOKEN }}

# deploy-staging:
# needs: test
# if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with:
# node-version: 18
# - name: Install Vercel CLI
# run: npm install --global vercel@latest
# - name: Pull Vercel Environment Information
# run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
# - name: Deploy to Vercel Staging
# run: vercel deploy --token=${{ secrets.VERCEL_TOKEN }}

deploy-production:
needs: test
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy to Vercel
run: vercel deploy --token=${{ secrets.VERCEL_TOKEN }}

0 comments on commit 5127409

Please sign in to comment.