Skip to content

Commit

Permalink
ci: parallelize steps (#1174)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajperezbau authored May 8, 2023
1 parent 14e64e1 commit 3013595
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 23 deletions.
28 changes: 18 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
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 }}
cancel-in-progress: true
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
Expand Down Expand Up @@ -43,6 +47,7 @@ jobs:
${{ runner.os }}-pnpm-store-
- name: setup eslint cache
if: ${{ matrix.task == 'lint' }}
uses: actions/cache@v3
with:
path: '**/.eslintcache'
Expand All @@ -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 }}
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"default": {
"runner": "nx/tasks-runners/default",
"options": {
"cacheableOperations": ["build", "test"]
"cacheableOperations": ["build", "test:unit", "test:unit-cypress"]
}
}
},
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/deep-merge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion packages/storage-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion packages/x-adapter-platform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion packages/x-adapter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion packages/x-archetype-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion packages/x-bus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
6 changes: 6 additions & 0 deletions packages/x-components/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion packages/x-priority-queue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion packages/x-svg-converter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/x-translations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion packages/x-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 3013595

Please sign in to comment.