From 34ad06e6c34f0735440baf20071bc9fa454b2947 Mon Sep 17 00:00:00 2001 From: Nils Haberkamp Date: Mon, 5 Feb 2024 10:13:57 +0100 Subject: [PATCH 01/38] NEXT-33446 - add basic CI pipeline --- .github/workflows/tests.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 000000000..061f6a247 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,35 @@ +name: Tests + +on: + pull_request: + types: + - opened + - reopened + - synchronize + - closed + workflow_dispatch: + +jobs: + static-analysis: + name: Static Analysis + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '18' + - name: Retrieve the cached "node_modules" directory (if present) + uses: actions/cache@v3 + id: node-cache + with: + path: node_modules + key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }} + - name: Install dependencies (if the cached directory was not found) + if: steps.node-cache.outputs.cache-hit != 'true' + run: npm ci + - name: Perform typecheck + run: npm run lint:types + - name: Lint code + run: npm run lint:eslint From df4ab8c921f05407c737736ee8ee90cf9ff91374 Mon Sep 17 00:00:00 2001 From: Nils Haberkamp Date: Mon, 5 Feb 2024 10:21:49 +0100 Subject: [PATCH 02/38] NEXT-33446 - add command to check formatting --- package.json | 3 ++- packages/tokens/package.json | 1 + turbo.json | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 97a9613c4..6ce5d4fb5 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "lint:all": "turbo run lint:eslint", "lint:types": "turbo run lint:types", "lint:eslint": "turbo run lint:eslint", - "format": "turbo run format" + "format": "turbo run format", + "format:check": "turbo run format:check" }, "keywords": [], "license": "MIT", diff --git a/packages/tokens/package.json b/packages/tokens/package.json index 391cee77f..8e83dc591 100644 --- a/packages/tokens/package.json +++ b/packages/tokens/package.json @@ -8,6 +8,7 @@ "start": "node --env-file=\".env\" node_modules/.bin/tsx ./src/scripts/index.ts", "test": "node --env-file=\".env\" node_modules/.bin/vitest", "format": "prettier --write .", + "format:check": "prettier --check .", "lint:all": "npm run lint:eslint && npm run lint:types", "lint:eslint": "eslint .", "lint:types": "tsc --noEmit" diff --git a/turbo.json b/turbo.json index 300e4cd28..679c446a5 100644 --- a/turbo.json +++ b/turbo.json @@ -4,7 +4,7 @@ "lint:all": {}, "lint:types": {}, "lint:eslint": {}, - "format": {} + "format": {}, + "format:check": {} } } - \ No newline at end of file From 65c66bf3d852f7967b645eaf7157366a43c4efc2 Mon Sep 17 00:00:00 2001 From: Nils Haberkamp Date: Mon, 5 Feb 2024 10:23:33 +0100 Subject: [PATCH 03/38] NEXT-33446 - check formatting in CI pipeline --- .github/workflows/tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 061f6a247..117ea0dae 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -29,6 +29,8 @@ jobs: - name: Install dependencies (if the cached directory was not found) if: steps.node-cache.outputs.cache-hit != 'true' run: npm ci + - name: Check formatting + run: npm run format:check - name: Perform typecheck run: npm run lint:types - name: Lint code From e8cf63a5d6f354d55317f1d021c897a22a7e1e78 Mon Sep 17 00:00:00 2001 From: Nils Haberkamp Date: Mon, 5 Feb 2024 10:26:08 +0100 Subject: [PATCH 04/38] NEXT-33446 - rename script from test to test:unit --- packages/tokens/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/tokens/package.json b/packages/tokens/package.json index 8e83dc591..690c4c084 100644 --- a/packages/tokens/package.json +++ b/packages/tokens/package.json @@ -6,7 +6,7 @@ "type": "module", "scripts": { "start": "node --env-file=\".env\" node_modules/.bin/tsx ./src/scripts/index.ts", - "test": "node --env-file=\".env\" node_modules/.bin/vitest", + "test:unit": "node --env-file=\".env\" node_modules/.bin/vitest", "format": "prettier --write .", "format:check": "prettier --check .", "lint:all": "npm run lint:eslint && npm run lint:types", From 0c210f593b7d43d25c90725b76e80667725c30d7 Mon Sep 17 00:00:00 2001 From: Nils Haberkamp Date: Mon, 5 Feb 2024 10:26:24 +0100 Subject: [PATCH 05/38] NEXT-33446 - add job for unit testing --- .github/workflows/tests.yml | 21 +++++++++++++++++++++ package.json | 3 ++- turbo.json | 3 ++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 117ea0dae..b9ee7d7ed 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -35,3 +35,24 @@ jobs: run: npm run lint:types - name: Lint code run: npm run lint:eslint + unit-tests: + name: Unit tests + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '18' + - name: Retrieve the cached "node_modules" directory (if present) + uses: actions/cache@v3 + id: node-cache + with: + path: node_modules + key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }} + - name: Install dependencies (if the cached directory was not found) + if: steps.node-cache.outputs.cache-hit != 'true' + run: npm ci + - name: unit + run: npm run test:unit diff --git a/package.json b/package.json index 6ce5d4fb5..d6b9f318a 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "lint:types": "turbo run lint:types", "lint:eslint": "turbo run lint:eslint", "format": "turbo run format", - "format:check": "turbo run format:check" + "format:check": "turbo run format:check", + "test:unit": "turbo run test:unit" }, "keywords": [], "license": "MIT", diff --git a/turbo.json b/turbo.json index 679c446a5..a2389a188 100644 --- a/turbo.json +++ b/turbo.json @@ -5,6 +5,7 @@ "lint:types": {}, "lint:eslint": {}, "format": {}, - "format:check": {} + "format:check": {}, + "test:unit": {} } } From bab63d2c72c468b09fc39faaf42c078016848cc5 Mon Sep 17 00:00:00 2001 From: Nils Haberkamp Date: Mon, 5 Feb 2024 10:30:47 +0100 Subject: [PATCH 06/38] NEXT-33446 - bump up node version to 20 in CI --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b9ee7d7ed..8fe92910c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,7 +19,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: '18' + node-version: '20' - name: Retrieve the cached "node_modules" directory (if present) uses: actions/cache@v3 id: node-cache @@ -44,7 +44,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: '18' + node-version: '20' - name: Retrieve the cached "node_modules" directory (if present) uses: actions/cache@v3 id: node-cache From ef8c8c99e58b4c4ca4291d5448dd42cbddb64027 Mon Sep 17 00:00:00 2001 From: Nils Haberkamp Date: Mon, 5 Feb 2024 10:32:48 +0100 Subject: [PATCH 07/38] NEXT-33446 - disable cache in ci --- .github/workflows/tests.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8fe92910c..9a057a8a2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,14 +20,14 @@ jobs: uses: actions/setup-node@v3 with: node-version: '20' - - name: Retrieve the cached "node_modules" directory (if present) - uses: actions/cache@v3 - id: node-cache - with: - path: node_modules - key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }} + # - name: Retrieve the cached "node_modules" directory (if present) + # uses: actions/cache@v3 + # id: node-cache + # with: + # path: node_modules + # key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }} - name: Install dependencies (if the cached directory was not found) - if: steps.node-cache.outputs.cache-hit != 'true' + # if: steps.node-cache.outputs.cache-hit != 'true' run: npm ci - name: Check formatting run: npm run format:check @@ -45,14 +45,14 @@ jobs: uses: actions/setup-node@v3 with: node-version: '20' - - name: Retrieve the cached "node_modules" directory (if present) - uses: actions/cache@v3 - id: node-cache - with: - path: node_modules - key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }} + # - name: Retrieve the cached "node_modules" directory (if present) + # uses: actions/cache@v3 + # id: node-cache + # with: + # path: node_modules + # key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }} - name: Install dependencies (if the cached directory was not found) - if: steps.node-cache.outputs.cache-hit != 'true' + # if: steps.node-cache.outputs.cache-hit != 'true' run: npm ci - name: unit run: npm run test:unit From 0390cf9380b753d12a3277e0652d3f9885895943 Mon Sep 17 00:00:00 2001 From: Nils Haberkamp Date: Mon, 5 Feb 2024 11:07:01 +0100 Subject: [PATCH 08/38] NEXT-33446 - run storybook tests in CI pipeline --- .github/workflows/tests.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9a057a8a2..06f057dfc 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -56,3 +56,38 @@ jobs: run: npm ci - name: unit run: npm run test:unit + storybook-tests: + name: Storybook Tests + timeout-minutes: 60 + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Node.js + uses: actions/setup-node@v3 + # - name: Retrieve the cached "node_modules" directory (if present) + # uses: actions/cache@v3 + # id: node-cache + # with: + # path: node_modules + # key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }} + - name: Install dependencies (if the cached directory was not found) + # if: steps.node-cache.outputs.cache-hit != 'true' + run: npm ci + - name: Install Playwright + run: npx playwright install + - name: Create the static pages directory locally in CI + run: npm --prefix ./packages/component-library run build-storybook + - name: Run Tests + id: storybookTests + run: | + cd ./packages/component-library && + npx concurrently --kill-others --success first --names "SB,TEST" --prefix-colors "magenta,blue" \ + "http-server storybook-static -a 127.0.0.1 --port 6006" \ + "wait-on http://127.0.0.1:6006 && npm run test-storybook" + - name: Archive visual test diffs + uses: actions/upload-artifact@v3 + if: always() + with: + name: visual-test-diffs + path: ./packages/component-library/__snapshots__ From b44efd7d386d7df27d188fcc27555727cee92c8a Mon Sep 17 00:00:00 2001 From: Nils Haberkamp Date: Mon, 5 Feb 2024 11:09:59 +0100 Subject: [PATCH 09/38] NEXT-33446 - update path to node_modules folder --- packages/component-library/.storybook/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/component-library/.storybook/main.js b/packages/component-library/.storybook/main.js index 0ff46bf59..f45107793 100644 --- a/packages/component-library/.storybook/main.js +++ b/packages/component-library/.storybook/main.js @@ -1,4 +1,4 @@ -const custom = require('../node_modules/@vue/cli-service/webpack.config.js'); +const custom = require('../../../node_modules/@vue/cli-service/webpack.config.js'); const path = require('path'); const MiniCssExtractPlugin = require("mini-css-extract-plugin"); module.exports = { From 673a965df9a4eeb2784d246be9c93d0fe89629e9 Mon Sep 17 00:00:00 2001 From: Nils Haberkamp Date: Mon, 5 Feb 2024 11:16:59 +0100 Subject: [PATCH 10/38] NEXT-33446 - update path to node_modules folder --- .../src/components/icons-media/sw-icon/sw-icon.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/component-library/src/components/icons-media/sw-icon/sw-icon.vue b/packages/component-library/src/components/icons-media/sw-icon/sw-icon.vue index 0071e5ebc..571c17da3 100644 --- a/packages/component-library/src/components/icons-media/sw-icon/sw-icon.vue +++ b/packages/component-library/src/components/icons-media/sw-icon/sw-icon.vue @@ -75,7 +75,7 @@ export default Vue.extend({ const [variant] = newName.split('-'); const iconName = newName.split('-').slice(1).join('-'); - import(`./../../../../node_modules/@shopware-ag/meteor-icon-kit/icons/${variant}/${iconName}.svg`).then((iconSvgData) => { + import(`./../../../../../../node_modules/@shopware-ag/meteor-icon-kit/icons/${variant}/${iconName}.svg`).then((iconSvgData) => { if (iconSvgData.default) { this.iconSvgData = iconSvgData.default; } else { @@ -97,7 +97,7 @@ export default Vue.extend({