-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
6d2e82c
commit 98fa216
Showing
5 changed files
with
229 additions
and
174 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,182 +1,33 @@ | ||
language: generic | ||
sudo: required | ||
cache: | ||
timeout: 600 | ||
timeout: 1024 | ||
directories: | ||
- $TRAVIS_BUILD_DIR/target/debug | ||
- /opt/.cargo/git | ||
- /opt/.cargo/registry | ||
services: | ||
- docker | ||
git: | ||
depth: 1 | ||
stages: | ||
- CheckShell | ||
- Release | ||
- IntegrateTest | ||
before_install: | ||
- "./docker/release" | ||
stages: | ||
- secp256k1 | ||
- sm2 | ||
- blake2b | ||
before_install: | ||
- docker pull cita/cita-build:ubuntu-18.04-20191128 | ||
jobs: | ||
include: | ||
|
||
- stage: CheckShell | ||
jobs: | ||
include: | ||
- stage: secp256k1 | ||
script: | ||
# Fail if any of these files have warnings | ||
- shellcheck scripts/*.sh env.sh | ||
|
||
- stage: Release | ||
name: Release for Integrate Test | ||
language: node_js | ||
node_js: | ||
# - lts/* | ||
- 8.10.0 | ||
cache: | ||
directories: | ||
- $TRAVIS_BUILD_DIR/target/release-cache | ||
env: HASH_ALGO=sha3hash CRYPTO_ALGO=secp256k1 | ||
before_script: | ||
- cd $TRAVIS_BUILD_DIR | ||
- ./scripts/replace_default_feature.sh ./ sha3hash ${HASH_ALGO} | ||
- ./scripts/replace_default_feature.sh ./ secp256k1 ${CRYPTO_ALGO} | ||
script: ./env.sh make release | ||
before_cache: | ||
- cd $TRAVIS_BUILD_DIR | ||
- rm -rf target/release-cache | ||
- mv -vf target/install target/release-cache | ||
|
||
- &stage-contract-test-sha3-secp256k1 | ||
stage: IntegrateTest | ||
name: Unit Group | ||
language: node_js | ||
node_js: | ||
# - lts/* | ||
- 8.10.0 | ||
cache: | ||
directories: | ||
- $TRAVIS_BUILD_DIR/target/release-cache | ||
env: HASH_ALGO=sha3hash CRYPTO_ALGO=secp256k1 | ||
before_install: | ||
- cd $TRAVIS_BUILD_DIR | ||
- rm -rf target/install | ||
- cp -rv target/release-cache target/install | ||
install: | ||
- rm -rf /opt/cita-run/test-chain | ||
- cd $TRAVIS_BUILD_DIR/target/install | ||
- ./bin/cita create | ||
--nodes "127.0.0.1:4100" | ||
--super_admin "0x4b5ae4567ad5d9fb92bc9afd6a657e6fa13a2523" | ||
- ./bin/cita setup test-chain/0 | ||
- ./bin/cita start test-chain/0 | ||
before_script: | ||
- cd $TRAVIS_BUILD_DIR/target/install/scripts/contracts/tests | ||
- travis_retry yarn install | ||
script: npm run-script unit_group | ||
- <<: *stage-contract-test-sha3-secp256k1 | ||
name: Unit Permission | ||
script: npm run-script unit_permission | ||
- <<: *stage-contract-test-sha3-secp256k1 | ||
name: Unit Auth | ||
script: npm run-script unit_auth | ||
- <<: *stage-contract-test-sha3-secp256k1 | ||
name: Unit Chain | ||
script: npm run-script unit_chain | ||
- <<: *stage-contract-test-sha3-secp256k1 | ||
name: Unit Group Management | ||
script: npm run-script unit_gm | ||
- <<: *stage-contract-test-sha3-secp256k1 | ||
name: Unit Permission Management | ||
script: npm run-script unit_pm | ||
- <<: *stage-contract-test-sha3-secp256k1 | ||
name: Unit Role Management | ||
script: npm run-script unit_rm | ||
- <<: *stage-contract-test-sha3-secp256k1 | ||
name: Unit Quota Management | ||
script: npm run-script unit_qm | ||
- <<: *stage-contract-test-sha3-secp256k1 | ||
name: Unit Quota | ||
script: npm run-script unit_quota | ||
- <<: *stage-contract-test-sha3-secp256k1 | ||
name: Unit Abi | ||
script: npm run-script abi | ||
- <<: *stage-contract-test-sha3-secp256k1 | ||
name: Unit Admin | ||
script: npm run-script unit_admin | ||
- <<: *stage-contract-test-sha3-secp256k1 | ||
name: Unit Store | ||
script: npm run-script store | ||
- <<: *stage-contract-test-sha3-secp256k1 | ||
name: Unit Batch Tx | ||
script: npm run-script batch_tx | ||
- <<: *stage-contract-test-sha3-secp256k1 | ||
name: Unit Uint8 | ||
script: npm run-script uint8 | ||
- <<: *stage-contract-test-sha3-secp256k1 | ||
name: Unit VersionManager | ||
script: npm run-script unit_vm | ||
|
||
- <<: *stage-contract-test-sha3-secp256k1 | ||
name: Unit Node | ||
install: | ||
- cd $TRAVIS_BUILD_DIR/target/install | ||
- ./bin/cita create | ||
--nodes "127.0.0.1:4000,127.0.0.1:4001,127.0.0.1:4002" | ||
--super_admin "0x4b5ae4567ad5d9fb92bc9afd6a657e6fa13a2523" | ||
- for i in {0..2} ; do | ||
./bin/cita setup test-chain/$i | ||
&& ./bin/cita start test-chain/$i ; | ||
done | ||
- "./scripts/release_sha3.sh" | ||
- stage: sm2 | ||
script: | ||
- npm run-script unit_node | ||
|
||
- <<: *stage-contract-test-sha3-secp256k1 | ||
name: Integrate Quota | ||
install: | ||
- cd $TRAVIS_BUILD_DIR/target/install | ||
- ./bin/cita create | ||
--nodes "127.0.0.1:4100" | ||
--contract_arguments "SysConfig.checkQuota=true" | ||
--super_admin "0x4b5ae4567ad5d9fb92bc9afd6a657e6fa13a2523" | ||
- ./bin/cita setup test-chain/0 | ||
- ./bin/cita start test-chain/0 | ||
- "./scripts/release_sm2.sh" | ||
- stage: blake2b | ||
script: | ||
- npm run-script integrate_quota | ||
|
||
- <<: *stage-contract-test-sha3-secp256k1 | ||
name: Integrate Permission | ||
install: | ||
- cd $TRAVIS_BUILD_DIR/target/install | ||
- ./bin/cita create | ||
--nodes "127.0.0.1:4100" | ||
--contract_arguments "SysConfig.checkCallPermission=true" | ||
--super_admin "0x4b5ae4567ad5d9fb92bc9afd6a657e6fa13a2523" | ||
- ./bin/cita setup test-chain/0 | ||
- ./bin/cita start test-chain/0 | ||
script: | ||
- npm run-script permission | ||
|
||
- <<: *stage-contract-test-sha3-secp256k1 | ||
name: Integrate AutoExec | ||
install: | ||
- cd $TRAVIS_BUILD_DIR/target/install | ||
- ./bin/cita create | ||
--nodes "127.0.0.1:4100" | ||
--contract_arguments "SysConfig.autoExec=true" | ||
--super_admin "0x4b5ae4567ad5d9fb92bc9afd6a657e6fa13a2523" | ||
- ./bin/cita setup test-chain/0 | ||
- ./bin/cita start test-chain/0 | ||
script: | ||
- npm run-script auto_exec | ||
|
||
- <<: *stage-contract-test-sha3-secp256k1 | ||
name: Integrate Lifetime | ||
install: | ||
- cd $TRAVIS_BUILD_DIR/target/install | ||
- ./bin/cita create | ||
--nodes "127.0.0.1:4100" | ||
--contract_arguments "SysConfig.economicalModel=1 PriceManager.quotaPrice=1" | ||
--super_admin "0x4b5ae4567ad5d9fb92bc9afd6a657e6fa13a2523" | ||
--init_token 0x1000000 | ||
- ./bin/cita setup test-chain/0 | ||
- ./bin/cita start test-chain/0 | ||
script: | ||
- npm run-script lifetime | ||
- "./scripts/release_black2b.sh" | ||
deploy: | ||
provider: releases | ||
api_key: | ||
secure: UmH2AT2HhPBL3wkaFa5lCRnK5j1PbqeT7w4LpJ7LqS7/YakpIYlMLmLutEVH2Gu8tvhUHM7Wm2soHMWUgo08L+eN7RPeV6t2r6z/5N9aD4I+l7ki5W6XwwZ5kYcs05xuSFn6cJxyPHR4TeM1aZmJ+/ngKAUhdGr6f16z1XAt4HUvg/HKVOZRukbnHp3pKQeMuXYlMSJBsaAvyY64cwGnKQMngAnZJxEG7s/5LfJb3zrlfxm2gRSnvcvTjdfeYSk4kXaWvWVQXeNIwEjNkKu7/EnoaYr5hmylTGukA8lIMeDdmJClroBZeTESJLSZ0gLNIlX03PyM50IVMayKp16+aAf6IY0/CPFYZSCGtR6MyV4GpQBMHgNkNR+B6TtzR9N7CRoXtoKfK5Gb/sba3Y01koaFRwq6Fu0rjofl+u04R8JEMaBKzY/OgjK2nbhYReU63dRWEesFZOxVYhp9v9/Tv+0ZFluq9Aukn7c4ePs96YBaUgCVbtzCebyNx85t05C0RmXaB/EsX7VwXwoJltE8CGJ9A9ZuBusZsjupFNOxsqzrNzhfkro5BVp7jgBgSn0X9D2dx1PL6xNkMneLz5npyrcbshFXjOkMV9d0w9gMX543tQlfuVIBPmrGGFGqX2cRWADwoRKKfxVSoWrHR0RhQk8dF3pcVsmILS70PCoSqGI= | ||
file: | ||
- "./docker/release/cita_secp256k1_sha3.tar.gz" | ||
- "./docker/release/cita_sm2_sm3.tar.gz" | ||
- "./docker/release/cita_ed25519_blake2b.tar.gz" | ||
on: | ||
tags: true |
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,48 @@ | ||
#!/bin/bash | ||
DIR=./docker/release | ||
SOURCE_DIR=`pwd` | ||
echo "pwd travis is " "$(pwd)" | ||
git submodule init | ||
git submodule update | ||
|
||
function replace_default_feature () { | ||
local workspacedir="${1}" | ||
local old_feature="${2}" | ||
local new_feature="${3}" | ||
if [ "${old_feature}" = "${new_feature}" ]; then | ||
return | ||
fi | ||
local before_feature='[ \t]*default[ \t]*=[ \t]*\[.*\"' | ||
local before_feature2='[ \t]*features[ \t]*=[ \t]*\[.*\"' | ||
local all_feature='[ \t]*\(features\|default\)[ \t]*=[ \t]*\[.*\"' | ||
local after_feature='\".*' | ||
find "${workspacedir}" -mindepth 2 -name "Cargo.toml" -print0 \ | ||
| xargs -0 grep -l "^${all_feature}${old_feature}${after_feature}" \ | ||
| while read -r cargotoml; do | ||
if [ -f "${cargotoml}" ]; then | ||
echo "[Info ] Replace [${old_feature}] by [${new_feature}] for [${cargotoml}] ..." | ||
sed -i "s/\(${before_feature}\)${old_feature}\(${after_feature}\)\$/\1${new_feature}\2/" "${cargotoml}" | ||
sed -i "s/\(${before_feature2}\)${old_feature}\(${after_feature}\)\$/\1${new_feature}\2/" "${cargotoml}" | ||
else | ||
echo "[Error] [${cargotoml}] is not a file." | ||
fi | ||
done | ||
} | ||
|
||
DEFAULT_HASH="sha3hash" | ||
DEFAULT_CRYPT="secp256k1" | ||
|
||
# blake2b | ||
SELECT_HASH_Blake2b="blake2bhash" | ||
SELECT_CRYPT_Blake2b="ed25519" | ||
|
||
function replace_algorithm_blake2b() { | ||
replace_default_feature "${SOURCE_DIR}" "${DEFAULT_HASH}" "${SELECT_HASH_Blake2b}" | ||
replace_default_feature "${SOURCE_DIR}" "${DEFAULT_CRYPT}" "${SELECT_CRYPT_Blake2b}" | ||
} | ||
|
||
replace_algorithm_blake2b | ||
sudo rm -rf target | ||
sudo ./env.sh make release > /dev/null | ||
cp -r target/install $DIR/cita_ed25519_blake2b | ||
|
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,94 @@ | ||
#!/bin/bash | ||
DIR=./docker/release | ||
SOURCE_DIR=`pwd` | ||
echo "pwd travis is " "$(pwd)" | ||
git submodule init | ||
git submodule update | ||
|
||
function replace_default_feature () { | ||
local workspacedir="${1}" | ||
local old_feature="${2}" | ||
local new_feature="${3}" | ||
if [ "${old_feature}" = "${new_feature}" ]; then | ||
return | ||
fi | ||
local before_feature='[ \t]*default[ \t]*=[ \t]*\[.*\"' | ||
local before_feature2='[ \t]*features[ \t]*=[ \t]*\[.*\"' | ||
local all_feature='[ \t]*\(features\|default\)[ \t]*=[ \t]*\[.*\"' | ||
local after_feature='\".*' | ||
find "${workspacedir}" -mindepth 2 -name "Cargo.toml" -print0 \ | ||
| xargs -0 grep -l "^${all_feature}${old_feature}${after_feature}" \ | ||
| while read -r cargotoml; do | ||
if [ -f "${cargotoml}" ]; then | ||
echo "[Info ] Replace [${old_feature}] by [${new_feature}] for [${cargotoml}] ..." | ||
sed -i "s/\(${before_feature}\)${old_feature}\(${after_feature}\)\$/\1${new_feature}\2/" "${cargotoml}" | ||
sed -i "s/\(${before_feature2}\)${old_feature}\(${after_feature}\)\$/\1${new_feature}\2/" "${cargotoml}" | ||
else | ||
echo "[Error] [${cargotoml}] is not a file." | ||
fi | ||
done | ||
} | ||
|
||
# sha256 | ||
sudo rm -rf target | ||
sed -i "s/\"\${USE_TTY}\" \"\${CONTAINER_NAME}\"/\${USE_TTY} \${CONTAINER_NAME}/" ./env.sh | ||
sudo ./env.sh make release | ||
|
||
cp -r target/install $DIR/cita_secp256k1_sha3 | ||
|
||
DEFAULT_HASH="sha3hash" | ||
DEFAULT_CRYPT="secp256k1" | ||
|
||
# sm2 | ||
SELECT_HASH_SM2="sm3hash" | ||
SELECT_CRYPT_SM2="sm2" | ||
function replace_algorithm_sm2() { | ||
replace_default_feature "${SOURCE_DIR}" "${SELECT_HASH}" "${SELECT_HASH_SM2}" | ||
replace_default_feature "${SOURCE_DIR}" "${SELECT_CRYPT}" "${SELECT_CRYPT_SM2}" | ||
} | ||
replace_algorithm_sm2 | ||
sudo rm -rf target | ||
sudo ./env.sh make release > /dev/null | ||
cp -r target/install $DIR/cita_sm2_sm3 | ||
|
||
|
||
# blake2b | ||
SELECT_HASH_Blake2b="blake2bhash" | ||
SELECT_CRYPT_Blake2b="ed25519" | ||
|
||
function replace_algorithm_blake2b() { | ||
replace_default_feature "${SOURCE_DIR}" "${DEFAULT_HASH}" "${SELECT_HASH_Blake2b}" | ||
replace_default_feature "${SOURCE_DIR}" "${DEFAULT_CRYPT}" "${SELECT_CRYPT_Blake2b}" | ||
} | ||
|
||
replace_algorithm_blake2b | ||
sudo rm -rf target | ||
sudo ./env.sh make release > /dev/null | ||
cp -r target/install $DIR/cita_ed25519_blake2b | ||
|
||
# tar.gz | ||
cd $DIR | ||
tar -zcf cita_secp256k1_sha3.tar.gz cita_secp256k1_sha3 | ||
tar -zcf cita_sm2_sm3.tar.gz cita_sm2_sm3 | ||
tar -zcf cita_ed25519_blake2b.tar.gz cita_ed25519_blake2b | ||
|
||
# build image | ||
CITA_REPOSITORY_NAME=hhliyan/cli-test-20 | ||
cat "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin | ||
docker push "$CITA_CLI_REPOSITORY_NAME":"$TRAVIS_TAG" | ||
|
||
|
||
docker build . --build-arg ENCRYPTION_ALG=secp256k1 --build-arg HASH_ALG=sha3 -t $CITA_REPOSITORY_NAME:$TRAVIS_TAG-secp256k1-sha3 | ||
docker push $CITA_REPOSITORY_NAME:$TRAVIS_TAG-secp256k1-sha3 | ||
|
||
docker build . --build-arg ENCRYPTION_ALG=sm2 --build-arg HASH_ALG=sm3 -t $CITA_REPOSITORY_NAME:$TRAVIS_TAG-sm2-sm3 | ||
docker push $CITA_REPOSITORY_NAME:$TRAVIS_TAG-sm2-sm3 | ||
|
||
|
||
docker build . --build-arg ENCRYPTION_ALG=ed25519 --build-arg HASH_ALG=blake2b -t $CITA_REPOSITORY_NAME:$TRAVIS_TAG-ed25519-blake2b | ||
docker push $CITA_REPOSITORY_NAME:$TRAVIS_TAG-ed25519-blake2b | ||
|
||
|
||
|
||
|
||
|
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,16 @@ | ||
|
||
#!/bin/bash | ||
git submodule init | ||
git submodule update | ||
|
||
releaseSha256="/var/release/cita_secp256k1_sha3" | ||
|
||
sudo rm -rf $releaseSha256 | ||
sudo rm -rf target | ||
|
||
sed -i "s/\"\${USE_TTY}\" \"\${CONTAINER_NAME}\"/\${USE_TTY} \${CONTAINER_NAME}/" ./env.sh | ||
sudo ./env.sh make release | ||
|
||
cp -r target/install $releaseSha256 | ||
cd $releaseSha256 | ||
tar czvf cita_secp256k1_sha3.tar.gz cita_secp256k1_sha3 |
Oops, something went wrong.