From 83c7068bd1e07672d9b0acd859947d1b1d41db72 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 6 Mar 2018 16:03:26 +0000 Subject: [PATCH] test new scripts on ci --- Jenkinsfile | 23 +++++++++++++++++++++-- Makefile | 10 ---------- docker-compose.ci.yml | 2 +- package.json | 4 ++-- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7a34ee7..bc9ba01 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,11 +9,30 @@ pipeline { } stages { - stage('CI') { + stage('Build') { 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') { steps { sh 'echo ${BRANCH_NAME}-${BUILD_NUMBER} > build_number.txt' diff --git a/Makefile b/Makefile index 063d96e..74b78a3 100644 --- a/Makefile +++ b/Makefile @@ -33,16 +33,6 @@ build: publish: 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 diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml index 2ca2f9a..98715c2 100644 --- a/docker-compose.ci.yml +++ b/docker-compose.ci.yml @@ -15,7 +15,7 @@ services: image: quay.io/sharelatex/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER extends: file: docker-compose-config.yml - service: dev + service: ci environment: REDIS_HOST: redis MONGO_HOST: mongo diff --git a/package.json b/package.json index fed3260..54181da 100644 --- a/package.json +++ b/package.json @@ -9,9 +9,9 @@ "scripts": { "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: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", - "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": "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",