Skip to content

Commit

Permalink
ci: Use reg-actions for visual regression testing
Browse files Browse the repository at this point in the history
  • Loading branch information
MoritzWeber0 committed Sep 14, 2024
1 parent 62eb891 commit f938997
Show file tree
Hide file tree
Showing 5 changed files with 17,103 additions and 12,746 deletions.
26 changes: 21 additions & 5 deletions .github/workflows/storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,27 @@ on:
- '.github/workflows/storybook.yml'

jobs:
chromatic:
visual-testing:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: npm install storycap puppeteer http-server
working-directory: ./frontend
- name: Build Storybook
run: npx -p @angular/cli ng run capellacollab:build-storybook
working-directory: ./frontend
- name: Capture screenshots
run:
npx storycap --serverCmd "npx http-server storybook-static -p 9001"
http://localhost:9001
working-directory: ./frontend
- uses: reg-viz/reg-actions@v2
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
image-directory-path: './frontend/__screenshots__'

deploy:
runs-on: ubuntu-latest
# prettier-ignore
if:
Expand Down Expand Up @@ -54,16 +74,12 @@ jobs:
- name: Install dependencies
run: npm ci
working-directory: ./frontend
- name: Build Storybook
run: npx -p @angular/cli ng run capellacollab:build-storybook
working-directory: ./frontend
- name: Run Chromatic
id: chromatic
uses: chromaui/action@latest
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
workingDir: ./frontend
storybookBuildDir: ./storybook-static
onlyChanged: true
- name: Create Storybook comment (initial)
if: github.event_name == 'pull_request'
Expand Down
2 changes: 2 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,5 @@ storybook-static
documentation.json

.nx

__screenshots__
2 changes: 0 additions & 2 deletions frontend/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,6 @@
"builder": "@storybook/angular:build-storybook",
"options": {
"configDir": ".storybook",
"webpackStatsJson": true,

"browserTarget": "capellacollab:build:storybook",
"compodoc": true,
"compodocArgs": ["-e", "json", "-d", "."],
Expand Down
Loading

0 comments on commit f938997

Please sign in to comment.