Skip to content

Commit

Permalink
feat: add lint, format and test workflows for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
georgeeburt committed Dec 23, 2024
1 parent c8f9597 commit ac44586
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 11 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Format
on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]

jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'pnpm'

- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: latest

- name: Install dependencies
run: pnpm install

- name: Check formatting
run: npx prettier --check .

- name: Format code
if: failure()
run: npx prettier --write .
27 changes: 27 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Lint
on:
push:
branches: [dev]
pull_request:
branches: [main, dev]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'pnpm'

- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: latest

- name: Install dependencies
run: pnpm install

- name: Run ESLint
run: pnpm run lint
32 changes: 21 additions & 11 deletions .github/workflows/playwright.yml → .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,37 @@
name: Playwright Tests
name: Tests
on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'pnpm'

- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: latest

- name: Install dependencies
run: npm install -g pnpm && pnpm install
run: pnpm install

- name: Install Playwright Browsers
run: pnpm exec playwright install --with-deps
- name: Run Playwright tests
run: pnpm exec playwright test
run: pnpm exec playwright install chromium

- name: Run Tests
run: pnpm test

- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30
name: test-reports
path: |
playwright-report/
test-report/
retention-days: 5
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"start": "next start",
"lint": "next lint",
"format": "prettier --write .",
"format:check": "prettier --check .",
"test": "playwright test"
},
"dependencies": {
Expand Down

0 comments on commit ac44586

Please sign in to comment.