diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a54472d6f3..260d1bfec2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Check branch is releasable and release alpha on main branch update +name: ci on: [push, pull_request] concurrency: group: ${{ github.workflow }}-${{ github.ref_name }} @@ -6,6 +6,10 @@ concurrency: jobs: build: runs-on: ubuntu-latest + strategy: + matrix: + task: [ lint, 'test:unit', 'test:unit-cypress', 'test:e2e:ci' ] + name: ${{ matrix.task }} container: image: cypress/browsers:node-18.16.0-chrome-112.0.5615.121-1-ff-112.0.1-edge-112.0.1722.48-1 # https://github.com/cypress-io/github-action#firefox Cypress FF image needs this user permissions to be able to install dependencies @@ -43,6 +47,7 @@ jobs: ${{ runner.os }}-pnpm-store- - name: setup eslint cache + if: ${{ matrix.task == 'lint' }} uses: actions/cache@v3 with: path: '**/.eslintcache' @@ -55,23 +60,26 @@ jobs: with: path: | node_modules/.cache - key: lerna-cache-${{github.sha}} - restore-keys: lerna-cache- + key: lerna-cache-${{github.sha}}-${{matrix.task}} + restore-keys: | + lerna-cache-${{github.sha}} + lerna-cache- - name: install dependencies run: pnpm install - - name: lint packages - run: pnpm run lint - - - name: test packages - run: pnpm run test + - name: Run ${{ matrix.task }} + run: npm run ${{ matrix.task }} - - name: release alpha on non-release pushes to main branch + release: + needs: [ build ] + runs-on: ubuntu-latest + steps: + - name: Release alpha on non-release pushes to main branch if: ${{ github.ref_name == 'main' && github.actor != 'support-empathy' && !startsWith(github.event.head_commit.message, 'chore(release):') }} uses: ./.github/actions/release-alpha with: npm_token: ${{ secrets.NPM_TOKEN }} - github_token: ${{ secrets.SUPPORT_TOKEN }} + github_token: ${{ secrets.SUPPORT_TOKEN }} \ No newline at end of file diff --git a/nx.json b/nx.json index 977666b1f9..8084bd7475 100644 --- a/nx.json +++ b/nx.json @@ -3,7 +3,7 @@ "default": { "runner": "nx/tasks-runners/default", "options": { - "cacheableOperations": ["build", "test"] + "cacheableOperations": ["build", "test:unit", "test:unit-cypress"] } } }, diff --git a/package.json b/package.json index f0e8e3c581..aa428842ec 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,9 @@ "build": "lerna run build", "lint": "lerna run lint -- --quiet --cache --cache-strategy content", "lint:fix": "lerna run lint -- --fix", - "test": "lerna run test", + "test:e2e:ci": "lerna run test:e2e:ci", + "test:unit": "lerna run test:unit", + "test:unit-cypress": "lerna run test:unit-cypress", "serve": "lerna run serve", "prepare-release:stable": "lerna version --conventional-commits --conventional-graduate --no-git-tag-version --yes", "release:alpha": "lerna publish --conventional-commits --conventional-prerelease --yes --no-push", diff --git a/packages/deep-merge/package.json b/packages/deep-merge/package.json index a94aaa4268..291cdc0ef1 100644 --- a/packages/deep-merge/package.json +++ b/packages/deep-merge/package.json @@ -34,7 +34,7 @@ "postbuild": "pnpm pack", "lint": "eslint . --ext .ts", "prepublishOnly": "pnpm run build", - "test": "jest" + "test:unit": "jest" }, "dependencies": { "@empathyco/x-utils": "^1.0.0-alpha.19", diff --git a/packages/logger/package.json b/packages/logger/package.json index a74b2b9542..1b0b1ba99d 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -31,7 +31,7 @@ "postbuild": "pnpm pack", "lint": "eslint . --ext .ts", "prepublishOnly": "pnpm run build", - "test": "jest" + "test:unit": "jest" }, "dependencies": { "tslib": "~2.5.0" diff --git a/packages/storage-service/package.json b/packages/storage-service/package.json index 42dd4e8c0d..b9e27549ae 100644 --- a/packages/storage-service/package.json +++ b/packages/storage-service/package.json @@ -33,7 +33,7 @@ "build:watch": "tsc --watch", "postbuild": "pnpm pack", "lint": "eslint . --ext .ts", - "test": "jest", + "test:unit": "jest", "test:watch": "jest --watch", "test:coverage": "jest --coverage", "prepublishOnly": "pnpm run build" diff --git a/packages/x-adapter-platform/package.json b/packages/x-adapter-platform/package.json index fec502ae4d..8341b89e53 100644 --- a/packages/x-adapter-platform/package.json +++ b/packages/x-adapter-platform/package.json @@ -36,7 +36,7 @@ "gen:typescript-docs": "api-documenter markdown -i report -o docs", "gen:docs": "pnpm run gen:model-docs && pnpm run gen:typescript-docs", "lint": "eslint . --ext .ts", - "test": "jest", + "test:unit": "jest", "prepublishOnly": "pnpm run build" }, "dependencies": { diff --git a/packages/x-adapter/package.json b/packages/x-adapter/package.json index 3b806e3643..1b2f1f489c 100644 --- a/packages/x-adapter/package.json +++ b/packages/x-adapter/package.json @@ -32,7 +32,7 @@ "build:esm": "tsc --project tsconfig.esm.json", "postbuild": "pnpm pack", "lint": "eslint . --ext .ts", - "test": "jest", + "test:unit": "jest", "prepublishOnly": "pnpm run build" }, "dependencies": { diff --git a/packages/x-archetype-utils/package.json b/packages/x-archetype-utils/package.json index 1d0edc1e3f..2df7a6bf5c 100644 --- a/packages/x-archetype-utils/package.json +++ b/packages/x-archetype-utils/package.json @@ -31,7 +31,7 @@ "build:esm": "tsc --project tsconfig.esm.json", "postbuild": "pnpm pack", "lint": "eslint . --ext .ts", - "test": "jest", + "test:unit": "jest", "prepublishOnly": "pnpm run build" }, "dependencies": { diff --git a/packages/x-bus/package.json b/packages/x-bus/package.json index caf049cebc..729dc975af 100644 --- a/packages/x-bus/package.json +++ b/packages/x-bus/package.json @@ -31,7 +31,7 @@ "build:esm": "tsc --project tsconfig.esm.json", "postbuild": "pnpm pack", "lint": "eslint . --ext .ts", - "test": "jest", + "test:unit": "jest", "prepublishOnly": "pnpm run build" }, "bugs": { diff --git a/packages/x-components/cypress.config.ts b/packages/x-components/cypress.config.ts index 8f911a93a1..11f1b930df 100644 --- a/packages/x-components/cypress.config.ts +++ b/packages/x-components/cypress.config.ts @@ -31,11 +31,17 @@ export default defineConfig({ experimentalRunAllSpecs: true }, component: { + defaultCommandTimeout: 7000, + experimentalSingleTabRunMode: true, specPattern: 'tests/unit/**/*.spec.ts', supportFile: 'tests/support/index.ts', indexHtmlFile: 'tests/support/component-index.html', screenshotOnRunFailure: false, video: false, + retries: { + openMode: 0, + runMode: 1 + }, devServer: { bundler: 'webpack', framework: 'vue-cli' diff --git a/packages/x-priority-queue/package.json b/packages/x-priority-queue/package.json index 5a0b706a08..62c003c06e 100644 --- a/packages/x-priority-queue/package.json +++ b/packages/x-priority-queue/package.json @@ -31,7 +31,7 @@ "build:esm": "tsc --project tsconfig.esm.json", "postbuild": "pnpm pack", "lint": "eslint . --ext .ts", - "test": "jest", + "test:unit": "jest", "prepublishOnly": "pnpm run build" }, "dependencies": { diff --git a/packages/x-svg-converter/package.json b/packages/x-svg-converter/package.json index e47966e9c2..9017ea36bf 100644 --- a/packages/x-svg-converter/package.json +++ b/packages/x-svg-converter/package.json @@ -28,7 +28,7 @@ "build": "tsc --project tsconfig.build.json", "postbuild": "pnpm pack", "lint": "eslint . --ext .ts", - "test": "jest -i" + "test:unit": "jest -i" }, "devDependencies": { "@types/jest": "~27.5.0", diff --git a/packages/x-translations/package.json b/packages/x-translations/package.json index 04b1f1c84b..aa13071d57 100644 --- a/packages/x-translations/package.json +++ b/packages/x-translations/package.json @@ -27,7 +27,7 @@ "build": "tsc", "postbuild": "pnpm pack", "lint": "eslint . --ext .ts", - "test": "jest -i" + "test:unit": "jest -i" }, "dependencies": { "@empathyco/x-deep-merge": "^1.3.0-alpha.34" diff --git a/packages/x-utils/package.json b/packages/x-utils/package.json index 7a579c1cb5..6e6ff0c6d3 100644 --- a/packages/x-utils/package.json +++ b/packages/x-utils/package.json @@ -27,7 +27,7 @@ "scripts": { "prebuild": "rimraf ./dist ./types", "build": "tsc --project tsconfig.cjs.json && tsc --project tsconfig.esm.json", - "test": "jest", + "test:unit": "jest", "postbuild": "pnpm pack", "lint": "eslint . --ext .ts", "prepublishOnly": "pnpm run build"