Commit 9382bb74 authored by Adrien's avatar Adrien Committed by Romain Bioteau

release.groovy

parents 2fb634c3 e0dbe9f5
......@@ -12,8 +12,13 @@
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="bin/test" path="src/test/kotlin">
<attributes>
<attribute name="gradle_scope" value="test"/>
<attribute name="gradle_used_by_scope" value="test"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="con" path="org.jetbrains.kotlin.core.KOTLIN_CONTAINER"/>
<classpathentry kind="output" path="bin/default"/>
</classpath>
......@@ -2,3 +2,5 @@
/.gradle/
/bin
/build
/.idea
*.iml
\ No newline at end of file
#!/usr/bin/env groovy
node {
checkout scm
stage('🔧 Build') {
try {
sh './gradlew clean build'
} finally {
junit '**/build/test-results/**/*.xml'
archiveArtifacts '**/build/libs/*.jar'
}
}
}
# bonita-codesign-windows
\ No newline at end of file
formatter.gradle.enabled=false
\ No newline at end of file
......@@ -3,21 +3,29 @@ buildscript {
ext.spring_boot_version = '2.0.1.RELEASE'
repositories {
jcenter()
maven { url 'http://repositories.rd.lan/maven/all/' }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // Required for Kotlin integration
classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlin_version" // See https://kotlinlang.org/docs/reference/compiler-plugins.html#kotlin-spring-compiler-plugin
classpath "org.springframework.boot:spring-boot-gradle-plugin:$spring_boot_version"
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.0'
classpath "org.junit.platform:junit-platform-gradle-plugin:1.0.0"
}
}
plugins {
id 'com.bonitasoft.gradle.bonita-base-plugin' version '0.1.15'
}
apply plugin: "kotlin" // Required for Kotlin integration
apply plugin: "kotlin-spring" // See https://kotlinlang.org/docs/reference/compiler-plugins.html#kotlin-spring-compiler-plugin
apply plugin: "org.springframework.boot"
apply plugin: 'org.junit.platform.gradle.plugin'
apply plugin: 'maven-publish'
group = 'org.bonitasoft.releng'
version = '1.0.0-SNAPSHOT'
junitPlatform {
filters {
......@@ -33,7 +41,10 @@ jar {
repositories {
jcenter()
maven { url "http://dl.bintray.com/jetbrains/spek" }
maven { url 'http://repositories.rd.lan/maven/all/' }
maven {
url 'http://repository.jetbrains.com/all'
}
}
dependencies {
......@@ -41,7 +52,28 @@ dependencies {
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
compile "org.springframework.boot:spring-boot-starter-web:$spring_boot_version"
testCompile("org.springframework.boot:spring-boot-starter-test:$spring_boot_version")
testCompile 'org.jetbrains.spek:spek-api:1.1.5'
testRuntime 'org.jetbrains.spek:spek-junit-platform-engine:1.1.5'
}
\ No newline at end of file
compile "org.springframework.boot:spring-boot-starter-test:$spring_boot_version"
testCompile 'org.jetbrains.spek:spek-api:1.1.5'
testCompile 'org.jetbrains.spek:spek-junit-platform-engine:1.1.5'
testCompile 'org.junit.platform:junit-platform-runner:1.0.0'
testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
}
publishing {
repositories {
maven {
name 'bonitaInternal'
if (project.version.endsWith('-SNAPSHOT')) {
url 'http://repositories.rd.lan/maven/snapshots/'
} else {
url 'http://repositories.rd.lan/maven/releases/'
}
}
}
publications {
maven(MavenPublication) {
from components.java
}
}
}
This diff is collapsed.
org.eclipse.jdt.core.formatter.tabulation.char=space
org.eclipse.jdt.core.formatter.tabulation.size=4
groovy.formatter.remove.unnecessary.semicolons=true
groovy.formatter.longListLength=120
\ No newline at end of file
node {
stage('Checkout') {
checkout scm
}
stage('Release') {
withCredentials([usernamePassword(
credentialsId: 'github',
passwordVariable: 'GIT_PASSWORD',
usernameVariable: 'GIT_USERNAME')]) {
sh "./gradlew release " +
"-Prelease.customUsername=${GIT_USERNAME} -Prelease.customPassword=${GIT_PASSWORD}"
}
}
stage('Publish') {
sh "./gradlew clean build publish"
}
}
\ No newline at end of file
pluginManagement {
repositories {
// workaround for code deposit
// search plugins in local maven repository
// To be changed to `mavenLocal()` when switching to gradle 4.4
// See https://github.com/gradle/gradle/issues/3169
if (System.getenv('M2_REPO')) {
maven { url System.getenv('M2_REPO') }
}
maven { url 'http://repositories.rd.lan/maven/all/' }
gradlePluginPortal()
}
}
\ No newline at end of file
package org.bonitasoft.releng
import org.jetbrains.spek.api.Spek
import org.jetbrains.spek.api.dsl.*
import org.junit.runner.RunWith
import org.junit.platform.runner.JUnitPlatform
import org.springframework.web.multipart.MultipartFile
import org.mockito.Mockito
import org.springframework.mock.web.MockHttpServletResponse
import org.bonitasoft.releng.CodeSigneRestController
import kotlin.test.assertEquals
@RunWith(JUnitPlatform::class)
class CodeSignRestControllerTest : Spek({
given("a controller and an empty file") {
val controller: CodeSigneRestController = CodeSigneRestController()
val response = MockHttpServletResponse()
val file: MultipartFile = Mockito.mock(MultipartFile::class.java)
Mockito.`when`(file.isEmpty).thenReturn(true)
Mockito.`when`(file.originalFilename).thenReturn("fileName")
on("sending file to controller") {
controller.singleFileUpload(file, response)
it("should set a code 400 on the response") {
assertEquals(response.status, 400)
}
}
}
})
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment