Skip to content
Snippets Groups Projects
Verified Commit 1505a7af authored by Ruben Backx's avatar Ruben Backx :coffee:
Browse files

Add staging deploy

parent 1a2e8de6
Branches
No related tags found
2 merge requests!12Deploy,!8Finalise basic functionality for Q2
Pipeline #964050 failed
image: gradle:jdk17
stages:
- build
- test
- publish
- deploy
#variables:
# # Disable the Gradle daemon to ensure isolated runs of the CI pipeline.
# GRADLE_OPTS: "-Dorg.gradle.daemon=false"
build:
image: gradle:jdk17
gradle_build:
stage: build
cache:
policy: pull-push
......@@ -26,7 +29,6 @@ build:
# allow_failure: true
spotless:
image: gradle:jdk17
artifacts:
name: spotless
expose_as: Spotless
......@@ -43,10 +45,9 @@ spotless:
test:
image: gradle:jdk17
stage: test
needs:
- build
- gradle_build
cache:
policy: pull-push
coverage: '/Code coverage: \d+\.\d+/'
......@@ -73,3 +74,47 @@ test:
# Print test coverage from report
- awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, " instructions covered"; print "Code coverage:", 100*covered/instructions }' build/reports/jacoco/test/jacocoTestReport.csv || true
- cp -r build/reports codecov
publish_jar:
stage: publish
rules:
- if: $CI_COMMIT_BRANCH == "master" ||
$CI_COMMIT_BRANCH == "development" ||
$CI_MERGE_REQUEST_ID ||
$CI_PIPELINE_SOURCE == "push" ||
$CI_PIPELINE_SOURCE == "trigger"
needs:
- gradle_build
artifacts:
name: gitbull
expose_as: GitBull JAR
expire_in: 7 days
paths:
- gitbull.jar
script:
- cp build/libs/gitbull-*.jar ./gitbull.jar
deploy_staging:
image: getsentry/sentry-cli
stage: deploy
dependencies:
- publish_jar
before_script:
- 'which ssh-agent || ( apk add --update openssh-client )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY_STAGING" | base64 -d | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan eiptest.ewi.tudelft.nl >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
script:
- scp gitbull.jar deployer-gitbull@eiptest.ewi.tudelft.nl:/var/www/gitbull/
- ssh deployer-gitbull@eiptest.ewi.tudelft.nl sudo /bin/systemctl restart gitbull
environment:
name: staging
url: https://gitbull.eiptest.ewi.tudelft.nl
rules:
- if: $CI_PIPELINE_SOURCE == "trigger" ||
$CI_MERGE_REQUEST_EVENT_TYPE == "merge_train"
when: never
- if: $CI_COMMIT_BRANCH == "development"
......@@ -269,6 +269,10 @@ tasks.jacocoTestReport {
}
}
// we don't use the "plain"/light jar
tasks.getByName<Jar>("jar") {
enabled = false
}
/*
pitest {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment