config playwright #20
This file contains 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: CI/CD | |
on: | |
push: | |
branches: | |
- main | |
- staging | |
pull_request: | |
branches: | |
- main | |
- staging | |
jobs: | |
test_unit: | |
name: 🧪 Unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: ⬇️ Checkout repo | |
uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: lts/* | |
- name: Install dependencies | |
run: npm ci | |
- name: 🧪 Run unit tests | |
run: npm run test:unit | |
test_e2e: | |
name: 🧪 🧪 E2E tests | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
steps: | |
- name: ⬇️ Checkout repo | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Install dependencies | |
run: npm ci | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
- name: 🧪 Run e2e tests | |
run: npm run test:e2e | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 | |
deploy: | |
name: 🚀 Deploy | |
runs-on: ubuntu-latest | |
needs: test_e2e | |
steps: | |
- name: ⬇️ Checkout repo | |
uses: actions/checkout@v3 | |
- name: 👀 Read app name | |
uses: SebRollen/toml-action@v1.0.2 | |
id: app_name | |
with: | |
file: "fly.toml" | |
field: "app" | |
- name: 🚀 Deploy Staging | |
if: ${{ github.ref == 'refs/heads/staging' }} | |
uses: superfly/flyctl-actions@1.3 | |
with: | |
args: "deploy --remote-only --app ${{ steps.app_name.outputs.value }}-staging" | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
- name: 🚀 Deploy Production | |
if: ${{ github.ref == 'refs/heads/main' }} | |
uses: superfly/flyctl-actions@1.3 | |
with: | |
args: "deploy --remote-only" | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |