Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
Added submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
jimni1222 committed Aug 23, 2021
1 parent ee01ef6 commit ce3300e
Show file tree
Hide file tree
Showing 27 changed files with 1,976 additions and 0 deletions.
189 changes: 189 additions & 0 deletions caver-conformance-tests/.circleci/config-sdk.yml
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
17 changes: 17 additions & 0 deletions caver-conformance-tests/.circleci/scripts/release_pr.sh
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 caver-conformance-tests/.circleci/scripts/release_tag_branch.sh
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
14 changes: 14 additions & 0 deletions caver-conformance-tests/.circleci/scripts/tag_verify.sh
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
24 changes: 24 additions & 0 deletions caver-conformance-tests/.github/CODEOWNERS
Validating CODEOWNERS rules …
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
1 change: 1 addition & 0 deletions caver-conformance-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
92 changes: 92 additions & 0 deletions caver-conformance-tests/README.md
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"
}
}
]
}
```
Loading

0 comments on commit ce3300e

Please sign in to comment.