WebStudio/Jenkinsfile

81 lines
2 KiB
Text
Raw Normal View History

2020-03-23 13:15:27 +00:00
pipeline {
agent {
node {
label 'node'
}
}
stages {
2020-03-26 09:46:41 +00:00
stage('Install dependencies') {
2020-04-07 10:19:28 +00:00
parallel {
stage('JavaScript') {
steps {
sh 'CI=true npm_config_python=/usr/local/bin/python2.7 yarn --no-progress --non-interactive --skip-integrity-check --frozen-lockfile install'
}
}
stage('Python') {
steps {
sh '/usr/local/bin/python3.7 -m venv env'
sh 'source env/bin/activate'
sh 'pip install -r requirements.txt'
}
}
2020-03-23 13:15:27 +00:00
}
}
2020-04-07 10:19:28 +00:00
stage('Type checks') {
parallel {
stage('TypeScript') {
steps {
sh 'node_modules/.bin/tsc -p tsconfig.json --noEmit --extendedDiagnostics'
}
}
stage('MyPy') {
steps {
sh 'mypy server.py'
}
}
}
}
2020-03-26 09:46:41 +00:00
stage('Build and deploy to dev instance') {
2020-03-23 13:15:27 +00:00
steps {
2020-03-26 09:46:41 +00:00
sh 'sed -i -e \'s/ury.org.uk\\/webstudio/ury.org.uk\\/webstudio-dev/\' package.json'
sh 'yarn build'
2020-03-23 13:15:27 +00:00
sshagent(credentials: ['ury']) {
2020-03-26 09:46:41 +00:00
sh 'rsync -av --delete-after build/ deploy@ury:/usr/local/www/webstudio-dev'
2020-03-23 13:15:27 +00:00
}
}
}
2020-04-07 10:19:28 +00:00
2020-03-26 09:46:41 +00:00
stage('Build and deploy for production') {
when {
branch 'production'
}
2020-03-31 18:43:38 +00:00
parallel {
stage('Deploy prod client') {
environment {
REACT_APP_MYRADIO_NONAPI_BASE = 'https://ury.org.uk/myradio'
REACT_APP_MYRADIO_BASE = 'https://ury.org.uk/api/v2'
2020-04-07 09:37:14 +00:00
REACT_APP_WS_URL = 'wss://audio.ury.org.uk/webstudio/stream'
2020-03-31 18:43:38 +00:00
}
steps {
sh 'sed -i -e \'s/ury.org.uk\\/webstudio-dev/ury.org.uk\\/webstudio/\' package.json'
sh 'yarn build'
sshagent(credentials: ['ury']) {
sh 'rsync -av --delete-after build/ deploy@ury:/usr/local/www/webstudio'
}
}
}
stage('Deploy server') {
steps {
sshagent(credentials: ['ury']) {
2020-03-31 18:49:37 +00:00
sh 'scp -v -o StrictHostKeyChecking=no server.py liquidsoap@dolby.ury:/opt/webstudioserver/server.py'
2020-03-31 18:43:38 +00:00
}
}
2020-03-26 09:46:41 +00:00
}
}
}
2020-03-23 13:15:27 +00:00
}
}