test new scripts on ci

This commit is contained in:
Henry Oswald 2018-03-06 16:03:26 +00:00
parent e4e30cf2e2
commit 43b1fe4b68
4 changed files with 24 additions and 15 deletions

View file

@ -9,11 +9,30 @@ pipeline {
} }
stages { stages {
stage('CI') { stage('Build') {
steps { steps {
sh 'make ci' sh 'make build'
} }
} }
stage('Unit Tests') {
steps {
sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make test_unit'
}
}
stage('Acceptance Tests') {
steps {
sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make test_acceptance'
}
}
stage('Package and publish build') {
steps {
sh 'make publish'
}
}
stage('Publish build number') { stage('Publish build number') {
steps { steps {
sh 'echo ${BRANCH_NAME}-${BUILD_NUMBER} > build_number.txt' sh 'echo ${BRANCH_NAME}-${BUILD_NUMBER} > build_number.txt'

View file

@ -33,16 +33,6 @@ build:
publish: publish:
docker push quay.io/sharelatex/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) docker push quay.io/sharelatex/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
ci:
# On the CI server, we want to run our tests in the image that we
# have built for deployment, which is what the docker-compose.ci.yml
# override does.
PROJECT_NAME=$(PROJECT_NAME) \
BRANCH_NAME=$(BRANCH_NAME) \
BUILD_NUMBER=$(BUILD_NUMBER) \
DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" \
$(MAKE) build test publish
.PHONY: clean test test_unit test_acceptance test_clean build publish .PHONY: clean test test_unit test_acceptance test_clean build publish

View file

@ -15,7 +15,7 @@ services:
image: quay.io/sharelatex/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER image: quay.io/sharelatex/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER
extends: extends:
file: docker-compose-config.yml file: docker-compose-config.yml
service: dev service: ci
environment: environment:
REDIS_HOST: redis REDIS_HOST: redis
MONGO_HOST: mongo MONGO_HOST: mongo

View file

@ -9,9 +9,9 @@
"scripts": { "scripts": {
"compile:test:acceptance": "coffee -o test/acceptance/js -c test/acceptance/coffee", "compile:test:acceptance": "coffee -o test/acceptance/js -c test/acceptance/coffee",
"compile:test:smoke": "coffee -o test/smoke/js -c test/smoke/coffee", "compile:test:smoke": "coffee -o test/smoke/js -c test/smoke/coffee",
"compile:app": "coffee -o app/js -c app/coffee && coffee -c app.coffee", "compile:app": "coffee $COFFEE_OPTIONS -o app/js -c app/coffee && coffee $COFFEE_OPTIONS -c app.coffee",
"compile": "npm run compile:app && npm run compile:test:acceptance && npm run compile:test:smoke", "compile": "npm run compile:app && npm run compile:test:acceptance && npm run compile:test:smoke",
"start": "npm run compile:app && node app.js", "start": "npm run compile:app && node $NODE_APP_OPTIONS app.js",
"test:acceptance:_run": "mocha --recursive --reporter spec --timeout 15000 --exit $@ test/acceptance/js", "test:acceptance:_run": "mocha --recursive --reporter spec --timeout 15000 --exit $@ test/acceptance/js",
"test:acceptance": "npm run compile:app && npm run compile:acceptance_tests && npm run test:acceptance:_run -- $@", "test:acceptance": "npm run compile:app && npm run compile:acceptance_tests && npm run test:acceptance:_run -- $@",
"test:unit:_run": "mocha --recursive --exit --reporter spec $@ test/unit/js", "test:unit:_run": "mocha --recursive --exit --reporter spec $@ test/unit/js",