-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add build job with turbo cache to CI (#1615)
<!-- How to write a good PR title: - Follow [the Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/). - Give as much context as necessary and as little as possible - Prefix it with [WIP] while it’s a work in progress --> ## Self Checklist - [x] I wrote a PR title in **English** and added an appropriate **label** to the PR. - [x] I wrote the commit message in **English** and to follow [**the Conventional Commits specification**](https://www.conventionalcommits.org/en/v1.0.0/). - [x] I [added the **changeset**](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md) about the changes that needed to be released. (or didn't have to) - [x] I wrote or updated **documentation** related to the changes. (or didn't have to) - [x] I wrote or updated **tests** related to the changes. (or didn't have to) - [x] I tested the changes in various browsers. (or didn't have to) - Windows: Chrome, Edge, (Optional) Firefox - macOS: Chrome, Edge, Safari, (Optional) Firefox ## Related Issue <!-- Please link to issue if one exists --> Fixes #1005 ## Summary <!-- Please brief explanation of the changes made --> - 빌드 잡을 CI에 추가합니다. - 빌드 잡에 캐시를 추가합니다. ## Details <!-- Please elaborate description of the changes --> 기존에 `--filter=bezier-icons` 를 통해 아이콘 패키지만 빌드하던 것에서 필터를 제거하고, 모든 패키지를 빌드하도록 변경합니다. 의존성 업데이트 등 변경이 있었을 경우 라이브러리가 정상적으로 빌드되는 지 검증하기 위해서입니다. #1424 에서 빌드 시간이 많이 단축되었지만, 필터가 제거되었으므로 총 빌드 시간도 유의미하게 증가하게 될 거라 생각했습니다. 이를 방지하고자 빌드 잡에 캐시를 추가했습니다. ### 빌드 잡에 캐시 추가 - 기존엔 jest의 캐시가 없었습니다. 캐시 관련 설정을 추가합니다. - 마이너: 캐시 설정을 추가하며 jest 설정을 레포지토리 전반적으로 통일합니다. jest 관련 패키지를 루트로 옮기고, `@swc/jest` 를 모든 패키지에 적용하여 테스트 수행시간을 줄이고자 했습니다. 기본값과 동일하거나 불필요한 jest 설정 옵션은 제거했습니다. - `test:ci` 스크립트를 제거하고 기존 `test: jest --onlyChanged` 스크립트를 `test:ci` 와 동일한 스크립트로 변경합니다. 기존에 only changed 플래그가 추가되었던 이유가 pre-commit 훅을 빠르게 수행하기 위해서였는데, pre-commit 훅이 제거되었기때문에 불필요해졌다고 판단했습니다. ### Breaking change? (Yes/No) <!-- If Yes, please describe the impact and migration path for users --> No
- Loading branch information
1 parent
5042b04
commit f3945b9
Showing
19 changed files
with
123 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
version: 2.1 | ||
|
||
orbs: | ||
codecov: codecov/[email protected] | ||
node: circleci/[email protected] | ||
codecov: codecov/[email protected] | ||
|
||
references: | ||
workspace_root: &workspace_root | ||
|
@@ -10,74 +11,98 @@ references: | |
attach_workspace: &attach_workspace | ||
attach_workspace: | ||
at: *workspace_root | ||
|
||
build_cache_paths: &build_cache_paths | ||
paths: | ||
- node_modules/.cache/turbo | ||
|
||
defaults: &defaults | ||
resource_class: xlarge | ||
working_directory: *workspace_root | ||
lint_cache_paths: &lint_cache_paths | ||
paths: | ||
- packages/bezier-react/.stylelintcache | ||
- packages/bezier-react/.eslintcache | ||
- packages/bezier-icons/.eslintcache | ||
- packages/bezier-figma-plugin/.eslintcache | ||
- packages/bezier-codemod/.eslintcache | ||
|
||
docker: | ||
- image: node:18.17.1 | ||
test_cache_paths: &test_cache_paths | ||
paths: | ||
- packages/bezier-react/.jestcache | ||
- packages/bezier-icons/.jestcache | ||
- packages/bezier-figma-plugin/.jestcache | ||
- packages/bezier-codemod/.jestcache | ||
|
||
filter_only_tagged: &filter_only_tagged | ||
filters: | ||
tags: | ||
only: /^v.*/ | ||
branches: | ||
ignore: /.*/ | ||
executors: | ||
node_executor: | ||
docker: | ||
- image: node:18.17.1 | ||
resource_class: xlarge | ||
working_directory: *workspace_root | ||
|
||
jobs: | ||
install: | ||
<<: *defaults | ||
executor: node_executor | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- bezier-react-dependencies-{{ checksum "yarn.lock" }} | ||
- run: yarn install | ||
- save_cache: | ||
paths: | ||
- .yarn/cache | ||
- .yarn/unplugged | ||
key: bezier-react-dependencies-{{ checksum "yarn.lock" }} | ||
- node/install-packages: | ||
pkg-manager: yarn | ||
- persist_to_workspace: | ||
root: *workspace_root | ||
paths: | ||
- . | ||
|
||
build: | ||
<<: *defaults | ||
executor: node_executor | ||
steps: | ||
- *attach_workspace | ||
- run: yarn build --filter=bezier-icons | ||
- restore_cache: | ||
keys: | ||
- build-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}- | ||
- build-{{ .Environment.CACHE_VERSION }}- | ||
- run: yarn build | ||
- save_cache: | ||
key: build-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ epoch }} | ||
<<: *build_cache_paths | ||
- persist_to_workspace: | ||
root: *workspace_root | ||
paths: | ||
- . | ||
|
||
lint: | ||
<<: *defaults | ||
executor: node_executor | ||
steps: | ||
- *attach_workspace | ||
- restore_cache: | ||
keys: | ||
- lint-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}- | ||
- lint-{{ .Environment.CACHE_VERSION }}- | ||
- run: yarn lint | ||
- save_cache: | ||
key: lint-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ epoch }} | ||
<<: *lint_cache_paths | ||
|
||
typecheck: | ||
<<: *defaults | ||
executor: node_executor | ||
steps: | ||
- *attach_workspace | ||
- run: yarn typecheck | ||
|
||
test: | ||
<<: *defaults | ||
executor: node_executor | ||
steps: | ||
- *attach_workspace | ||
- run: yarn test:ci | ||
- restore_cache: | ||
keys: | ||
- test-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}- | ||
- test-{{ .Environment.CACHE_VERSION }}- | ||
- run: yarn test | ||
- codecov/upload: | ||
file: './packages/bezier-react/coverage/lcov.info' | ||
token: $CODECOV_TOKEN | ||
- save_cache: | ||
key: test-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ epoch }} | ||
<<: *test_cache_paths | ||
|
||
workflows: | ||
version: 2 | ||
lint_and_test: | ||
ci: | ||
jobs: | ||
- install | ||
- build: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -215,3 +215,6 @@ stats.html | |
|
||
# Rollup cache | ||
.rollup.cache | ||
|
||
# Jest cache | ||
.jestcache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,12 @@ | ||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
/** @type {import('jest').Config} */ | ||
module.exports = { | ||
preset: 'ts-jest/presets/default-esm', | ||
cacheDirectory: '.jestcache', | ||
testEnvironment: 'node', | ||
transform: { | ||
'^.+\\.[t|j]sx?$': ['@swc/jest'], | ||
}, | ||
moduleNameMapper: { | ||
'^(\\.{1,2}/.*)\\.js$': '$1', | ||
}, | ||
transform: { | ||
// '^.+\\.[tj]sx?$' to process js/ts with `ts-jest` | ||
// '^.+\\.m?[tj]sx?$' to process js/ts/mjs/mts with `ts-jest` | ||
'^.+\\.tsx?$': [ | ||
'ts-jest', | ||
{ | ||
useESM: true, | ||
}, | ||
], | ||
}, | ||
testEnvironment: 'node', | ||
testRegex: '\\.test\\.ts$', | ||
testMatch: ['**/*.test.(ts|tsx)'], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** @type {import('jest').Config} */ | ||
module.exports = { | ||
cacheDirectory: '.jestcache', | ||
testEnvironment: 'jsdom', | ||
transform: { | ||
'^.+\\.[t|j]sx?$': ['@swc/jest'], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,6 @@ | |
".eslintrc.js", | ||
"babel.config.js", | ||
"rollup.config.mjs", | ||
"jest.config.js", | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.