Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Add action to update smoke tests. #1975

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
58 changes: 58 additions & 0 deletions .github/workflows/typescript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,61 @@ jobs:
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
"npx http-server storybook-static --port $PORT -a $HOST" \
"npx wait-on http://$HOST:$PORT/ && npm run storybook:test -- --ci --url http://$HOST:$PORT/"

smoke_tests_update:
# Run on all events defined above, except pushes which are not to master
if: github.event_name != 'push' || github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
name: "Storybook Smoke Tests Update"

container:
image: mcr.microsoft.com/playwright:v1.39.0-jammy
options: --user 1001

steps:
- name: 📖 Checkout commit locally
uses: actions/checkout@v3

- name: 📦 Install build dependencies
run: |
npm ci CYPRESS_INSTALL_BINARY=0 --ignore-scripts

- name: 🏗️ Build packages
run: |
npx nx run-many -t build

- name: 📚 Build Storybook
run: npm run build-storybook

- name: Run smoke tests
env:
PORT: 8080
HOST: 127.0.0.1

run: |
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
"npx http-server storybook-static --port $PORT -a $HOST" \
"npx wait-on http://$HOST:$PORT/ && npm run storybook:test -- --updateSnapshot --ci --url http://$HOST:$PORT/"
hkfb marked this conversation as resolved.
Show resolved Hide resolved


# upload the failure screenshots for reference
- name: upload artifacts
uses: actions/upload-artifact@v2
hkfb marked this conversation as resolved.
Show resolved Hide resolved
if: github.event_name != 'release' && failure()
hkfb marked this conversation as resolved.
Show resolved Hide resolved
with:
name: smoke-screenshots
path: typescript/packages/**/__image_snapshots__/*.png
retention-days: 5

- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@5a6b15373e5788c38d83296b674ad5abea28085c
if: steps.check_file_changed.outputs.status == 'true' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || contains(github.event.head_commit.message, '[deploy test]')) && failure()
with:
commit-message: updated smoke snapshots
title: Smoke tests - New Snapshots generated for the commit "${{ github.event.head_commit.message }}" by ${{ github.event.commits[0].author.email }}
body: This is an auto-generated PR to update smoke snapshots.
base: smoke-snaps
reviewers: ${{ github.event.sender.login }}
delete-branch: true

Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const defaultProps = {
id: "axes2d-layer",
visible: true,
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
marginH: 80, // Horizontal margin (in pixles)
marginH: 81, // Horizontal margin (in pixles)
marginV: 30, // Vertical margin (in pixles)
isLeftRuler: true,
isRightRuler: false,
Expand Down
Loading