Ensure all JS stages output test results
test plan: See the following link for examples of failing in each stage, as well as the test output being correctly loaded into the Tests tab: https://jenkins.inst-ci.net/blue/organizations/jenkins/Canvas%2Ftest-suites%2FJS/detail/JS/5082/pipeline fixes: CCI-178 flag = none Change-Id: I43c16ce7b589eb69cbe266c0929a722325ece2cf Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/222604 Reviewed-by: Derek Bender <djbender@instructure.com> Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> QA-Review: Jacob Powell <spowell@instructure.com> Product-Review: Jacob Powell <spowell@instructure.com>
This commit is contained in:
parent
3e423a0cb9
commit
85fe2246e9
|
@ -19,7 +19,7 @@
|
|||
*/
|
||||
|
||||
def isMerge () {
|
||||
return env.GERRIT_EVENT_TYPE == 'change-merged'
|
||||
return env.GERRIT_EVENT_TYPE == 'change-merged' ? '1' : ''
|
||||
}
|
||||
|
||||
def getImageTagVersion() {
|
||||
|
@ -35,7 +35,7 @@ pipeline {
|
|||
|
||||
environment {
|
||||
COMPOSE_FILE = 'docker-compose.new-jenkins-web.yml:docker-compose.new-jenkins-karma.yml'
|
||||
|
||||
COVERAGE = isMerge()
|
||||
NAME = getImageTagVersion()
|
||||
PATCHSET_TAG = "$DOCKER_REGISTRY_FQDN/jenkins/canvas-lms:$NAME"
|
||||
}
|
||||
|
@ -44,7 +44,6 @@ pipeline {
|
|||
steps {
|
||||
timeout(time: 2) {
|
||||
sh 'build/new-jenkins/docker-cleanup.sh'
|
||||
sh 'rm -rf ./tmp'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,37 +55,38 @@ pipeline {
|
|||
sh 'printenv | sort'
|
||||
sh 'build/new-jenkins/docker-compose-pull.sh'
|
||||
sh 'build/new-jenkins/docker-compose-build-up.sh'
|
||||
sh 'rm -rf ./tmp/*'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Tests') {
|
||||
environment {
|
||||
COVERAGE = isMerge()
|
||||
}
|
||||
parallel {
|
||||
stage('Jest') {
|
||||
environment {
|
||||
CONTAINER_NAME = 'tests-jest'
|
||||
}
|
||||
steps {
|
||||
sh 'build/new-jenkins/js/tests-jest.sh'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
sh 'mkdir -p ./tmp/jest'
|
||||
sh 'docker cp $(docker ps -qa -f name=tests-jest):/usr/src/app/coverage-js ./tmp/jest'
|
||||
sh 'ls -R ./tmp/jest | grep ".xml"'
|
||||
}
|
||||
always {
|
||||
sh 'mkdir -p ./tmp/$CONTAINER_NAME'
|
||||
sh 'docker cp $CONTAINER_NAME:/usr/src/app/coverage-js ./tmp/$CONTAINER_NAME/coverage-js'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Packages') {
|
||||
environment {
|
||||
CONTAINER_NAME = 'tests-packages'
|
||||
}
|
||||
steps {
|
||||
sh 'build/new-jenkins/js/tests-packages.sh'
|
||||
|
||||
}
|
||||
post {
|
||||
always {
|
||||
sh 'mkdir -p ./tmp/packages'
|
||||
sh 'docker cp $(docker ps -qa -f name=tests-packages):/usr/src/app/packages ./tmp/packages/'
|
||||
sh 'ls -R ./tmp/packages | grep ".xml"'
|
||||
}
|
||||
always {
|
||||
sh 'mkdir -p ./tmp/$CONTAINER_NAME'
|
||||
sh 'docker cp $CONTAINER_NAME:/usr/src/app/packages ./tmp/$CONTAINER_NAME/packages'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('canvas_quizzes') {
|
||||
|
@ -97,65 +97,61 @@ pipeline {
|
|||
stage('Karma - Spec Group - coffee') {
|
||||
environment {
|
||||
JSPEC_GROUP = 'coffee'
|
||||
CONTAINER_NAME = 'tests-karma-coffee'
|
||||
}
|
||||
steps {
|
||||
sh 'build/new-jenkins/js/tests-karma.sh'
|
||||
|
||||
}
|
||||
post {
|
||||
always {
|
||||
sh 'mkdir -p ./tmp/$JSPEC_GROUP'
|
||||
sh 'docker cp $(docker ps -qa -f name=$JSPEC_GROUP):/usr/src/app/coverage-js ./tmp/$JSPEC_GROUP'
|
||||
sh 'ls -R ./tmp/$JSPEC_GROUP | grep ".xml"'
|
||||
}
|
||||
always {
|
||||
sh 'mkdir -p ./tmp/$CONTAINER_NAME'
|
||||
sh 'docker cp $CONTAINER_NAME:/usr/src/app/coverage-js ./tmp/$CONTAINER_NAME/coverage-js'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Karma - Spec Group - jsa - A-F') {
|
||||
environment {
|
||||
JSPEC_GROUP = 'jsa'
|
||||
CONTAINER_NAME = 'tests-karma-jsa'
|
||||
}
|
||||
steps {
|
||||
sh 'build/new-jenkins/js/tests-karma.sh'
|
||||
|
||||
}
|
||||
post {
|
||||
always {
|
||||
sh 'mkdir -p ./tmp/$JSPEC_GROUP'
|
||||
sh 'docker cp $(docker ps -qa -f name=$JSPEC_GROUP):/usr/src/app/coverage-js ./tmp/$JSPEC_GROUP'
|
||||
sh 'ls -R ./tmp/$JSPEC_GROUP | grep ".xml"'
|
||||
}
|
||||
always {
|
||||
sh 'mkdir -p ./tmp/$CONTAINER_NAME'
|
||||
sh 'docker cp $CONTAINER_NAME:/usr/src/app/coverage-js ./tmp/$CONTAINER_NAME/coverage-js'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Karma - Spec Group - jsg - G') {
|
||||
environment {
|
||||
JSPEC_GROUP = 'jsg'
|
||||
CONTAINER_NAME = 'tests-karma-jsg'
|
||||
}
|
||||
steps {
|
||||
sh 'build/new-jenkins/js/tests-karma.sh'
|
||||
|
||||
}
|
||||
post {
|
||||
always {
|
||||
sh 'mkdir -p ./tmp/$JSPEC_GROUP'
|
||||
sh 'docker cp $(docker ps -qa -f name=$JSPEC_GROUP):/usr/src/app/coverage-js ./tmp/$JSPEC_GROUP'
|
||||
sh 'ls -R ./tmp/$JSPEC_GROUP | grep ".xml"'
|
||||
}
|
||||
always {
|
||||
sh 'mkdir -p ./tmp/$CONTAINER_NAME'
|
||||
sh 'docker cp $CONTAINER_NAME:/usr/src/app/coverage-js ./tmp/$CONTAINER_NAME/coverage-js'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Karma - Spec Group - jsh - H-Z') {
|
||||
environment {
|
||||
JSPEC_GROUP = 'jsh'
|
||||
CONTAINER_NAME = 'tests-karma-jsh'
|
||||
}
|
||||
steps {
|
||||
sh 'build/new-jenkins/js/tests-karma.sh'
|
||||
|
||||
}
|
||||
post {
|
||||
always {
|
||||
sh 'mkdir -p ./tmp/$JSPEC_GROUP'
|
||||
sh 'docker cp $(docker ps -qa -f name=$JSPEC_GROUP):/usr/src/app/coverage-js ./tmp/$JSPEC_GROUP'
|
||||
sh 'ls -R ./tmp/$JSPEC_GROUP | grep ".xml"'
|
||||
}
|
||||
always {
|
||||
sh 'mkdir -p ./tmp/$CONTAINER_NAME'
|
||||
sh 'docker cp $CONTAINER_NAME:/usr/src/app/coverage-js ./tmp/$CONTAINER_NAME/coverage-js'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -164,7 +160,8 @@ pipeline {
|
|||
post {
|
||||
always {
|
||||
script {
|
||||
junit allowEmptyResults: true, testResults: '**/coverage/*.xml,**/coverage-js/**/*.xml'
|
||||
junit allowEmptyResults: true, testResults: '**/*.xml'
|
||||
sh 'find ./tmp -path "*.xml"'
|
||||
}
|
||||
}
|
||||
cleanup {
|
||||
|
|
|
@ -2,5 +2,7 @@
|
|||
|
||||
set -x -o errexit -o errtrace -o nounset -o pipefail
|
||||
|
||||
docker-compose run --name tests-jest -e COVERAGE -e RAILS_ENV=test web \
|
||||
CONTAINER_NAME=${CONTAINER_NAME:-tests-jest}
|
||||
|
||||
docker-compose run --name $CONTAINER_NAME -e COVERAGE -e RAILS_ENV=test web \
|
||||
bash -c "bundle exec rails graphql:schema && yarn test:jest --runInBand"
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
set -x -o errexit -o errtrace -o nounset -o pipefail
|
||||
|
||||
NAME='tests-karma-'$JSPEC_GROUP
|
||||
CONTAINER_NAME=${CONTAINER_NAME:-tests-karma-$JSPEC_GROUP}
|
||||
|
||||
docker-compose run --name $NAME -e COVERAGE karma yarn test:karma:headless
|
||||
docker-compose run --name $CONTAINER_NAME -e COVERAGE karma yarn test:karma:headless
|
||||
|
|
|
@ -2,4 +2,6 @@
|
|||
|
||||
set -x -o errexit -o errtrace -o nounset -o pipefail
|
||||
|
||||
docker-compose run --name tests-packages -e COVERAGE web yarn test:packages
|
||||
CONTAINER_NAME=${CONTAINER_NAME:-tests-packages}
|
||||
|
||||
docker-compose run --name $CONTAINER_NAME -e COVERAGE web yarn test:packages
|
||||
|
|
|
@ -271,7 +271,7 @@
|
|||
},
|
||||
"repository": "instructure/canvas-lms",
|
||||
"scripts": {
|
||||
"test": "yarn test:packages && if [ \"$COVERAGE\" ]; then yarn test:jest:coverage --runInBand; else yarn test:jest --runInBand; fi && if [ \"$COVERAGE\" ]; then yarn test:karma; else yarn test:karma:concurrently; fi",
|
||||
"test": "yarn test:packages && if [[ \"$COVERAGE\" == \"1\" ]]; then yarn test:jest:coverage --runInBand; else yarn test:jest --runInBand; fi && if [[ \"$COVERAGE\" == \"1\" ]]; then yarn test:karma; else yarn test:karma:concurrently; fi",
|
||||
"test:coverage": "script/generate_js_coverage",
|
||||
"test:watch": "concurrently --names \"jest,karma\" \"jest --watch .\" \"yarn test:karma:watch\"",
|
||||
"test:jest": "jest --color --runInBand",
|
||||
|
@ -282,7 +282,7 @@
|
|||
"test:karma:headless": "yarn run test:karma --browsers ChromeHeadlessNoSandbox",
|
||||
"test:karma:watch": "node --max-old-space-size=4096 ./node_modules/.bin/karma start",
|
||||
"test:karma:watch:headless": "yarn run test:karma:watch --browsers ChromeHeadlessNoSandbox",
|
||||
"test:packages": "if [ \"$COVERAGE\" ]; then yarn workspace-run-serial test:coverage; else yarn workspace-run-serial test; fi",
|
||||
"test:packages": "if [[ \"$COVERAGE\" == \"1\" ]]; then yarn workspace-run-serial test:coverage; else yarn workspace-run-serial test; fi",
|
||||
"build": "yarn run build:css && yarn run build:js",
|
||||
"build:watch": "concurrently --raw \"yarn build:css:watch\" \"yarn build:js:watch\"",
|
||||
"build:css": "brandable_css",
|
||||
|
|
Loading…
Reference in New Issue