This repository has been archived by the owner on Jul 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
1,976 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,189 @@ | ||
version: 2.1 | ||
|
||
executors: | ||
default: | ||
docker: | ||
- image: {{ project_image }} ## example: circleci/node:14.8 | ||
working_directory: ~/{{ project_name }} | ||
|
||
commands: | ||
notify-success: | ||
steps: | ||
- run: | ||
name: "notify slack when job success" | ||
command : | | ||
curl --data '{"text": "β Job *'$CIRCLE_JOB'* succeeded on *'$CIRCLE_BRANCH''$CIRCLE_TAG'*. Please see '$CIRCLE_BUILD_URL' for details."}' "$SLACK_WEBHOOK_URL" | ||
when: on_success | ||
notify-failure: | ||
steps: | ||
- run: | ||
name: "notify slack when job fail" | ||
command : | | ||
curl --data '{"text": "β Job *'$CIRCLE_JOB'* failed on *'$CIRCLE_BRANCH''$CIRCLE_TAG'*. Please see '$CIRCLE_BUILD_URL' for details."}' "$SLACK_WEBHOOK_URL" | ||
when: on_fail | ||
check_rc: | ||
steps: | ||
- run: | ||
name: Check RC | ||
command: | | ||
if [[ -n $CIRCLE_TAG ]]; then | ||
RC_NUMBER=${CIRCLE_TAG##*-} | ||
# sed -i 's/^KLIP_SDK_VERSION_NAME.*/&-'${RC_NUMBER}'/' gradle.properties | ||
# sed -n '/KLIP_SDK_VERSION_NAME/p' gradle.properties | ||
else | ||
echo "Not RC version" | ||
fi | ||
jobs: | ||
unit_test: | ||
executor: default | ||
steps: | ||
- checkout | ||
- run: {{ test command }} | ||
|
||
lint_test: | ||
executor: default | ||
steps: | ||
- checkout | ||
- run: {{ test command }} | ||
|
||
integration_test: | ||
executor: default | ||
steps: | ||
- checkout | ||
- run: {{ test command }} | ||
|
||
build: | ||
executor: default | ||
steps: | ||
- checkout | ||
- check_rc | ||
- run: {{ build command }} | ||
- store_artifacts: ## If you want to store build_file | ||
path: /tmp/artifacts ## Change path to build_file | ||
|
||
tag_verify: | ||
executor: default | ||
steps: | ||
- checkout | ||
- run: | ||
name: "Verify tag and file verison match" | ||
command: ./.circleci/scripts/tag_verify.sh ## Change script if version is not indicated on package.json | ||
|
||
publish: | ||
executor: default | ||
steps: | ||
- checkout | ||
## This process only upload and flush cache on Cloudfront, if project deploy other way, need to add in this job | ||
- check_rc | ||
- run: | ||
name: "Upload S3 bucket" | ||
command: | | ||
sudo apt-get install awscli | ||
aws s3 sync ./ s3://$FRONTEND_BUCKET | ||
- run: | ||
name: "flush cache cloudfront" | ||
command: | | ||
aws configure set preview.cloudfront true | ||
aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION --paths "/*" | ||
- notify-failure | ||
- notify-success | ||
|
||
release_PR: | ||
executor: default | ||
steps: | ||
- add_ssh_keys | ||
- checkout | ||
- run: | ||
name: "Push release branch" | ||
command: | | ||
set -x | ||
echo "push to release branch: /release/${CIRCLE_TAG%-*}" | ||
git checkout -b release/${CIRCLE_TAG%-*} | ||
git push origin release/${CIRCLE_TAG%-*} | ||
- run: | ||
name: "Make PR to master branch" | ||
command: ./.circleci/scripts/release_pr.sh | ||
|
||
tagging: | ||
executor: default | ||
steps: | ||
- add_ssh_keys | ||
- checkout | ||
- run: | ||
name: "Tagging and delete release branch" | ||
command: ./.circleci/scripts/release_tag_branch.sh | ||
|
||
stage_defaults: | ||
default: &stage_default | ||
filters: | ||
tags: | ||
only: | ||
- /^v[0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+.*/ | ||
- /^v[0-9]+\.[0-9]+\.[0-9]+-alpha\.[0-9]+.*/ | ||
branches: | ||
ignore: | ||
- /release\/.*/ | ||
qa: &stage_qa | ||
context: klip_sdk_prod | ||
filters: | ||
tags: | ||
only: | ||
- /^v[0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+.*/ | ||
- /^v[0-9]+\.[0-9]+\.[0-9]+-alpha\.[0-9]+.*/ | ||
branches: | ||
ignore: /.*/ | ||
rc: &stage_rc | ||
context: klip_sdk_prod | ||
filters: | ||
tags: | ||
only: /^v[0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+.*/ | ||
branches: | ||
ignore: /.*/ | ||
tests: &test_steps | ||
requires: | ||
- unit_test | ||
- lint_test | ||
- integration_test | ||
- tag_verify | ||
|
||
workflows: | ||
version: 2 | ||
build_and_test: | ||
jobs: | ||
- unit_test: | ||
<<: *stage_default | ||
- lint_test: | ||
<<: *stage_default | ||
- integration_test: | ||
<<: *stage_default | ||
|
||
# publish jobs - rc | ||
- tag_verify: | ||
<<: *stage_qa | ||
filters: | ||
tags: | ||
only: /^v[0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+.*/ | ||
branches: | ||
ignore: /.*/ | ||
|
||
- publish: | ||
<<: *stage_qa | ||
<<: *test_steps | ||
name: publish_rc | ||
|
||
- release_PR: | ||
<<: *stage_rc | ||
requires: | ||
- publish_rc | ||
|
||
# publish jobs - prod | ||
- publish: | ||
context: klip_sdk_prod | ||
name: publish_prod | ||
filters: | ||
branches: | ||
only: master | ||
|
||
- tagging: | ||
requires: | ||
- publish_prod |
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,17 @@ | ||
#!/bin/bash | ||
set -x | ||
|
||
curl -sSLf https://github.com/github/hub/releases/download/v2.12.3/hub-linux-amd64-2.12.3.tgz | \ | ||
tar zxf - --strip-components=1 -C /tmp && \ | ||
sudo mv /tmp/bin/hub /usr/local/bin/hub | ||
type hub | ||
|
||
VERSION=$(hub pr list -s open -L 10 -f "%H%n") | ||
|
||
echo $VERSION | ||
if [[ $VERSION == *"release/${CIRCLE_TAG%-*}"* ]]; then | ||
echo "PR already exist" | ||
else | ||
echo "hub pull-request -m "[Master] release/$CIRCLE_TAG QA Signoff" -b $CIRCLE_PROJECT_USERNAME:master -h $CIRCLE_PROJECT_USERNAME:${CIRCLE_TAG%-*}" | ||
echo -e "[Master] release/${CIRCLE_TAG%-*} QA Sign-off\n\nThis PR is automatically created by CI to release a new official version of $CIRCLE_PROJECT_REPONAME.\n\nWhen this PR is approved by QA team, a new version will be released." | hub pull-request -b $CIRCLE_PROJECT_USERNAME:master -h $CIRCLE_PROJECT_USERNAME:release/${CIRCLE_TAG%-*} -r $GITHUB_reviewer -l circleci -F- | ||
fi |
19 changes: 19 additions & 0 deletions
19
caver-conformance-tests/.circleci/scripts/release_tag_branch.sh
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,19 @@ | ||
#!/bin/bash | ||
set -x | ||
|
||
VERSION=v$(awk '/"version/ {gsub("\"",""); print $2}' package.json | tr -d ',') | ||
|
||
echo "Tagging major $VERSION" | ||
git config --global user.email "team.devops@groundx.xyz" | ||
git config --global user.name "circleci-gx" | ||
git tag -a $VERSION -m "$CIRCLE_STAGE" | ||
git push origin $VERSION | ||
|
||
|
||
#delete release branch. it trigger by merge title | ||
if [[ "release/v" = $(git log --oneline -1 | grep -o "release/v") ]]; then | ||
echo "Delete branch release/$VERSION" | ||
git push origin --delete release/$VERSION | ||
else | ||
echo "Need to delete branch manually" | ||
fi |
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,14 @@ | ||
#!/bin/bash | ||
set -x | ||
|
||
VERSION=v$(awk '/"version/ {gsub("\"",""); print $2}' package.json | tr -d ',') | ||
echo "Pushing tag version is " $CIRCLE_TAG | ||
|
||
echo "version on version.go" $VERSION | ||
|
||
if [ $VERSION == ${CIRCLE_TAG%-*} ]; then | ||
echo "Pushing tag and Real version match!" | ||
else | ||
echo "It's not same version." | ||
exit 1 | ||
fi |
Validating CODEOWNERS rules β¦
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,24 @@ | ||
# This is a comment. | ||
# Each line is a file pattern followed by one or more owners. | ||
|
||
# These owners will be the default owners for everything in | ||
# the repo. Unless a later match takes precedence, | ||
# @global-owner1 and @global-owner2 will be requested for | ||
# review when someone opens a pull request. | ||
#* @global-owner1 @global-owner2 | ||
|
||
# Order is important; the last matching pattern takes the most | ||
# precedence. When someone opens a pull request that only | ||
# modifies JS files, only @js-owner and not the global | ||
# owner(s) will be requested for a review. | ||
#*.js @js-owner | ||
|
||
# You can also use email addresses if you prefer. They'll be | ||
# used to look up users just like we do for commit author | ||
# emails. | ||
#*.go docs@example.com | ||
|
||
# In this example, @doctocat owns any files in the build/logs | ||
# directory at the root of the repository and any of its | ||
# subdirectories. | ||
#/build/logs/ @doctocat |
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 @@ | ||
.idea |
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,92 @@ | ||
# Caver Conformance Tests | ||
|
||
## Definition | ||
> Conformance Test(μ΄ν μ ν©μ± ν μ€νΈ)μ 무μμΈμ§ κΈ°μ ν©λλ€. | ||
μ ν©μ± ν μ€νΈλ "Klaytn SDKμΈ Caverκ° κ΅¬νλ μΈμ΄μ μκ΄ μμ΄ νμ€μ λ°λ₯΄κ³ μλκ°"λ₯Ό ν μ€νΈνλ κ²μ λλ€. | ||
|
||
## Requirements | ||
> μ ν©μ± ν μ€νΈλ₯Ό μν΄ νμν λ΄μ©λ€μ κΈ°μ ν©λλ€. | ||
* [KIP-34](https://kips.klaytn.com/KIPs/kip-34) μ μ μλμ΄ μλ ν¨μλ€μ μ ν©μ± ν μ€νΈ λ²μ£Όμ λ€μ΄κ°λλ€. | ||
* μΈλΆμ μΌλ‘ ν μ€νΈκ° λλλ κ²λ€μ μ£Όλ μ¬μ©μ±μ κΈ°μ€μΌλ‘ ν μ€νΈμΌμ΄μ€λ₯Ό μ€κ³νλλ‘ ν©λλ€. | ||
* e.g. `IKeyring.encrypt(password: String, options: Object): Object` ν¨μλ₯Ό μλ‘ λ€λ©΄, | ||
optionsμ λ€μ΄κ° μ μλ νλΌλ―Έν°λ€μ΄ μ¬λΏ μμ΄ κ²½μ°μ μκ° λ§μμ§λλ° μ΄ λλ μ£Όλ μ¬μ©μ±μ κΈ°μ€μΌλ‘ μ΅μ μ μ νλλ‘ ν©λλ€. | ||
* Endpoint Node λλ Klaytn Node κ° μμ΄ ν μ€νΈκ° λμ΄μΌ ν©λλ€. | ||
* μ€μ ν΅μ μ΄ μμ΄ Nodeλ‘ μ μ‘νλ €λ Request Bodyκ° μ μ ν μΈμ½λ©λμλμ§ λ±μ νμΈνλ©΄ λ©λλ€. | ||
* Deprecatedλ λ©μλ, ν¨μλ Conformance Test λ²μ£Όμ λ€μ΄κ°μ§ μμ΅λλ€. | ||
r | ||
## Conventions | ||
|
||
### λλ ν 리 ꡬ쑰 λ° νμΌλͺ | ||
``` | ||
. // caver-conformance-test-suite | ||
// The directory tree of caver-conformance-test-suite | ||
βββ LayerInCommonArchitecture // Account, Wallet, and etc... | ||
β βββ ClassName1 // Classes(or structures) that make up the Layer | ||
β β βββ methodName1.json | ||
β β βββ ... | ||
β β βββ methodName2.json | ||
β βββ ... | ||
β βββ ClassNameN | ||
β βββ ... | ||
β βββ methodNameN.json | ||
βββ ... (Other layers) | ||
βββ Utils // Real example of Utils Layer: | ||
βββ Utils // Class Utils is a main component of Utils layer | ||
βββ addHexPrefix.json | ||
βββ checkAddressChecksum.json | ||
βββ ... (Other methods in Utils class of Utils Layer) | ||
βββ stripHexPrefix.json | ||
``` | ||
|
||
**Q & A** | ||
* AbstractTransaction ν΄λμ€μ κ²½μ° ν μ€νΈ μΌμ΄μ€ μ μλ μ΄λ»κ² λλμ? | ||
* μ€μ SDKλ₯Ό μ¬μ©νλ μ μ₯μμ μκ°ν΄λ³΄λ©΄ κ° νΈλμμ νμ μ ν΄λμ€λ³λ‘ μ€νν μ μκ²λ μ‘΄μ¬νλ―λ‘ ν΄λΉ ν΄λμ€ λλ ν 리μ `ν¨μλͺ .json`μΌλ‘ μ μνλ©΄ λ©λλ€. | ||
|
||
### ν μ€νΈ μΌμ΄μ€ νμΌ ν¬λ§· | ||
|
||
**μμ: caver-conformance-tests/Utils/Utils/parseKlaytnWalletKey.json** | ||
```json | ||
{ | ||
"parseKlaytnWalletKey": [ | ||
{ | ||
"id": "CONFORMANCE-UTILS-01", | ||
"description": "the given klaytn wallet key is a valid klaytn wallet key.", | ||
"input": { | ||
"key": "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d80x000xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" | ||
}, | ||
"expectedResult": { | ||
"status": "pass", | ||
"output": [ | ||
"0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", | ||
"0x00", | ||
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" | ||
] | ||
} | ||
}, | ||
{ | ||
"id": "CONFORMANCE-UTILS-02", | ||
"description": "the given klaytn wallet key contains invalid private key.", | ||
"input": { | ||
"key": "0xzza915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d80x000xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" | ||
}, | ||
"expectedResult": { | ||
"status": "fail", | ||
"errorMessage": "invalid klaytn wallet key" | ||
} | ||
}, | ||
{ | ||
"id": "CONFORMANCE-UTILS-03", | ||
"description": "the given klaytn wallet key contains invalid type `0x03`.", | ||
"input": { | ||
"key": "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d80x030xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" | ||
}, | ||
"expectedResult": { | ||
"status": "fail", | ||
"errorMessage": "invalid klaytn wallet key" | ||
} | ||
} | ||
] | ||
} | ||
``` |
Oops, something went wrong.