Skip to content

Commit

Permalink
chore: use nx in workflows (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-jonas authored Aug 7, 2024
1 parent 28477dd commit d7d89c0
Show file tree
Hide file tree
Showing 12 changed files with 5,635 additions and 5,168 deletions.
32 changes: 12 additions & 20 deletions .github/workflows/playwright-e2e.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,25 @@
name: Playwright E2E Tests
name: Pull Request - Lint/Build/Tests
on:
push:
branches: [main, master]
branches: [main]
pull_request:
branches: [main, master]
branches: [main]
jobs:
test:
timeout-minutes: 60
pull_request:
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: "18"
node-version: "20"
- name: Install dependencies
run: npm ci
- name: Lerna initialize
run: npm run initialize
- name: Lerna build
run: npm run build:clean
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Install Ory CLI
run: make .bin/ory
- name: Run examples/react-spa tests
run: cd examples/react-spa && npm run test
- uses: nrwl/nx-set-shas@v4
- run: npx playwright install --with-deps
- run: npx nx affected -t lint test build
- uses: actions/upload-artifact@v2
if: always()
with:
Expand All @@ -35,8 +28,6 @@ jobs:
examples/react-spa/playwright-report/
examples/react-spa/test-results/
retention-days: 7
- name: Run examples/preact-spa tests
run: cd examples/preact-spa && npm run test
- uses: actions/upload-artifact@v2
if: always()
with:
Expand All @@ -45,8 +36,6 @@ jobs:
examples/preact-spa/playwright-report/
examples/preact-spa/test-results/
retention-days: 7
- name: Run examples/nextjs-spa tests
run: cd examples/nextjs-spa && npm run test
- uses: actions/upload-artifact@v2
if: always()
with:
Expand All @@ -55,3 +44,6 @@ jobs:
examples/nextjs-spa/playwright-report/
examples/nextjs-spa/test-results/
retention-days: 7
- uses: chromaui/action@v11
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
13 changes: 7 additions & 6 deletions .github/workflows/chromatic.yml → .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: "Chromatic"
name: "Main - Lint/Build/Tests"

on:
push:
branches:
- main

jobs:
deploy:
Expand All @@ -12,11 +14,10 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: "16"
- name: Lerna initialize
run: npm run initialize
- name: Lerna build
run: npm run build:clean
node-version: "20"
- run: npm ci
- run: npx playwright install --with-deps
- run: npx nx run-many --target=build --all
- name: Publish to Chromatic
uses: chromaui/action@v1
with:
Expand Down
33 changes: 0 additions & 33 deletions .github/workflows/playwright.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
token: ${{ secrets.ORY_BOT_PAT }}
- uses: actions/setup-node@v3
with:
node-version: "16"
node-version: "20"
- run: npm run initialize
- run: npm run build:clean
- run: git checkout main
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ pnpm-lock.yaml
/test-results/
/playwright-report/
/playwright/.cache/
.nx/
11 changes: 5 additions & 6 deletions examples/nextjs-spa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,18 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
"test": "playwright test",
"debug": "playwright test --ui"
},
"dependencies": {
"@next/font": "13.4.13",
"@types/node": "18.16.19",
"@types/react": "18.2.20",
"@types/react-dom": "18.2.7",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"eslint": "8.32.0",
"eslint-config-next": "13.1.5",
"next": "13.5.6",
"react": "18.2.0",
"react-dom": "18.2.0",
"next": "14.2.5",
"react": "18.3.1",
"react-dom": "18.3.1",
"typescript": "5.2.2",
"vite": "4.5.2"
},
Expand Down
4 changes: 2 additions & 2 deletions examples/nextjs-spa/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ export default defineConfig({
env: {
NEXT_PUBLIC_ORY_SDK_URL: "http://localhost:4000",
},
command: "npm run build && npm run start -- --port 3100",
command: "npm run build && npm run start -- --port 3300",
timeout: 120 * 1000,
port: 3100,
port: 3300,
reuseExistingServer: !process.env.CI,
},
],
Expand Down
24 changes: 24 additions & 0 deletions examples/nextjs-spa/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"targets": {
"e2e": {
"command": "playwright test",
"dependsOn": ["build"],
"options": {
"cwd": "examples/nextjs-spa"
}
},
"lint": {
"command": "next lint",
"options": {
"cwd": "examples/nextjs-spa"
}
},
"build": {
"command": "next build",
"dependsOn": ["lint"],
"options": {
"cwd": "examples/nextjs-spa"
}
}
}
}
8 changes: 4 additions & 4 deletions examples/react-spa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
"debug": "playwright test --ui"
},
"dependencies": {
"react": "18.2.0",
"react-dom": "18.2.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-router-dom": "6.8.0"
},
"devDependencies": {
"@ory/elements": "*",
"@ory/elements-test": "*",
"@playwright/test": "1.38.0",
"@types/react": "18.2.14",
"@types/react-dom": "18.2.6",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"@typescript-eslint/eslint-plugin": "5.49.0",
"@vitejs/plugin-react": "4.0.3",
"eslint": "8.33.0",
Expand Down
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
}
},
"affected": {
"defaultBase": "master"
"defaultBase": "main"
}
}
Loading

0 comments on commit d7d89c0

Please sign in to comment.