Last active
June 13, 2019 20:29
-
-
Save teyckmans/9a9e614f66b32170870b125db74112f7 to your computer and use it in GitHub Desktop.
GitLab CI file for Gradle build with build/check/publish stages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image: adoptopenjdk/openjdk12:alpine | |
stages: | |
- build | |
- check | |
- publish | |
variables: | |
GRADLE_OPTS: "-Dorg.gradle.daemon=false" | |
before_script: | |
- echo `pwd` | |
- export GRADLE_USER_HOME=`pwd`/.gradle | |
- rm -f .gradle/caches/modules-2/modules-2.lock | |
- rm -fr .gradle/caches/*/plugin-resolution/ | |
cache: | |
untracked: true | |
paths: | |
- .gradle/wrapper | |
- .gradle/caches | |
- "*/build" | |
build: | |
stage: build | |
script: | |
- ./gradlew build -x check | |
artifacts: | |
paths: | |
- "*/build/libs/*.jar" | |
expire_in: 1 week | |
check: | |
stage: check | |
script: | |
- ./gradlew check | |
artifacts: | |
reports: | |
junit: "*/build/test-results/test/TEST-*.xml" | |
expire_in: 1 week | |
bintray upload: | |
stage: publish | |
script: | |
- ./gradlew -Pversion=$CI_COMMIT_TAG bintrayUpload | |
- ls */build/libs/*.jar | |
only: | |
- tags | |
gradle plugin publish: | |
stage: publish | |
script: | |
- ./gradlew publishPlugins -Pversion=$CI_COMMIT_TAG -Pgradle.publish.key=$GRADLE_PUBLISH_KEY -Pgradle.publish.secret=$GRADLE_PUBLISH_SECRET | |
- ls */build/libs/*.jar | |
only: | |
- tags |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment