From 593d7b4443bdadb518c31ac131b35aaa1656dd66 Mon Sep 17 00:00:00 2001 From: Nils Christian Bonnevie Date: Tue, 19 Mar 2024 14:34:40 +0100 Subject: [PATCH 01/10] Add action to updates smoke tests. --- .github/workflows/typescript.yml | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/.github/workflows/typescript.yml b/.github/workflows/typescript.yml index 86866d822..786989ff2 100644 --- a/.github/workflows/typescript.yml +++ b/.github/workflows/typescript.yml @@ -143,3 +143,39 @@ 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 docker:storybook:test:update" From c0070cdbcddf4161b6f3ff0d63e485baae722010 Mon Sep 17 00:00:00 2001 From: Nils Christian Bonnevie Date: Wed, 20 Mar 2024 12:15:18 +0100 Subject: [PATCH 02/10] Updated script --- .github/workflows/typescript.yml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/typescript.yml b/.github/workflows/typescript.yml index 786989ff2..6402a7365 100644 --- a/.github/workflows/typescript.yml +++ b/.github/workflows/typescript.yml @@ -170,7 +170,6 @@ jobs: run: npm run build-storybook - name: Run smoke tests - env: PORT: 8080 HOST: 127.0.0.1 @@ -179,3 +178,25 @@ 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 docker:storybook:test:update" + + # upload the failure screenshots for reference + - name: upload artifacts + uses: actions/upload-artifact@v2 + if: github.event_name != 'release' && failure() + 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 + From a28fd34dd470acfb05b468a422e521205babd5b6 Mon Sep 17 00:00:00 2001 From: Nils Christian Bonnevie Date: Wed, 20 Mar 2024 12:37:16 +0100 Subject: [PATCH 03/10] fix --- .github/workflows/typescript.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/typescript.yml b/.github/workflows/typescript.yml index 6402a7365..d506afbd6 100644 --- a/.github/workflows/typescript.yml +++ b/.github/workflows/typescript.yml @@ -177,7 +177,8 @@ jobs: 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 docker:storybook:test:update" + "npx wait-on http://$HOST:$PORT/ && npm run storybook:test -- --updateSnapshot --ci --url http://$HOST:$PORT/" + # upload the failure screenshots for reference - name: upload artifacts From 82af726aa5f9f03d7e05dff039651269a88124b8 Mon Sep 17 00:00:00 2001 From: Nils Christian Bonnevie Date: Wed, 20 Mar 2024 13:39:42 +0100 Subject: [PATCH 04/10] trigger soketests fail --- .../packages/subsurface-viewer/src/layers/axes2d/axes2DLayer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typescript/packages/subsurface-viewer/src/layers/axes2d/axes2DLayer.ts b/typescript/packages/subsurface-viewer/src/layers/axes2d/axes2DLayer.ts index f1b25d149..bf5b2ba25 100644 --- a/typescript/packages/subsurface-viewer/src/layers/axes2d/axes2DLayer.ts +++ b/typescript/packages/subsurface-viewer/src/layers/axes2d/axes2DLayer.ts @@ -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, From e49b76e49b2f9466dd4c3f681a9b49244f279c3d Mon Sep 17 00:00:00 2001 From: Nils Christian Bonnevie Date: Thu, 21 Mar 2024 09:08:35 +0100 Subject: [PATCH 05/10] Test --- .github/workflows/typescript.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/typescript.yml b/.github/workflows/typescript.yml index d506afbd6..8d766225f 100644 --- a/.github/workflows/typescript.yml +++ b/.github/workflows/typescript.yml @@ -181,18 +181,18 @@ jobs: # upload the failure screenshots for reference - - name: upload artifacts - uses: actions/upload-artifact@v2 - if: github.event_name != 'release' && failure() - with: - name: smoke-screenshots - path: typescript/packages/**/__image_snapshots__/*.png - retention-days: 5 + # - name: upload artifacts + # uses: actions/upload-artifact@v4 + # if: github.event_name != 'release' + # 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() + 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]')) 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 }} From f2bb5e2ee615e99a31b6bb9a240917c83808ec5a Mon Sep 17 00:00:00 2001 From: Nils Christian Bonnevie Date: Thu, 21 Mar 2024 09:38:59 +0100 Subject: [PATCH 06/10] remove: "steps.check_file_changed.outputs.status == 'true' && ..." --- .github/workflows/typescript.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/typescript.yml b/.github/workflows/typescript.yml index 8d766225f..bf0c84de9 100644 --- a/.github/workflows/typescript.yml +++ b/.github/workflows/typescript.yml @@ -192,7 +192,7 @@ jobs: - 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]')) + if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || contains(github.event.head_commit.message, '[deploy test]')) 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 }} From 94f9b7e61bbb76b0891553840ff68ab6f5a10874 Mon Sep 17 00:00:00 2001 From: Nils Christian Bonnevie Date: Thu, 21 Mar 2024 12:28:33 +0100 Subject: [PATCH 07/10] Test --- .github/workflows/typescript.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/typescript.yml b/.github/workflows/typescript.yml index bf0c84de9..9d0c46b6f 100644 --- a/.github/workflows/typescript.yml +++ b/.github/workflows/typescript.yml @@ -192,7 +192,7 @@ jobs: - name: Create Pull Request id: cpr uses: peter-evans/create-pull-request@5a6b15373e5788c38d83296b674ad5abea28085c - if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || contains(github.event.head_commit.message, '[deploy test]')) + if: github.event_name == 'push' && (github.ref != 'refs/heads/master' || contains(github.event.head_commit.message, '[deploy test]')) 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 }} From b0349423b21ce72eda1b87f406e185b893e159f5 Mon Sep 17 00:00:00 2001 From: Havard Bjerke Date: Wed, 27 Mar 2024 07:41:31 +0100 Subject: [PATCH 08/10] ci: run snapshots update on push to PR --- .github/workflows/typescript.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/typescript.yml b/.github/workflows/typescript.yml index 9d0c46b6f..8e82baf8b 100644 --- a/.github/workflows/typescript.yml +++ b/.github/workflows/typescript.yml @@ -144,9 +144,10 @@ jobs: "npx http-server storybook-static --port $PORT -a $HOST" \ "npx wait-on http://$HOST:$PORT/ && npm run storybook:test -- --ci --url http://$HOST:$PORT/" + # Update story smoke test snapshots 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' + # Run on push to PR + if: github.event_name == 'push' && github.ref != 'refs/heads/master' runs-on: ubuntu-latest name: "Storybook Smoke Tests Update" @@ -179,7 +180,6 @@ jobs: "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/" - # upload the failure screenshots for reference # - name: upload artifacts # uses: actions/upload-artifact@v4 @@ -200,4 +200,3 @@ jobs: base: smoke-snaps reviewers: ${{ github.event.sender.login }} delete-branch: true - From 6a7c4507991e1189237379db2fb294ef8fa6bb3c Mon Sep 17 00:00:00 2001 From: Havard Bjerke Date: Wed, 27 Mar 2024 07:51:38 +0100 Subject: [PATCH 09/10] Revert "ci: run snapshots update on push to PR" This reverts commit b0349423b21ce72eda1b87f406e185b893e159f5. --- .github/workflows/typescript.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/typescript.yml b/.github/workflows/typescript.yml index 8e82baf8b..9d0c46b6f 100644 --- a/.github/workflows/typescript.yml +++ b/.github/workflows/typescript.yml @@ -144,10 +144,9 @@ jobs: "npx http-server storybook-static --port $PORT -a $HOST" \ "npx wait-on http://$HOST:$PORT/ && npm run storybook:test -- --ci --url http://$HOST:$PORT/" - # Update story smoke test snapshots smoke_tests_update: - # Run on push to PR - if: github.event_name == 'push' && github.ref != 'refs/heads/master' + # 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" @@ -180,6 +179,7 @@ jobs: "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/" + # upload the failure screenshots for reference # - name: upload artifacts # uses: actions/upload-artifact@v4 @@ -200,3 +200,4 @@ jobs: base: smoke-snaps reviewers: ${{ github.event.sender.login }} delete-branch: true + From ea2f531c5b3916a6c08800de2c10d0d78925fee7 Mon Sep 17 00:00:00 2001 From: Havard Bjerke Date: Wed, 27 Mar 2024 07:54:29 +0100 Subject: [PATCH 10/10] ci: trigger snapshot update on PR changes --- .github/workflows/typescript.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/typescript.yml b/.github/workflows/typescript.yml index 9d0c46b6f..32a2ebbad 100644 --- a/.github/workflows/typescript.yml +++ b/.github/workflows/typescript.yml @@ -179,7 +179,6 @@ jobs: "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/" - # upload the failure screenshots for reference # - name: upload artifacts # uses: actions/upload-artifact@v4 @@ -192,7 +191,7 @@ jobs: - name: Create Pull Request id: cpr uses: peter-evans/create-pull-request@5a6b15373e5788c38d83296b674ad5abea28085c - if: github.event_name == 'push' && (github.ref != 'refs/heads/master' || contains(github.event.head_commit.message, '[deploy test]')) + if: github.event_name == 'pull_request' && (github.ref != 'refs/heads/master' || contains(github.event.head_commit.message, '[deploy test]')) 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 }} @@ -200,4 +199,3 @@ jobs: base: smoke-snaps reviewers: ${{ github.event.sender.login }} delete-branch: true -