Skip to content

Commit

Permalink
ci: deploy e2e report to firebase
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode committed Nov 12, 2024
1 parent ce1af38 commit 8e3e23d
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 21 deletions.
15 changes: 15 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"projects": {},
"targets": {
"taiga-editor": {
"hosting": {
"taiga-editor": [
"taiga-editor"
],
"taiga-editor-e2e-report": [
"taiga-editor-e2e-report"
]
}
}
}
}
1 change: 0 additions & 1 deletion .github/workflows/build-demo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: ⚙️ Build demo
on:
pull_request:
push:
branches:
- main
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 🚀 Deploy
name: 🚀 Deploy on prod
on:
push:
branches: [main]
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 🚀 Deploy / preview
name: 🚀 Deploy on staging
on: pull_request

jobs:
Expand All @@ -10,14 +10,14 @@ jobs:
- uses: taiga-family/ci/actions/setup/[email protected]
- uses: taiga-family/ci/actions/setup/[email protected]
- run: npx nx build editor-demo
- name: Deploy preview
uses: FirebaseExtended/action-hosting-deploy@v0
- uses: FirebaseExtended/action-hosting-deploy@v0
continue-on-error: true
if: ${{ env.IS_FORK == 'false' && env.IS_DEPENDABOT == 'false' }}
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_TUI_EDITOR }}
projectId: taiga-editor
target: taiga-editor
expires: 1d

concurrency:
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ jobs:
compression-level: 0
retention-days: 1

- name: Deploy report
uses: FirebaseExtended/action-hosting-deploy@v0
continue-on-error: true
if: ${{ env.IS_FORK == 'false' && env.IS_DEPENDABOT == 'false' }}
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_TUI_EDITOR }}
projectId: taiga-editor
target: taiga-editor-e2e-report
expires: 1d

- id: diff-checker
run: |
echo "diff_exist=$(find ./projects/demo-playwright/tests-results -regex '.*diff\.png$' | wc -l | sed -e 's/^[[:space:]]*//')" >> $GITHUB_OUTPUT
Expand Down
35 changes: 25 additions & 10 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
{
"hosting": {
"public": "dist/demo/browser",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
"$schema": "https://raw.githubusercontent.com/firebase/firebase-tools/master/schema/firebase-config.json",
"hosting": [
{
"target": "taiga-editor",
"public": "dist/demo/browser",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
},
{
"target": "taiga-editor-e2e-report",
"public": "projects/demo-playwright/tests-report",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
]
}
6 changes: 1 addition & 5 deletions projects/demo-playwright/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import {defineConfig, devices} from '@playwright/test';

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: __dirname,
testMatch: '**/*.spec.ts',
outputDir: 'tests-results',
snapshotDir: 'snapshots',
reporter: process.env.CI ? 'github' : [['html', {outputFolder: 'tests-report'}]],
reporter: [['html', {outputFolder: 'tests-report'}]],
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
workers: process.env.CI ? '100%' : '50%',
Expand Down
2 changes: 1 addition & 1 deletion projects/demo-playwright/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"e2e-ui": {
"executor": "nx:run-commands",
"options": {
"command": "nx e2e editor-demo-playwright -- --ui --debug --update-snapshots"
"command": "nx e2e editor-demo-playwright --ui --debug --update-snapshots"
}
}
}
Expand Down

0 comments on commit 8e3e23d

Please sign in to comment.