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

Commit

Permalink
Merge branch 'release/4.0.0' of https://github.com/LiskHQ/lisk-sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
shuse2 committed Nov 10, 2020
2 parents 0dcfc03 + 38e24ff commit b9e2f1d
Show file tree
Hide file tree
Showing 1,350 changed files with 152,238 additions and 200,641 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
"implicit-arrow-linebreak": "off",
"no-mixed-spaces-and-tabs": "off",
"operator-linebreak": "off"
},
"globals": {
"BigInt": true
}
}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ browsertest/test
tsconfig.tsbuildinfo

# Unsupported lock files
yarn.lock
package-lock.json

# Framework specific
**/network/configs/
Expand Down
6 changes: 3 additions & 3 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"*.js": ["prettier --write", "eslint", "git add"],
"*.ts": ["prettier --write", "tslint --format verbose", "git add"],
"*.{json,md}": ["prettier --write", "git add"]
"*.js": ["prettier --write", "eslint"],
"*.ts": ["prettier --write", "tslint --format verbose"],
"*.{json,md}": ["prettier --write"]
}
63 changes: 34 additions & 29 deletions Jenkinsfile.sdk
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@
def setup(start_application=false) {
cleanWs()
unstash 'build'
sh '''
for database in $( psql --tuples-only --command='SELECT datname FROM pg_database WHERE datdba = (SELECT usesysid FROM pg_user WHERE usename = current_user);' |awk '{ print $1 }' ); do
dropdb --if-exists $database
done
createdb lisk_dev
rm -rf /tmp/jest_rt/
'''
if(start_application) {
nvm(getNodejsVersion()) {
dir('framework') {
sh '''
# teardown_*() should have killed all node processes but we want to be sure
# this shouldn't hurt assuming the 'lisk-core' jenkins nodes have 1 executor
killall --verbose --wait node || true
for database in $( psql --tuples-only --command='SELECT datname FROM pg_database WHERE datdba = (SELECT usesysid FROM pg_user WHERE usename = current_user);' |awk '{ print $1 }' ); do
dropdb --if-exists $database
done
createdb lisk_dev
NODE_ENV=test LISK_CONSOLE_LOG_LEVEL=debug NEWRELIC_LICENSE_KEY= node test/test_app >.app.log 2>&1 &
'''
}
Expand Down Expand Up @@ -91,7 +94,7 @@ def teardown_jest(test_name) {
nvm(getNodejsVersion()) {
sh """
rm -rf coverage_jest_${test_name}; mkdir -p coverage_jest_${test_name}
cp .coverage/${test_name}/coverage-final.json coverage_jest_${test_name}/ || echo "Jest lcov coverage not found"
cp framework/.coverage/${test_name}/coverage-final.json coverage_jest_${test_name}/ || echo "Jest lcov coverage not found"
"""
}
} catch(err) {
Expand Down Expand Up @@ -148,9 +151,9 @@ pipeline {
steps {
nvm(getNodejsVersion()) {
sh '''
npm ci
npm run bootstrap -- --ci
npm run build
npm i -g yarn
yarn
yarn build
# needed by one of the "Functional HTTP GET tests"
git rev-parse HEAD > framework/REVISION
'''
Expand All @@ -160,10 +163,9 @@ pipeline {
}
stage('Lint') {
steps {
setup()
nvm(getNodejsVersion()) {
sh '''
npm run lint
yarn lint
'''
}
}
Expand All @@ -183,7 +185,9 @@ pipeline {
// Save all the test results
sh '''
rm -rf coverage_elements; mkdir -p coverage_elements
cp -rf elements/*/.nyc_output/* elements/*/.coverage/* coverage_elements/
for f in $( find elements/*/.coverage/ -type f ); do
cp $f coverage_elements/$( sha1sum $f | cut -d ' ' -f 1 )_$( basename $f )
done
'''
stash name: "coverage_elements", includes: "coverage_elements/*", allowEmpty: true
}
Expand Down Expand Up @@ -226,7 +230,21 @@ pipeline {
stage('Lisk Framework Integration') {
agent { node { label 'lisk-framework' }}
steps {
setup()
// jest ITs seem to need special treatment
nvm(getNodejsVersion()) {
sh '''
npm install --global yarn
yarn
yarn build
'''
}
sh '''
for database in $( psql --tuples-only --command='SELECT datname FROM pg_database WHERE datdba = (SELECT usesysid FROM pg_user WHERE usename = current_user);' |awk '{ print $1 }' ); do
dropdb --if-exists $database
done
createdb lisk_dev
rm -rf /tmp/jest_rt/
'''
run_jest('integration')
}
post {
Expand All @@ -251,6 +269,7 @@ pipeline {
}
stage('Legacy Framework test (mocha)') {
parallel {
/*
stage('Functional HTTP GET tests') {
agent { node { label 'lisk-framework' }}
steps {
Expand Down Expand Up @@ -299,6 +318,7 @@ pipeline {
}
}
}
*/
stage('Unit tests') {
agent { node { label 'lisk-framework' }}
steps {
Expand All @@ -311,21 +331,6 @@ pipeline {
}
}
}
stage('Integration tests') {
agent { node { label 'lisk-framework' }}
options {
timeout(time: 10, unit: 'MINUTES')
}
steps {
setup()
run_mocha('integration')
}
post {
cleanup {
teardown_mocha('integration')
}
}
}
}
}
}
Expand Down Expand Up @@ -364,10 +369,10 @@ pipeline {
nvm(getNodejsVersion()) {
sh '''
npx nyc merge ./.nyc_output ci_coverage/coverage.json
npx nyc report --report-dir=ci_coverage --reporter=text --reporter=cobertura
node scripts/map_coverage.js ci_coverage/coverage.json
'''
}
cobertura coberturaReportFile: 'ci_coverage/cobertura-coverage.xml'
cobertura coberturaReportFile: 'coverage/cobertura-coverage.xml'
} catch(err) {
println "Could not report coverage statistics:\n${err}"
}
Expand Down
4 changes: 2 additions & 2 deletions Jenkinsfile.sonar
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pipeline {
sh """#!/bin/bash
${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=LiskHQ_lisk-sdk \
-Dsonar.organization=liskhq \
-Dsonar.exclusions=**/test/**,**/migrations/**,reset_mem_tables.sql,**/protocol-specs/**,**/templates/browsertest.tmpl/**,**/lisk-p2p/examples/** \
-Dsonar.exclusions=**/test/**,**/migrations/**,**/entities/**,reset_mem_tables.sql,**/protocol-specs/**,**/templates/browsertest.tmpl/**,**/lisk-p2p/examples/** \
-Dsonar.scm.revision=$GIT_COMMIT \
-Dsonar.projectVersion=\${GIT_COMMIT::7} \
-Dsonar.pullrequest.key=$CHANGE_ID \
Expand All @@ -32,7 +32,7 @@ pipeline {
sh """#!/bin/bash
${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=LiskHQ_lisk-sdk \
-Dsonar.organization=liskhq \
-Dsonar.exclusions=**/test/**,**/migrations/**,reset_mem_tables.sql,**/protocol-specs/**,**/templates/browsertest.tmpl/**,**/lisk-p2p/examples/** \
-Dsonar.exclusions=**/test/**,**/migrations/**,**/entities/**,reset_mem_tables.sql,**/protocol-specs/**,**/templates/browsertest.tmpl/**,**/lisk-p2p/examples/** \
-Dsonar.scm.revision=$GIT_COMMIT \
-Dsonar.projectVersion=\${GIT_COMMIT::7} \
-Dsonar.branch.name=$GIT_BRANCH \
Expand Down
9 changes: 9 additions & 0 deletions commander/.mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"diff": true,
"extension": ["ts"],
"recursive": true,
"spec": "test/**/*.ts",
"require": ["ts-node/register", "./test/setup.js"],
"timeout": 10000,
"watch-files": ["src/**/*.ts"]
}
4 changes: 4 additions & 0 deletions commander/.nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"exclude": ["test/**", "**/*.d.ts"],
"extension": [".ts"]
}
Loading

0 comments on commit b9e2f1d

Please sign in to comment.