Skip to content

Commit

Permalink
chore(build): Adding basic build via gradle, travis and jenkins
Browse files Browse the repository at this point in the history
  • Loading branch information
hypery2k committed Jan 25, 2018
1 parent 2629c1c commit 18474f3
Show file tree
Hide file tree
Showing 12 changed files with 687 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.idea/
.gradle/
build/
*.iml
out/
*~
20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
language: java

sudo: false

jdk:
- oraclejdk8

before_install:
- "export DISPLAY=:99.0"
- "export PATH=`pwd`/bin:$PATH"
- "sh -e /etc/init.d/xvfb start"

install:
- ./gradlew clean checkstyleMain checkstyleTest

before_script:
- ./gradlew clean build

script:
- ./gradlew test
46 changes: 46 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
properties properties: [
[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '30', numToKeepStr: '10']],
disableConcurrentBuilds()
]

@Library('holisticon-build-library')
def build = new de.holisticon.ci.jenkins.Build()

node {
def buildNumber = env.BUILD_NUMBER
def branchName = env.BRANCH_NAME
def workspace = env.WORKSPACE
def buildUrl = env.BUILD_URL

// PRINT ENVIRONMENT TO JOB
echo "workspace directory is $workspace"
echo "build URL is $buildUrl"
echo "build Number is $buildNumber"
echo "branch name is $branchName"
echo "PATH is $env.PATH"

try {
stage('Checkout') {
deleteDir()
checkout scm
}

stage('Build') {
sh "./gradlew clean checkstyleMain checkstyleTest build"
}

stage('Test') {
sh "./gradlew test"
//junit 'target/test-reports/TEST*.xml'
}

stage('Deploy') {
// TODO
}

} catch (e) {
rocketSend channel: 'holi-oss', emoji: ':rotating_light:', message: 'Fehler nach folgenden Änderungen: ' + build.summarizeBuild(currentBuild)
throw e
}

}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# jenkins-pipeline-plugin

[![Build Status](https://travis-ci.org/toolisticon/jenkinsfile-idea-plugin.svg?branch=master)](https://travis-ci.org/toolisticon/jenkinsfile-idea-plugin)
[![Build Status](https://jenkins.holisticon.de/job/Public/job/jenkinsfile-idea-plugin/job/master/badge/icon)](https://jenkins.holisticon.de/blue/organizations/jenkins/Public%2Fjenkinsfile-idea-plugin/branches/)

An IntelliJ plugin to add support for "Jenkinsfile" pipeline definitions
127 changes: 127 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
buildscript {
repositories {
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
}
}

plugins {
id 'net.researchgate.release' version '2.6.0'
id "org.jetbrains.intellij" version "0.2.17" apply false
}

repositories {
mavenCentral()
}

apply plugin: 'java'
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
tasks.withType(JavaCompile) { options.encoding = 'UTF-8' }
group = 'de.holisticon.jenkinsfile'

task jarSources(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
assemble.dependsOn jarSources


apply plugin: 'org.jetbrains.intellij'
intellij {
type = ideaEdition
version = ideaVersion
updateSinceUntilBuild = false
downloadSources = true
intellijRepo = intellijRepoUrl
}

dependencies {
compile 'joda-time:joda-time:2.9.2'

testCompile('com.google.truth:truth:0.36') {
exclude group: 'com.google.guava', module: 'guava'
}
testCompile('com.google.truth.extensions:truth-java8-extension:0.36') {
exclude group: 'com.google.guava', module: 'guava'
}
testCompile 'junit:junit:4.+'
testCompile 'org.mockito:mockito-core:2.+'
}

apply plugin: 'jacoco'
jacocoTestReport {
reports {
xml.enabled true
}
}

apply plugin: 'checkstyle'
configurations {
checkstyleConfig
}
def versions = [
checkstyle: '6.17',
]
dependencies {
checkstyleConfig("com.puppycrawl.tools:checkstyle:${versions.checkstyle}") {
transitive = false
}
checkstyle "com.puppycrawl.tools:checkstyle:${versions.checkstyle}"
}


checkstyle {
configFile = rootProject.file('etc/checkstyle.xml.xml')
showViolations true
sourceSets = [project.sourceSets.main]
}

// The checkstyle plugin does not provide a way to fail the build on warnings, and
// the google_checks.xml sets the severity level to "warning" for all violations. The
// following is the workaround.
tasks.withType(Checkstyle).each { checkstyleTask ->
checkstyleTask.doLast {
reports.all { report ->
if (report.name == "xml") {
def outputFile = report.destination
if (outputFile.exists() && outputFile.text.contains("<error ")) {
throw new GradleException("There were checkstyle warnings! For more info check $outputFile")
}
}
}
}
}

test {
testLogging {
showStandardStreams = true
}
systemProperties(System.getProperties())
maxParallelForks = 8
}



release {
buildTasks = ['doRelease']
// Do not change the tagTemplate value to double quotes or the version will be evaluated before
// the SNAPSHOT version is updated to the release version.
tagTemplate = 'v$version'
git {
requireBranch = /^release_v\d+.*$/
}
}

// We aren't building or doing anything interesting for release.
// We just update the version and generate the tag as CI will handle deployment.
task doRelease {
doLast {
println '===============================!!PLEASE READ!!=================================\n\n' +
'IMPORTANT: The release command will trigger the creation of a new release ' +
'in Github, the uploading of binaries to github, and the publishing of our plugin' +
'to the IntelliJ plugin repository.\n' +
'Hit CTRL+C to cancel.\n'
}
}
Loading

0 comments on commit 18474f3

Please sign in to comment.