mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Update with build scripts version 1.0.0
This commit is contained in:
parent
a59dc9e149
commit
bd581d069b
7 changed files with 156 additions and 20 deletions
50
services/chat/Jenkinsfile
vendored
50
services/chat/Jenkinsfile
vendored
|
@ -1,10 +1,11 @@
|
||||||
pipeline {
|
String cron_string = BRANCH_NAME == "master" ? "@daily" : ""
|
||||||
|
|
||||||
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
|
|
||||||
triggers {
|
triggers {
|
||||||
pollSCM('* * * * *')
|
pollSCM('* * * * *')
|
||||||
cron('@daily')
|
cron(cron_string)
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
|
@ -17,15 +18,17 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
// we need to disable logallrefupdates, else git clones during the npm install will require git to lookup the user id
|
// we need to disable logallrefupdates, else git clones
|
||||||
// which does not exist in the container's /etc/passwd file, causing the clone to fail.
|
// during the npm install will require git to lookup the
|
||||||
|
// user id which does not exist in the container's
|
||||||
|
// /etc/passwd file, causing the clone to fail.
|
||||||
sh 'git config --global core.logallrefupdates false'
|
sh 'git config --global core.logallrefupdates false'
|
||||||
sh 'rm -fr node_modules'
|
sh 'rm -rf node_modules'
|
||||||
sh 'npm install && npm rebuild'
|
sh 'npm install && npm rebuild'
|
||||||
sh 'npm install --quiet grunt-cli'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Compile and Test') {
|
|
||||||
|
stage('Compile') {
|
||||||
agent {
|
agent {
|
||||||
docker {
|
docker {
|
||||||
image 'node:4.2.1'
|
image 'node:4.2.1'
|
||||||
|
@ -33,28 +36,37 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
sh 'node_modules/.bin/grunt coffee'
|
sh 'npm run compile:all'
|
||||||
sh 'node_modules/.bin/grunt compile:acceptance_tests'
|
|
||||||
sh 'NODE_ENV=development node_modules/.bin/grunt test:unit'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stage('Unit Tests') {
|
||||||
|
steps {
|
||||||
|
sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make test_unit'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stage('Acceptance Tests') {
|
stage('Acceptance Tests') {
|
||||||
steps {
|
steps {
|
||||||
sh 'docker pull sharelatex/acceptance-test-runner'
|
sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make test_acceptance'
|
||||||
sh 'docker run --rm -v $(pwd):/app sharelatex/acceptance-test-runner'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Package') {
|
|
||||||
|
stage('Package and publish build') {
|
||||||
steps {
|
steps {
|
||||||
sh 'echo ${BUILD_NUMBER} > build_number.txt'
|
sh 'echo ${BUILD_NUMBER} > build_number.txt'
|
||||||
sh 'touch build.tar.gz' // Avoid tar warning about files changing during read
|
sh 'touch build.tar.gz' // Avoid tar warning about files changing during read
|
||||||
sh 'tar -czf build.tar.gz --exclude=build.tar.gz --exclude-vcs .'
|
sh 'tar -czf build.tar.gz --exclude=build.tar.gz --exclude-vcs .'
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Publish') {
|
|
||||||
steps {
|
|
||||||
withAWS(credentials:'S3_CI_BUILDS_AWS_KEYS', region:"${S3_REGION_BUILD_ARTEFACTS}") {
|
withAWS(credentials:'S3_CI_BUILDS_AWS_KEYS', region:"${S3_REGION_BUILD_ARTEFACTS}") {
|
||||||
s3Upload(file:'build.tar.gz', bucket:"${S3_BUCKET_BUILD_ARTEFACTS}", path:"${JOB_NAME}/${BUILD_NUMBER}.tar.gz")
|
s3Upload(file:'build.tar.gz', bucket:"${S3_BUCKET_BUILD_ARTEFACTS}", path:"${JOB_NAME}/${BUILD_NUMBER}.tar.gz")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Publish build number') {
|
||||||
|
steps {
|
||||||
|
sh 'echo ${BRANCH_NAME}-${BUILD_NUMBER} > build_number.txt'
|
||||||
|
withAWS(credentials:'S3_CI_BUILDS_AWS_KEYS', region:"${S3_REGION_BUILD_ARTEFACTS}") {
|
||||||
// The deployment process uses this file to figure out the latest build
|
// The deployment process uses this file to figure out the latest build
|
||||||
s3Upload(file:'build_number.txt', bucket:"${S3_BUCKET_BUILD_ARTEFACTS}", path:"${JOB_NAME}/latest")
|
s3Upload(file:'build_number.txt', bucket:"${S3_BUCKET_BUILD_ARTEFACTS}", path:"${JOB_NAME}/latest")
|
||||||
}
|
}
|
||||||
|
@ -63,6 +75,10 @@ pipeline {
|
||||||
}
|
}
|
||||||
|
|
||||||
post {
|
post {
|
||||||
|
always {
|
||||||
|
sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make test_clean'
|
||||||
|
}
|
||||||
|
|
||||||
failure {
|
failure {
|
||||||
mail(from: "${EMAIL_ALERT_FROM}",
|
mail(from: "${EMAIL_ALERT_FROM}",
|
||||||
to: "${EMAIL_ALERT_TO}",
|
to: "${EMAIL_ALERT_TO}",
|
||||||
|
|
29
services/chat/Makefile
Normal file
29
services/chat/Makefile
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
# This file was auto-generated, do not edit it directly.
|
||||||
|
# Instead run bin/update_build_scripts from
|
||||||
|
# https://github.com/sharelatex/sharelatex-dev-environment
|
||||||
|
# Version: 1.0.0
|
||||||
|
|
||||||
|
BUILD_NUMBER ?= local
|
||||||
|
BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
|
||||||
|
PROJECT_NAME = chat
|
||||||
|
DOCKER_COMPOSE_FLAGS ?= -f docker-compose.yml
|
||||||
|
DOCKER_COMPOSE := docker-compose ${DOCKER_COMPOSE_FLAGS}
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f app.js
|
||||||
|
rm -rf app/js
|
||||||
|
rm -rf test/unit/js
|
||||||
|
rm -rf test/acceptance/js
|
||||||
|
|
||||||
|
test: test_unit test_acceptance
|
||||||
|
|
||||||
|
test_unit:
|
||||||
|
@[ -d test/unit ] && $(DOCKER_COMPOSE) run --rm test_unit -- ${MOCHA_ARGS} || echo "chat has no unit tests"
|
||||||
|
|
||||||
|
test_acceptance: test_clean # clear the database before each acceptance test run
|
||||||
|
@[ -d test/acceptance ] && $(DOCKER_COMPOSE) run --rm test_acceptance -- ${MOCHA_ARGS} || echo "chat has no acceptance tests"
|
||||||
|
|
||||||
|
test_clean:
|
||||||
|
$(DOCKER_COMPOSE) down
|
||||||
|
|
||||||
|
.PHONY: clean test test_unit test_acceptance test_clean build publish
|
33
services/chat/docker-compose.ci.yml
Normal file
33
services/chat/docker-compose.ci.yml
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
# This file was auto-generated, do not edit it directly.
|
||||||
|
# Instead run bin/update_build_scripts from
|
||||||
|
# https://github.com/sharelatex/sharelatex-dev-environment
|
||||||
|
# Version: 1.0.0
|
||||||
|
|
||||||
|
version: "2"
|
||||||
|
|
||||||
|
services:
|
||||||
|
test_unit:
|
||||||
|
image: node:4.2.1
|
||||||
|
volumes:
|
||||||
|
- .:/app
|
||||||
|
working_dir: /app
|
||||||
|
entrypoint: npm run test:unit:run
|
||||||
|
|
||||||
|
test_acceptance:
|
||||||
|
image: node:4.2.1
|
||||||
|
volumes:
|
||||||
|
- .:/app
|
||||||
|
working_dir: /app
|
||||||
|
environment:
|
||||||
|
REDIS_HOST: redis
|
||||||
|
MONGO_HOST: mongo
|
||||||
|
depends_on:
|
||||||
|
- redis
|
||||||
|
- mongo
|
||||||
|
entrypoint: npm run test:acceptance:run
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis
|
||||||
|
|
||||||
|
mongo:
|
||||||
|
image: mongo:3.4
|
33
services/chat/docker-compose.yml
Normal file
33
services/chat/docker-compose.yml
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
# This file was auto-generated, do not edit it directly.
|
||||||
|
# Instead run bin/update_build_scripts from
|
||||||
|
# https://github.com/sharelatex/sharelatex-dev-environment
|
||||||
|
# Version: 1.0.0
|
||||||
|
|
||||||
|
version: "2"
|
||||||
|
|
||||||
|
services:
|
||||||
|
test_unit:
|
||||||
|
image: node:4.2.1
|
||||||
|
volumes:
|
||||||
|
- .:/app
|
||||||
|
working_dir: /app
|
||||||
|
entrypoint: npm run test:unit
|
||||||
|
|
||||||
|
test_acceptance:
|
||||||
|
image: node:4.2.1
|
||||||
|
volumes:
|
||||||
|
- .:/app
|
||||||
|
environment:
|
||||||
|
REDIS_HOST: redis
|
||||||
|
MONGO_HOST: mongo
|
||||||
|
depends_on:
|
||||||
|
- redis
|
||||||
|
- mongo
|
||||||
|
working_dir: /app
|
||||||
|
entrypoint: npm run test:acceptance
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis
|
||||||
|
|
||||||
|
mongo:
|
||||||
|
image: mongo:3.4
|
15
services/chat/nodemon.json
Normal file
15
services/chat/nodemon.json
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"ignore": [
|
||||||
|
".git",
|
||||||
|
"node_modules/"
|
||||||
|
],
|
||||||
|
"verbose": true,
|
||||||
|
"execMap": {
|
||||||
|
"js": "npm run start"
|
||||||
|
},
|
||||||
|
"watch": [
|
||||||
|
"app/coffee/",
|
||||||
|
"app.coffee"
|
||||||
|
],
|
||||||
|
"ext": "coffee"
|
||||||
|
}
|
|
@ -8,7 +8,15 @@
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"compile:app": "coffee -o app/js -c app/coffee && coffee -c app.coffee",
|
"compile:app": "coffee -o app/js -c app/coffee && coffee -c app.coffee",
|
||||||
"start": "npm run compile:app && node app.js"
|
"start": "npm run compile:app && node 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 --reporter spec $@ test/unit/js",
|
||||||
|
"test:unit": "npm run compile:app && npm run compile:unit_tests && npm run test:unit:run -- $@",
|
||||||
|
"compile:unit_tests": "[ -e test/unit ] && coffee -o test/unit/js -c test/unit/coffee || echo 'No unit tests to compile'",
|
||||||
|
"compile:acceptance_tests": "[ -e test/acceptance ] && coffee -o test/acceptance/js -c test/acceptance/coffee || echo 'No acceptance tests to compile'",
|
||||||
|
"compile:all": "npm run compile:app && npm run compile:unit_tests && npm run compile:acceptance_tests",
|
||||||
|
"nodemon": "nodemon --config nodemon.json"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"async": "0.2.9",
|
"async": "0.2.9",
|
||||||
|
@ -37,6 +45,8 @@
|
||||||
"grunt-nodemon": "~0.1.2",
|
"grunt-nodemon": "~0.1.2",
|
||||||
"grunt-notify": "~0.2.16",
|
"grunt-notify": "~0.2.16",
|
||||||
"grunt-plato": "~0.2.1",
|
"grunt-plato": "~0.2.1",
|
||||||
|
"mocha": "^4.1.0",
|
||||||
|
"nodemon": "^1.14.11",
|
||||||
"sandboxed-module": "",
|
"sandboxed-module": "",
|
||||||
"sinon": "",
|
"sinon": "",
|
||||||
"timekeeper": ""
|
"timekeeper": ""
|
||||||
|
|
Loading…
Reference in a new issue