-
Notifications
You must be signed in to change notification settings - Fork 32
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
Chore: Add Circle CI #32
Conversation
aeb5f80
to
c7f0e75
Compare
c7f0e75
to
8f331ac
Compare
2fa3db9
to
ab072be
Compare
42b6663
to
1c078ef
Compare
1c078ef
to
665286d
Compare
665286d
to
ed9a2d1
Compare
…etween 20000 ~ 30000 change server random port from internal.port to number between 20000 ~ 30000 to avoid access issues.
- fix lint issues - set allowCircularSelfDependency to ture, we can use local path maps because we'll tranform them while building. - disable rule @typescript-eslint/no-explicit-any - disable rule @typescript-eslint/no-non-null-assertion
ed9a2d1
to
f34c021
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beside some suggestion and questions, others LTGM 👍 Thanks for adding the Circle CI 😄
.circleci/config.yml
Outdated
@@ -0,0 +1,63 @@ | |||
version: 2.1 | |||
|
|||
defaults: &defaults |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great for using YAML anchor & alias to be like variable 👍
But you could use circleci built-in executors to define container for writeing it to make it readable than default
and YAML anchors and alias syntax, also executors
could provide multiple executor if we need in the furture.
executors:
node-executor:
working_directory: ~/repo
docker:
- image: cimg/node:16.15.1
install:
executor: node-executor
steps:
- checkout
lint:
executor: node-executor
steps:
- checkout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks great to use executors! I'll update them.
docker: | ||
- image: cimg/node:16.15.1 | ||
|
||
set_env: &set_env |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggesting to add a simple comment to hint you will use the set_env
variable which defined some steps options in below steps of jobs.
source $BASH_ENV | ||
echo $AFFECTED_ARGS | ||
|
||
yarn_cache: &yarn_cache |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above set_env
suggestion
# fallback to using the latest cache if no exact match is found | ||
- node-deps-node16- | ||
|
||
yarn_install: &yarn_install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above set_env
suggestion
@@ -31,6 +31,19 @@ yarn_install: &yarn_install | |||
name: Install Dependencies | |||
command: yarn install --frozen-lockfile --non-interactive | |||
|
|||
codecov_install: &codecov_install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great for adding the codecov for showing code coverage after each PR changed and tested 👍
Maybe you could rename the Install codecov
to Upload the code coverage data to codecov
to prevent confusion that you show the install codecov, but the command is to upload the code coverage.
NIT: If possible, maybe we could use circleci codecov orb which like GitHub Action, for making it simple
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great for adding the codecov for showing code coverage after each PR changed and tested 👍
Maybe you could rename the Install codecov to Upload the code coverage data to codecov to prevent confusion that you show the install codecov, but the command is to upload the code coverage.
The script here downloads the binary file from codecov and check the signature, It doesn't upload any data~ We upload data in the last step of test job: - run: ./codecov -t ${CODECOV_TOKEN}
, I'll add some comment here.
NIT: If possible, maybe we could use circleci codecov orb which like GitHub Action, for making it simple
To use 3rd party orb we need to update our organization security policy, it might affect other projects of Canner, so I download the file manually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohoh, got it!
It my misunderstanding, thanks for the explanation, also thanks for telling me the reason why not use the 3rd party and provide tested link too 😺
.circleci/config.yml
Outdated
echo 'Fetching Base Commit from GitHub' | ||
echo 'export CIRCLE_PR_NUMBER="${CIRCLE_PR_NUMBER:-${CIRCLE_PULL_REQUEST##*/}}"' >> $BASH_ENV | ||
source $BASH_ENV | ||
echo "export CIRCLE_PR_BASE_SHA=`curl -s https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/pulls/${CIRCLE_PR_NUMBER} | jq -r '.base.sha'`" >> $BASH_ENV | ||
echo 'export AFFECTED_ARGS="--base=${CIRCLE_PR_BASE_SHA}"' >> $BASH_ENV | ||
echo 'export NODE_OPTIONS="--max_old_space_size=6144"' >> $BASH_ENV | ||
|
||
source $BASH_ENV | ||
echo $AFFECTED_ARGS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you like to get the current PR base to commit SHA and keep "--base=${CIRCLE_PR_BASE_SHA}"
to AFFECTED_ARGS
( I guess you refer the nx-example code ) to let the nx affected
could lint the current PR changed the part and test the current PR changed part ( in the next commit )?
Btw, maybe you could add a comment to hint to us what the part you would like to do for what purpose e.g: get the current PR commit SHA for nx affected could lint and test the only current PR changed code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you like to get the current PR base to commit SHA and keep "--base=${CIRCLE_PR_BASE_SHA}" to AFFECTED_ARGS ( I guess you refer the nx-example code ) to let the nx affected could lint the current PR changed the part and test the current PR changed part ( in the next commit )?
I don't quite get what you mean 🤣 , did you mean what's the reason of saving base SHA? Yes, I want to let CI only test/lint the changed packages, i.e. the difference from HEAD to base.
Btw, maybe you could add a comment to hint to us what the part you would like to do for what purpose e.g: get the current PR commit SHA for nx affected could lint and test the only current PR changed code.
Added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it my question 😆, thanks for still explaining to me 👍
@@ -16,15 +16,19 @@ | |||
"sourceTag": "*", | |||
"onlyDependOnLibsWithTags": ["*"] | |||
} | |||
] | |||
], | |||
"allowCircularSelfDependency": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, why did we add the allowCircularSelfDependency
, have our code happen the circular self-dependency, or just to add for preventing it happened in the future, or other reason ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NX linter blocks the relative imports from ourself if this value = false, e.g. "@vulcan-sql/core/model" from core package.
https://github.com/nrwl/nx/blob/master/packages/workspace/src/tslint/nxEnforceModuleBoundariesRule.ts#L184
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see, thanks for sharing the source code 🤣 and replying my question 👍
HI @kokokuo , all issues have been fixed, thanks! |
Thanks for @oscar60310 replying my question! |
Add Circle CI config.