Skip to content

Commit

Permalink
test travis streamline
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Jun 9, 2020
1 parent 6d2e82c commit e98deb9
Show file tree
Hide file tree
Showing 2 changed files with 201 additions and 163 deletions.
350 changes: 187 additions & 163 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,180 +3,204 @@ sudo: required
cache:
timeout: 600
directories:
- $TRAVIS_BUILD_DIR/target/debug
- /opt/.cargo/git
- /opt/.cargo/registry
- $TRAVIS_BUILD_DIR/target/debug
- /opt/.cargo/git
- /opt/.cargo/registry
services:
- docker
- docker
git:
depth: 1
stages:
- CheckShell
- Release
- IntegrateTest
- Release
- IntegrateTest
before_install:
- docker pull cita/cita-build:ubuntu-18.04-20191128
- docker pull cita/cita-build:ubuntu-18.04-20191128
jobs:
include:

- stage: CheckShell
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: 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
if: tag IS NOT present
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
if: tag IS NOT present
script: npm run-script unit_permission
- <<: *stage-contract-test-sha3-secp256k1
name: Unit Auth
if: tag IS NOT present
script: npm run-script unit_auth
- <<: *stage-contract-test-sha3-secp256k1
name: Unit Chain
if: tag IS NOT present
script: npm run-script unit_chain
- <<: *stage-contract-test-sha3-secp256k1
name: Unit Group Management
if: tag IS NOT present
script: npm run-script unit_gm
- <<: *stage-contract-test-sha3-secp256k1
name: Unit Permission Management
if: tag IS NOT present
script: npm run-script unit_pm
- <<: *stage-contract-test-sha3-secp256k1
name: Unit Role Management
if: tag IS NOT present
script: npm run-script unit_rm
- <<: *stage-contract-test-sha3-secp256k1
name: Unit Quota Management
if: tag IS NOT present
script: npm run-script unit_qm
- <<: *stage-contract-test-sha3-secp256k1
name: Unit Quota
if: tag IS NOT present
script: npm run-script unit_quota
- <<: *stage-contract-test-sha3-secp256k1
name: Unit Abi
if: tag IS NOT present
script: npm run-script abi
- <<: *stage-contract-test-sha3-secp256k1
name: Unit Admin
if: tag IS NOT present
script: npm run-script unit_admin
- <<: *stage-contract-test-sha3-secp256k1
name: Unit Store
if: tag IS NOT present
script: npm run-script store
- <<: *stage-contract-test-sha3-secp256k1
name: Unit Batch Tx
if: tag IS NOT present
script: npm run-script batch_tx
- <<: *stage-contract-test-sha3-secp256k1
name: Unit Uint8
if: tag IS NOT present
script: npm run-script uint8
- <<: *stage-contract-test-sha3-secp256k1
name: Unit VersionManager
if: tag IS NOT present
script: npm run-script unit_vm

- &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
if: tag IS NOT present
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
script:
- npm run-script unit_node

- <<: *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
script:
- npm run-script unit_node
- <<: *stage-contract-test-sha3-secp256k1
name: Integrate Quota
if: tag IS NOT present
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
script:
- npm run-script integrate_quota

- <<: *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
script:
- npm run-script integrate_quota
- <<: *stage-contract-test-sha3-secp256k1
name: Integrate Permission
if: tag IS NOT present
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 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
if: tag IS NOT present
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 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
- <<: *stage-contract-test-sha3-secp256k1
name: Integrate Lifetime
if: tag IS NOT present
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
before_deploy:
- ./scripts/release_sha3_only.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"
on:
tags: true
14 changes: 14 additions & 0 deletions scripts/release_sha3_only.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

cp -r $(TRAVIS_BUILD_DIR)/target/release-cache docker/release/cita_secp256k1_sha3
cd ./docker/release || return
tar czf cita_secp256k1_sha3.tar.gz cita_secp256k1_sha3

CITA_REPOSITORY_NAME=hhliyan/cita-cli-2020-test
DOCKER_USERNAME=hhliyan

docker build . -t "$CITA_REPOSITORY_NAME":"$TRAVIS_TAG"

docker login --username "$DOCKER_USERNAME" --password "$DOCKER_PASSWORD"

docker push "$CITA_REPOSITORY_NAME":"$TRAVIS_TAG"

0 comments on commit e98deb9

Please sign in to comment.