mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-10-26 08:06:09 +01:00
Update timestamps of test report if running on ci
We have to update the timestamps of our test reports on the ci server, because Jenkins fails it the reports are older than x minutes.
This commit is contained in:
committed by
René Pfeuffer
parent
22375c8096
commit
4e1bf1d13b
4
Jenkinsfile
vendored
4
Jenkinsfile
vendored
@@ -75,8 +75,8 @@ pipeline {
|
||||
sh "./gradlew integrationTest"
|
||||
script {
|
||||
withSonarQubeEnv('sonarcloud.io-scm') {
|
||||
String sonar = "sonarqube -Dsonar.organization=scm-manager -Dsonar.branch.name=${script.env.BRANCH_NAME}"
|
||||
if (script.env.BRANCH_NAME != "master") {
|
||||
String sonar = "sonarqube -Dsonar.organization=scm-manager -Dsonar.branch.name=${env.BRANCH_NAME}"
|
||||
if (env.BRANCH_NAME != "master") {
|
||||
sonar += " -Dsonar.branch.target=master"
|
||||
}
|
||||
// disable until we know how todo sonar analysis with subprojects
|
||||
|
||||
@@ -70,6 +70,10 @@ gradlePlugin {
|
||||
id = 'org.scm-manager.packaging'
|
||||
implementationClass = 'com.cloudogu.scm.PackagingPlugin'
|
||||
}
|
||||
ci {
|
||||
id = 'org.scm-manager.ci'
|
||||
implementationClass = 'com.cloudogu.scm.CIPlugin'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.cloudogu.scm
|
||||
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
|
||||
class CIPlugin implements Plugin<Project> {
|
||||
@Override
|
||||
void apply(Project project) {
|
||||
project.ext.TouchFiles = TouchFilesTask
|
||||
}
|
||||
}
|
||||
@@ -65,6 +65,15 @@ class JavaModulePlugin implements Plugin<Project> {
|
||||
xml.enabled true
|
||||
}
|
||||
}
|
||||
|
||||
project.tasks.register("update-test-timestamp", TouchFilesTask) {
|
||||
directory = new File(project.buildDir, "test-results")
|
||||
extension = "xml"
|
||||
}
|
||||
|
||||
project.tasks.getByName("test").configure {
|
||||
dependsOn "update-test-timestamp"
|
||||
}
|
||||
}
|
||||
|
||||
project.test {
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.cloudogu.scm
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.InputDirectory
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
|
||||
import java.time.Instant
|
||||
|
||||
class TouchFilesTask extends DefaultTask {
|
||||
|
||||
@InputDirectory
|
||||
File directory
|
||||
|
||||
@Input
|
||||
String extension
|
||||
|
||||
@Input
|
||||
long timestamp
|
||||
|
||||
TouchFilesTask() {
|
||||
timestamp = Instant.now().toEpochMilli()
|
||||
// this task should run always
|
||||
outputs.upToDateWhen {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
public void execute() {
|
||||
if (directory.exists()) {
|
||||
touch(directory)
|
||||
}
|
||||
}
|
||||
|
||||
private void touch(File file) {
|
||||
if (file.isDirectory()) {
|
||||
for (File child : file.listFiles()) {
|
||||
touch(child)
|
||||
}
|
||||
} else if (file.getName().endsWith(".${extension}")) {
|
||||
file.setLastModified(timestamp)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
plugins {
|
||||
id 'java-library'
|
||||
id 'org.scm-manager.ci'
|
||||
id 'org.scm-manager.java'
|
||||
id 'org.scm-manager.core-plugins'
|
||||
id 'org.scm-manager.integration-tests'
|
||||
@@ -90,12 +91,23 @@ node {
|
||||
}
|
||||
|
||||
task e2eTests(type: YarnTask) {
|
||||
inputs.files(fileTree(project.project(":scm-ui").projectDir) {
|
||||
include 'e2e-*/**'
|
||||
include 'ui-*/**'
|
||||
})
|
||||
outputs.dir(project.project(":scm-ui").file('build/reports/e2e'))
|
||||
|
||||
args = ['run', 'e2e-tests']
|
||||
ignoreExitValue = project.isCI
|
||||
mustRunAfter 'startScmServer'
|
||||
dependsOn 'yarn_install', 'startScmServer'
|
||||
}
|
||||
|
||||
task updateE2eTestTimestamps(type: TouchFiles) {
|
||||
directory = project.project(":scm-ui").file('build/reports/e2e')
|
||||
extension = "xml"
|
||||
}
|
||||
|
||||
task integrationTest {
|
||||
dependsOn(javaIntegrationTests, e2eTests)
|
||||
finalizedBy 'stopScmServer'
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
|
||||
plugins {
|
||||
id 'org.scm-manager.smp' version '0.7.0'
|
||||
id 'org.scm-manager.smp' version '0.7.1'
|
||||
}
|
||||
|
||||
def jgitVersion = '5.6.1.202002131546-r-scm1'
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
|
||||
plugins {
|
||||
id 'org.scm-manager.smp' version '0.7.0'
|
||||
id 'org.scm-manager.smp' version '0.7.1'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
|
||||
plugins {
|
||||
id 'org.scm-manager.smp' version '0.7.0'
|
||||
id 'org.scm-manager.smp' version '0.7.1'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
|
||||
plugins {
|
||||
id 'org.scm-manager.smp' version '0.7.0'
|
||||
id 'org.scm-manager.smp' version '0.7.1'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
|
||||
plugins {
|
||||
id 'org.scm-manager.smp' version '0.7.0'
|
||||
id 'org.scm-manager.smp' version '0.7.1'
|
||||
}
|
||||
|
||||
def svnkitVersion = '1.10.1-scm2'
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
plugins {
|
||||
id 'com.github.node-gradle.node' version '2.2.4'
|
||||
id 'com.github.hierynomus.license-base' version '0.15.0'
|
||||
id 'org.scm-manager.ci'
|
||||
}
|
||||
|
||||
node {
|
||||
@@ -66,9 +67,19 @@ task test(type: YarnTask) {
|
||||
})
|
||||
.withPathSensitivity(PathSensitivity.RELATIVE)
|
||||
outputs.dir('build/jest-reports')
|
||||
|
||||
if (project.isCI) {
|
||||
ignoreExitValue = project.isCI
|
||||
dependsOn('yarn_install', 'updateUiTestTimestamps')
|
||||
} else {
|
||||
dependsOn('yarn_install')
|
||||
}
|
||||
}
|
||||
|
||||
task updateUiTestTimestamps(type: TouchFiles) {
|
||||
directory = project.file('build/jest-reports')
|
||||
extension = "xml"
|
||||
}
|
||||
|
||||
task check {
|
||||
dependsOn('typecheck', 'test')
|
||||
|
||||
Reference in New Issue
Block a user