Skip to content

Commit

Permalink
build: Split GitHub workflows, configure production deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
iliubinskii committed Jul 8, 2024
1 parent e900a19 commit e78cc92
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 20 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Lint with ESLint

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

jobs:
lint:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Lint with ESLint
run: npm run lint-no-fix
12 changes: 10 additions & 2 deletions .github/workflows/jest.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: Jest Tests
name: Test with Jest

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

jobs:
test:
timeout-minutes: 60
Expand Down Expand Up @@ -45,5 +47,11 @@ jobs:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Run Jest tests
- name: Test with Jest
run: npm test
- uses: actions/upload-artifact@v4
if: always()
with:
name: jest-report
path: jest-report/
retention-days: 30
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: Linters
name: Lint with StyleLint

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

jobs:
lint:
timeout-minutes: 60
Expand All @@ -16,9 +18,5 @@ jobs:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Lint with TypeScript
run: npm run type-check
- name: Lint with ESLint
run: npm run lint-no-fix
- name: Lint with StyleLint
run: npm run lint-style-no-fix
22 changes: 22 additions & 0 deletions .github/workflows/typescript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Check with TypeScript

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

jobs:
check:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Check with TypeScript
run: npm run type-check
20 changes: 20 additions & 0 deletions .github/workflows/vercel-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Deploy to Vercel production

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

jobs:
deploy:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Deploy to Vercel production
uses: amondnet/vercel-action@v25
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ vars.VERCEL_ORG_ID }}
vercel-project-id: ${{ vars.VERCEL_PROJECT_ID }}
vercel-args: --prod
29 changes: 16 additions & 13 deletions .github/workflows/playwright.yml → .github/workflows/vercel.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,52 @@
name: Deploy and Test
name: Deploy to Vercel preview and test with Playwright

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

jobs:
deploy:
timeout-minutes: 60
runs-on: ubuntu-latest
outputs:
url: ${{ steps.deploy.outputs.preview-url }}
steps:
- uses: actions/checkout@v2
- name: Deploy to Vercel
- name: Deploy to Vercel preview
id: deploy
uses: amondnet/vercel-action@v25
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ vars.VERCEL_ORG_ID }}
vercel-project-id: ${{ vars.VERCEL_PROJECT_ID }}
vercel-args: ${{ github.ref == 'refs/heads/master' && '--prod' || '' }}

test:
needs: deploy
runs-on: ubuntu-latest
timeout-minutes: 60
runs-on: ubuntu-latest
environment: preview
env:
BASE_URL: ${{ needs.deploy.outputs.url }}
JWT_ADMIN_EMAIL: ${{ secrets.JWT_ADMIN_EMAIL }}
JWT_EMAIL: ${{ secrets.JWT_EMAIL }}
JWT_ADMIN_EMAIL: ${{ vars.JWT_ADMIN_EMAIL }}
JWT_EMAIL: ${{ vars.JWT_EMAIL }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}
steps:
- name: Output environment variables
run: |
echo "CI is $CI"
echo "BASE_URL is $BASE_URL"
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Output environment variables
run: |
echo "CI is $CI"
echo "BASE_URL is $BASE_URL"
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
- name: Install Playwright browsers
run: npx playwright install chromium --with-deps
- name: Run Playwright tests
- name: Test with Playwright
run: npx playwright test
- uses: actions/upload-artifact@v4
if: always()
Expand Down

0 comments on commit e78cc92

Please sign in to comment.