Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricve committed Apr 27, 2024
2 parents 606c66c + 7000ec0 commit 6c046f3
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 16 deletions.
29 changes: 15 additions & 14 deletions .github/workflows/buildAutomation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ name: Verify and build next.js application

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

jobs:
build:
Expand All @@ -23,18 +24,18 @@ jobs:
run: npm run build
- name: test
run: npm run test
- name: cache
uses: actions/cache@v4
with:
# See here for caching with `yarn` https://github.com/actions/cache/blob/main/examples.md#node---yarn or you can leverage caching with actions/setup-node https://github.com/actions/setup-node
path: |
~/.npm
${{ github.workspace }}/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
# - name: cache
# uses: actions/cache@v4
# with:
# # See here for caching with `yarn` https://github.com/actions/cache/blob/main/examples.md#node---yarn or you can leverage caching with actions/setup-node https://github.com/actions/setup-node
# path: |
# ~/.npm
# ${{ github.workspace }}/.next/cache
# # Generate a new cache whenever packages or source files change.
# key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
# # If source files changed but packages didn't, rebuild from a prior cache.
# restore-keys: |
# ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
# For deployment:
- name: upload static website
uses: actions/upload-artifact@v4
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Playwright Tests
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest

defaults:
run:
working-directory: ui

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npx playwright test
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30
7 changes: 6 additions & 1 deletion ui/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ module.exports = {
},
// Add more setup options before each test is run
// setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
testPathIgnorePatterns: ["<rootDir>/node_modules/", "<rootDir>/.next/"],
testPathIgnorePatterns: [
"<rootDir>/node_modules/",
"<rootDir>/.next/",
"<rootDir>/end-to-end-tests/",
"<rootDir>/tests-examples/",
],
testEnvironment: "jsdom",
transform: {
// Use babel-jest to transpile tests with the next/babel preset
Expand Down
3 changes: 2 additions & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"lint": "next lint",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"test": "jest && playwright test"
"test": "jest",
"playwright-test": "npx playwright test"
},
"dependencies": {
"next": "14.2.2",
Expand Down

0 comments on commit 6c046f3

Please sign in to comment.