Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: optimize ci time with some perks 😈 #2865

Merged
merged 19 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
108 changes: 87 additions & 21 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
version: 2.1

jobs:
build:
install_deps:
docker:
- image: cimg/node:18.16.0
resource_class: medium+
steps:
- checkout
- run:
Expand All @@ -27,45 +26,112 @@ jobs:
- ./packages/shared/node_modules
- ./packages/webapp/node_modules
- ./packages/extension/node_modules
build:
docker:
- image: cimg/node:18.16.0
resource_class: medium+
idoshamun marked this conversation as resolved.
Show resolved Hide resolved
steps:
- checkout
- restore_cache:
keys:
- deps-v6-{{ checksum "pnpm-lock.yaml" }}
- deps-v6-{{ .Branch }}
- run:
name: Build
command: npm run build:chrome
working_directory: packages/extension
test:
test_extension:
docker:
- image: cimg/node:18.16.0
resource_class: medium+
parallelism: 1
steps:
- checkout
- restore_cache:
keys:
- deps-v6-{{ checksum "pnpm-lock.yaml" }}
- deps-v6-{{ .Branch }}
- run:
name: Install pnpm
command: npm i --prefix=$HOME/.local -g pnpm
name: Test
command: |
npm run pretest
TEST=$(./node_modules/.bin/jest --listTests)
echo $TEST | circleci tests run --command="xargs ./node_modules/.bin/jest --ci --runInBand --reporters=default --reporters=jest-junit --" --split-by=timings
environment:
JEST_JUNIT_OUTPUT_DIR: ../../test-results
working_directory: packages/extension
- store_test_results:
path: ./test-results
test_webapp:
docker:
- image: cimg/node:18.16.0
parallelism: 1
steps:
- checkout
- restore_cache:
keys:
- deps-v6-{{ checksum "pnpm-lock.yaml" }}
- deps-v6-{{ .Branch }}
- run:
name: Install dependencies
command: pnpm install
- save_cache:
key: deps-v6-{{ checksum "pnpm-lock.yaml" }}
paths:
- ./node_modules
- ./packages/eslint-config/node_modules
- ./packages/eslint-rules/node_modules
- ./packages/prettier-config/node_modules
- ./packages/shared/node_modules
- ./packages/webapp/node_modules
- ./packages/extension/node_modules
name: Test
command: |
npm run pretest
TEST=$(./node_modules/.bin/jest --listTests)
echo $TEST | circleci tests run --command="xargs ./node_modules/.bin/jest --ci --runInBand --reporters=default --reporters=jest-junit --" --split-by=timings
environment:
JEST_JUNIT_OUTPUT_DIR: ../../test-results
working_directory: packages/webapp
- store_test_results:
path: ./test-results
lint_shared:
docker:
- image: cimg/node:18.16.0
resource_class: large
steps:
- checkout
- restore_cache:
keys:
- deps-v6-{{ checksum "pnpm-lock.yaml" }}
- deps-v6-{{ .Branch }}
- run:
name: Lint
command: npm run pretest
working_directory: packages/shared
test_shared:
docker:
- image: cimg/node:18.16.0
parallelism: 1
steps:
- checkout
- restore_cache:
keys:
- deps-v6-{{ checksum "pnpm-lock.yaml" }}
- deps-v6-{{ .Branch }}
- run:
name: Test
command: pnpm run -r test:ci
command: |
TEST=$(./node_modules/.bin/jest --listTests)
echo $TEST | circleci tests run --command="xargs ./node_modules/.bin/jest --ci --runInBand --reporters=default --reporters=jest-junit --" --split-by=timings
environment:
JEST_JUNIT_OUTPUT_DIR: ../../test-results
working_directory: packages/shared
- store_test_results:
path: ./test-results
workflows:
build:
jobs:
- build
- test
- install_deps
- build:
requires:
- install_deps
- test_extension:
requires:
- install_deps
- test_webapp:
requires:
- install_deps
- lint_shared:
requires:
- install_deps
- test_shared:
requires:
- install_deps
1 change: 1 addition & 0 deletions packages/eslint-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ module.exports = {
},
rules: {
curly: ['error', 'all'],
'import/no-cycle': ['error', {ignoreExternal: false, maxDepth: 3}],
'react/prop-types': 0,
'react/require-default-props': 0,
'react/no-unused-prop-types': 0,
Expand Down
3 changes: 1 addition & 2 deletions packages/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
"lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --max-warnings 0 --fix",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx --max-warnings 0",
"pretest": "npm run lint",
"test": "node --expose-gc ./node_modules/jest/bin/jest.js --logHeapUsage",
"test:ci": "JEST_JUNIT_OUTPUT_NAME=extension.xml npm run test -- --ci --reporters=default --reporters=jest-junit --runInBand"
"test": "jest --runInBand"
},
"prettier": "@dailydotdev/prettier-config",
"dependencies": {
Expand Down
3 changes: 1 addition & 2 deletions packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
"lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix --max-warnings 0",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx --max-warnings 0",
"pretest": "npm run lint",
"test": "node --expose-gc ./node_modules/jest/bin/jest.js --logHeapUsage",
"test:ci": "JEST_JUNIT_OUTPUT_NAME=shared.xml npm run test -- --ci --reporters=default --reporters=jest-junit --runInBand"
"test": "jest --runInBand"
},
"prettier": "@dailydotdev/prettier-config",
"peerDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions packages/webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --max-warnings 0 --fix",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx --max-warnings 0",
"pretest": "npm run lint",
"test": "node --expose-gc ./node_modules/jest/bin/jest.js --logHeapUsage",
"test:ci": "JEST_JUNIT_OUTPUT_NAME=webapp.xml npm run test -- --ci --reporters=default --reporters=jest-junit --runInBand",
"test": "jest --runInBand",
"deploy": "vercel"
},
"prettier": "@dailydotdev/prettier-config",
Expand Down