ClearBowl/Jenkinsfile

35 lines
1.9 KiB
Groovy

node {
cleanWs()
stage('Checkout') {
checkout([$class: 'GitSCM', branches: [[name: '*/master']], browser: [$class: 'GogsGit', repoUrl: 'https://git.wmi.amu.edu.pl/s416138/ClearBowl.git'], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'target']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'jenkins_git.wmi.amu.edu.pl', url: 'git@git.wmi.amu.edu.pl:s416138/ClearBowl.git']]])
}
dir('target/api'){
docker.image('mysql:latest').withRun('-e "MYSQL_ROOT_PASSWORD=8fcXUlCgC6JCqpoWX64" -e "MYSQL_DATABASE=clearbowl" -e "MYSQL_USER=api" -e "MYSQL_PASSWORD=R23qarINlcALOk2nDg6LbJelaqk"') { c ->
docker.image('mysql:latest').inside("--link ${c.id}:db") {
stage("API: Initialize DB"){
sh 'while ! mysqladmin ping -hdb --silent; do sleep 1; done'
}
}
docker.image('circleci/php:7.4').inside("--user 0:0 --link ${c.id}:db") {
stage("API: Prepare container") { sh 'docker-php-ext-install -j$(nproc) pdo_mysql' }
stage("API: Build") { sh 'composer install && mv .env.example .env' }
stage("API: Test") { sh 'vendor/bin/phpunit' }
}
}
}
dir('target/front'){
stage("Frontend: Build") {
docker.image('circleci/node:10').inside{
withEnv(['HOME=.']) { sh 'npm install && npm run build' }
}
}
}
dir('target/selenium'){
docker.image('joyzoursky/python-chromedriver:3.7-selenium').inside{
stage("Frontend: Test Selenium") {
sh 'python3 test.py'
}
}
}
}