From 5fb5e48d4c1de4c42b9018b9bfbe57e332918f88 Mon Sep 17 00:00:00 2001 From: Kezhik Kyzyl-ool Date: Tue, 23 Apr 2024 13:53:19 +0200 Subject: [PATCH 1/7] ci: local sb tests --- .github/workflows/pr-storybook-tests.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pr-storybook-tests.yml b/.github/workflows/pr-storybook-tests.yml index 7198f7d67a..2c2dabd216 100644 --- a/.github/workflows/pr-storybook-tests.yml +++ b/.github/workflows/pr-storybook-tests.yml @@ -1,10 +1,7 @@ name: PR Storybook Tests on: - workflow_run: - workflows: ['PR Preview Deploy'] - types: - - completed + pull_request: jobs: tests: @@ -19,7 +16,11 @@ jobs: run: npm ci - name: Install Playwright Browsers run: npx playwright install --with-deps - - name: Storybook Tests - env: - PR_PREVIEW_URL: "https://preview.gravity-ui.com/uikit/${{github.event.pull_request.number}}" + - name: Build Storybook Static + run: npm run build-storybook + - name: Run Storybook Tests Locally + uses: Eun/http-server-action@v1.0.11 + with: + directory: storybook-static + port: 7007 run: npm run test-storybook From 63c3bd09430017fa8e7c9ba49870ee52a421fd75 Mon Sep 17 00:00:00 2001 From: Kezhik Kyzyl-ool Date: Tue, 23 Apr 2024 13:55:50 +0200 Subject: [PATCH 2/7] ci: local sb tests --- .github/workflows/pr-storybook-tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-storybook-tests.yml b/.github/workflows/pr-storybook-tests.yml index 2c2dabd216..77652adc51 100644 --- a/.github/workflows/pr-storybook-tests.yml +++ b/.github/workflows/pr-storybook-tests.yml @@ -18,9 +18,10 @@ jobs: run: npx playwright install --with-deps - name: Build Storybook Static run: npm run build-storybook - - name: Run Storybook Tests Locally + - name: Serve Storybook Static uses: Eun/http-server-action@v1.0.11 with: directory: storybook-static port: 7007 + - name: Run Storybook Tests run: npm run test-storybook From 641654adf811e51d1e33acd8b5c8376e2a0a996e Mon Sep 17 00:00:00 2001 From: Kezhik Kyzyl-ool Date: Tue, 23 Apr 2024 14:00:09 +0200 Subject: [PATCH 3/7] ci: local sb tests --- .github/workflows/pr-storybook-tests.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pr-storybook-tests.yml b/.github/workflows/pr-storybook-tests.yml index 77652adc51..81e9c83c7c 100644 --- a/.github/workflows/pr-storybook-tests.yml +++ b/.github/workflows/pr-storybook-tests.yml @@ -18,10 +18,8 @@ jobs: run: npx playwright install --with-deps - name: Build Storybook Static run: npm run build-storybook - - name: Serve Storybook Static - uses: Eun/http-server-action@v1.0.11 - with: - directory: storybook-static - port: 7007 - - name: Run Storybook Tests - run: npm run test-storybook + - name: Serve Storybook and run tests + run: | + npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \ + "npx http-server storybook-static --port 7007 --silent" \ + "npx wait-on tcp:6006 && npm run test-storybook" From ad6be9877e3481937b83ad175be50b97bf5a1a51 Mon Sep 17 00:00:00 2001 From: Kezhik Kyzyl-ool Date: Tue, 23 Apr 2024 14:00:28 +0200 Subject: [PATCH 4/7] ci: local sb tests --- .github/workflows/pr-storybook-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-storybook-tests.yml b/.github/workflows/pr-storybook-tests.yml index 81e9c83c7c..a472bcf6f2 100644 --- a/.github/workflows/pr-storybook-tests.yml +++ b/.github/workflows/pr-storybook-tests.yml @@ -22,4 +22,4 @@ jobs: run: | npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \ "npx http-server storybook-static --port 7007 --silent" \ - "npx wait-on tcp:6006 && npm run test-storybook" + "npx wait-on tcp:7007 && npm run test-storybook" From eb5e6e265d83f0fcbda54ba13abde7a5d1ed63a8 Mon Sep 17 00:00:00 2001 From: Kezhik Kyzyl-ool Date: Tue, 23 Apr 2024 14:12:44 +0200 Subject: [PATCH 5/7] ci: local sb tests --- .github/workflows/pr-storybook-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-storybook-tests.yml b/.github/workflows/pr-storybook-tests.yml index a472bcf6f2..dfa108ac8c 100644 --- a/.github/workflows/pr-storybook-tests.yml +++ b/.github/workflows/pr-storybook-tests.yml @@ -22,4 +22,4 @@ jobs: run: | npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \ "npx http-server storybook-static --port 7007 --silent" \ - "npx wait-on tcp:7007 && npm run test-storybook" + "npx wait-on http://127.0.0.1:7007 && npm run test-storybook" From a8a8a8044ab989428559aa603e31294dc7587013 Mon Sep 17 00:00:00 2001 From: Kezhik Kyzyl-ool Date: Tue, 23 Apr 2024 14:23:12 +0200 Subject: [PATCH 6/7] ci: local sb tests --- .github/workflows/pr-storybook-tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pr-storybook-tests.yml b/.github/workflows/pr-storybook-tests.yml index dfa108ac8c..f5a4dc2ecb 100644 --- a/.github/workflows/pr-storybook-tests.yml +++ b/.github/workflows/pr-storybook-tests.yml @@ -23,3 +23,5 @@ jobs: npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \ "npx http-server storybook-static --port 7007 --silent" \ "npx wait-on http://127.0.0.1:7007 && npm run test-storybook" + env: + PR_PREVIEW_URL: http://127.0.0.1:7007 From da28e049243393034ac25f4b54a911e0f778199a Mon Sep 17 00:00:00 2001 From: Kezhik Kyzyl-ool Date: Tue, 23 Apr 2024 14:58:37 +0200 Subject: [PATCH 7/7] fix: reusing PR_PREVIEW_URL --- .github/workflows/pr-storybook-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-storybook-tests.yml b/.github/workflows/pr-storybook-tests.yml index f5a4dc2ecb..2b62c692e1 100644 --- a/.github/workflows/pr-storybook-tests.yml +++ b/.github/workflows/pr-storybook-tests.yml @@ -22,6 +22,6 @@ jobs: run: | npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \ "npx http-server storybook-static --port 7007 --silent" \ - "npx wait-on http://127.0.0.1:7007 && npm run test-storybook" + "npx wait-on $PR_PREVIEW_URL && npm run test-storybook" env: PR_PREVIEW_URL: http://127.0.0.1:7007