diff --git a/.github/workflows/develop-build.yml b/.github/workflows/develop-build.yml new file mode 100644 index 0000000..78664d9 --- /dev/null +++ b/.github/workflows/develop-build.yml @@ -0,0 +1,47 @@ +name: Publish Development Build + +permissions: + contents: write + +on: + push: + branches: + - 'develop' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out source code + uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v1 + with: + java-version: 17 + - name: Set up Maven cache + uses: actions/cache@v1 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Build with Maven + run: mvn clean verify -U -P snapshot-build + - name: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y-%m-%d %H:%M:%S %Z')" + - name: Create tag name from date + id: tagdate + run: echo "::set-output name=tagdate::$(date +'%Y-%m-%d_%H-%M-%S_%Z')" + - name: Release + id: create_release + uses: softprops/action-gh-release@v2 + with: + name: ${{ steps.date.outputs.date }} + tag_name: ${{ steps.tagdate.outputs.tagdate }} + generate_release_notes: true + draft: false + prerelease: true + files: | + **/target/*.jar + install/* diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml new file mode 100644 index 0000000..e3a9552 --- /dev/null +++ b/.github/workflows/release-build.yml @@ -0,0 +1,40 @@ +name: Publish Release Build + +permissions: + contents: write + +on: + push: + tags: + - 'v*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out source code + uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v1 + with: + java-version: 17 + - name: Set up Maven cache + uses: actions/cache@v1 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Build with Maven + run: mvn clean verify -U -P release-build + - name: Release + id: create_release + uses: softprops/action-gh-release@v2 + with: + name: Release ${{ github.ref_name }} + generate_release_notes: true + draft: false + prerelease: false + files: | + **/target/*.jar + install/* diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 02719d1..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: Build and upload to release - -on: - push: - branch: - - 'master' - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Check out source code - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 11 - - name: Set up Maven cache - uses: actions/cache@v1 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - - name: Build with Maven - run: mvn package --file plugin/pom.xml -DskipTests - - name: Get current date - id: date - run: echo "::set-output name=date::$(date +'%Y-%m-%d %H:%M:%S %Z')" - - name: Create tag name from date - id: tagdate - run: echo "::set-output name=tagdate::$(date +'%Y-%m-%d_%H-%M-%S_%Z')" - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ steps.tagdate.outputs.tagdate }} - release_name: ${{ steps.date.outputs.date }} - draft: false - prerelease: false - - name: Upload main asset - id: upload-main-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps - asset_path: plugin/module-main/target/plugin_intranda_workflow_hu_importer.jar - asset_name: plugin_intranda_workflow_hu_importer.jar - asset_content_type: application/jar - - name: Upload GUI asset - id: upload-gui-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: plugin/module-gui/target/plugin_intranda_workflow_hu_importer-GUI.jar - asset_name: plugin_intranda_workflow_hu_importer-GUI.jar - asset_content_type: application/jar - - name: Upload Config asset - id: upload-config-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: plugin/plugin_intranda_workflow_hu_importer.xml - asset_name: plugin_intranda_workflow_hu_importer.xml - asset_content_type: text/xml \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9f88813 --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ + +# Junk files +*~ +.DS_Store + +# Build +target/ +bin/ +build/ +node_modules/ + +# Eclipse +.project +.classpath +.settings/ + +# IntelliJ IDEA +.idea +*.iml + diff --git a/Jenkinsfile b/Jenkinsfile index 44df4ed..13cb478 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,9 +1,13 @@ + pipeline { agent { docker { - image 'maven:3-jdk-11' - args '-v $HOME/.m2:/var/maven/.m2:z -u 1000 -ti -e _JAVA_OPTIONS=-Duser.home=/var/maven -e MAVEN_CONFIG=/var/maven/.m2' + /* using a custom build image with a defined home directory for UID 1000 among other things */ + image 'nexus.intranda.com:4443/maven:3.9.3-eclipse-temurin-17' + registryUrl 'https://nexus.intranda.com:4443' + registryCredentialsId 'jenkins-docker' + args '-v $HOME/.m2:/var/maven/.m2:z -v $HOME/.config:/var/maven/.config -v $HOME/.sonar:/var/maven/.sonar -u 1000 -ti -e _JAVA_OPTIONS=-Duser.home=/var/maven -e MAVEN_CONFIG=/var/maven/.m2' } } @@ -11,26 +15,119 @@ pipeline { buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '15', daysToKeepStr: '90', numToKeepStr: '') } - - stages { stage('prepare') { steps { - sh 'git clean -fdx' + sh 'git reset --hard HEAD && git clean -fdx' } } - - stage('build') { + stage('build-snapshot') { + when { + not { + anyOf { + branch 'master' + branch 'release_*' + allOf { + branch 'PR-*' + expression { env.CHANGE_BRANCH.startsWith("release_") } + } + } + } + } + steps { + sh 'mvn clean verify -U -P snapshot-build' + } + } + stage('build-release') { + when { + anyOf { + branch 'master' + branch 'release_*' + allOf { + branch 'PR-*' + expression { env.CHANGE_BRANCH.startsWith("release_") } + } + } + } + steps { + sh 'mvn clean verify -U -P release-build' + } + } + stage('sonarcloud') { + when { + anyOf { + branch 'master' + branch 'release_*' + branch 'sonar_*' + allOf { + branch 'PR-*' + expression { env.CHANGE_BRANCH.startsWith("release_") } + } + } + } steps { - sh 'mvn -f plugin/pom.xml package' - recordIssues enabledForFailure: true, aggregatingResults: true, tools: [java(), javaDoc()] + withCredentials([string(credentialsId: 'jenkins-sonarcloud', variable: 'TOKEN')]) { + sh 'mvn verify sonar:sonar -Dsonar.token=$TOKEN -U' + } + } + } + stage('deploy-libs') { + when { + anyOf { + branch 'master' + branch 'develop' + } + } + steps { + script { + if (fileExists('module-lib/pom.xml')) { + sh 'mvn -N deploy' + sh 'mvn -f module-lib/pom.xml deploy' + } + } + } + } + stage('tag release') { + when { branch 'master' } + steps { + withCredentials([gitUsernamePassword(credentialsId: '93f7e7d3-8f74-4744-a785-518fc4d55314', + gitToolName: 'git-tool')]) { + sh '''#!/bin/bash -xe + projectversion=$(mvn org.apache.maven.plugins:maven-help-plugin:3.4.0:evaluate -Dexpression=project.version -q -DforceStdout) + if [ $? != 0 ] + then + exit 1 + elif [[ "${projectversion}" =~ "SNAPSHOT" ]] + then + echo "This is a SNAPSHOT version" + exit 1 + fi + echo "${projectversion}" + git tag -a "v${projectversion}" -m "releasing v${projectversion}" && git push origin v"${projectversion}" + ''' + } } } } - + post { + always { + junit allowEmptyResults: true, testResults: "**/target/surefire-reports/*.xml" + step([ + $class : 'JacocoPublisher', + execPattern : '**/target/jacoco.exec', + classPattern : '**/target/classes/', + sourcePattern : '**/src/main/java', + exclusionPattern : '**/*Test.class' + ]) + recordIssues ( + enabledForFailure: true, aggregatingResults: false, + tools: [checkStyle(pattern: 'target/checkstyle-result.xml', reportEncoding: 'UTF-8')] + ) + dependencyCheckPublisher pattern: 'target/dependency-check-report.xml' + } success { - archiveArtifacts artifacts: '**/target/*.jar, */plugin_*.xml, plugin_*.xml', fingerprint: true, onlyIfSuccessful: true + archiveArtifacts artifacts: '**/target/*.jar, install/*', fingerprint: true, onlyIfSuccessful: true } changed { emailext( @@ -42,5 +139,3 @@ pipeline { } } } - -/* vim: set ts=2 sw=2 tw=120 et :*/ \ No newline at end of file diff --git a/plugin/build.xml b/build.xml similarity index 100% rename from plugin/build.xml rename to build.xml diff --git a/plugin/plugin_intranda_workflow_hu_importer.xml b/install/plugin_intranda_workflow_hu_importer.xml similarity index 100% rename from plugin/plugin_intranda_workflow_hu_importer.xml rename to install/plugin_intranda_workflow_hu_importer.xml diff --git a/module-base/pom.xml b/module-base/pom.xml new file mode 100644 index 0000000..6ff703b --- /dev/null +++ b/module-base/pom.xml @@ -0,0 +1,10 @@ + + 4.0.0 + + io.goobi.workflow.plugin + plugin-workflow-hu-importer + 24.04.2 + + plugin-workflow-hu-importer-base + jar + \ No newline at end of file diff --git a/plugin/src/main/java/de/intranda/goobi/plugins/DocumentManager.java b/module-base/src/main/java/de/intranda/goobi/plugins/DocumentManager.java similarity index 100% rename from plugin/src/main/java/de/intranda/goobi/plugins/DocumentManager.java rename to module-base/src/main/java/de/intranda/goobi/plugins/DocumentManager.java diff --git a/plugin/src/main/java/de/intranda/goobi/plugins/EadManager.java b/module-base/src/main/java/de/intranda/goobi/plugins/EadManager.java similarity index 100% rename from plugin/src/main/java/de/intranda/goobi/plugins/EadManager.java rename to module-base/src/main/java/de/intranda/goobi/plugins/EadManager.java diff --git a/plugin/src/main/java/de/intranda/goobi/plugins/HuImporterWorkflowPlugin.java b/module-base/src/main/java/de/intranda/goobi/plugins/HuImporterWorkflowPlugin.java similarity index 100% rename from plugin/src/main/java/de/intranda/goobi/plugins/HuImporterWorkflowPlugin.java rename to module-base/src/main/java/de/intranda/goobi/plugins/HuImporterWorkflowPlugin.java diff --git a/plugin/src/main/java/de/intranda/goobi/plugins/ProcessCreationException.java b/module-base/src/main/java/de/intranda/goobi/plugins/ProcessCreationException.java similarity index 100% rename from plugin/src/main/java/de/intranda/goobi/plugins/ProcessCreationException.java rename to module-base/src/main/java/de/intranda/goobi/plugins/ProcessCreationException.java diff --git a/plugin/src/main/java/de/intranda/goobi/plugins/ProcessProperties.java b/module-base/src/main/java/de/intranda/goobi/plugins/ProcessProperties.java similarity index 100% rename from plugin/src/main/java/de/intranda/goobi/plugins/ProcessProperties.java rename to module-base/src/main/java/de/intranda/goobi/plugins/ProcessProperties.java diff --git a/plugin/src/main/java/de/intranda/goobi/plugins/XlsReader.java b/module-base/src/main/java/de/intranda/goobi/plugins/XlsReader.java similarity index 100% rename from plugin/src/main/java/de/intranda/goobi/plugins/XlsReader.java rename to module-base/src/main/java/de/intranda/goobi/plugins/XlsReader.java diff --git a/plugin/src/test/java/de/intranda/goobi/plugins/HuImporterPluginTest.java b/module-base/src/test/java/de/intranda/goobi/plugins/HuImporterPluginTest.java similarity index 100% rename from plugin/src/test/java/de/intranda/goobi/plugins/HuImporterPluginTest.java rename to module-base/src/test/java/de/intranda/goobi/plugins/HuImporterPluginTest.java diff --git a/plugin/src/test/resources/log4j2.xml b/module-base/src/test/resources/resources/log4j2.xml similarity index 100% rename from plugin/src/test/resources/log4j2.xml rename to module-base/src/test/resources/resources/log4j2.xml diff --git a/module-gui/pom.xml b/module-gui/pom.xml new file mode 100644 index 0000000..0717a13 --- /dev/null +++ b/module-gui/pom.xml @@ -0,0 +1,18 @@ + + 4.0.0 + + io.goobi.workflow.plugin + plugin-workflow-hu-importer + 24.04.2 + + plugin-workflow-hu-importer-gui + jar + + + + META-INF/resources + src/main/webapp/resources + + + + \ No newline at end of file diff --git a/module-gui/src/main/webapp/META-INF/faces-config.xml b/module-gui/src/main/webapp/META-INF/faces-config.xml new file mode 100644 index 0000000..0448938 --- /dev/null +++ b/module-gui/src/main/webapp/META-INF/faces-config.xml @@ -0,0 +1,33 @@ + + + + + + + + + org.goobi.production.messages.MyRessourceBundle + msgs + + + diff --git a/plugin/src/main/resources/GUI/META-INF/resources/uii/plugin_workflow_hu_importer.xhtml b/module-gui/src/main/webapp/resources/uii/plugin_workflow_hu_importer.xhtml similarity index 100% rename from plugin/src/main/resources/GUI/META-INF/resources/uii/plugin_workflow_hu_importer.xhtml rename to module-gui/src/main/webapp/resources/uii/plugin_workflow_hu_importer.xhtml diff --git a/plugin/.classpath b/plugin/.classpath deleted file mode 100644 index f9d3200..0000000 --- a/plugin/.classpath +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugin/.gitignore b/plugin/.gitignore deleted file mode 100644 index 07ec78b..0000000 --- a/plugin/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/bin/ -/target/ -.DS_Store \ No newline at end of file diff --git a/plugin/.project b/plugin/.project deleted file mode 100644 index 56b8128..0000000 --- a/plugin/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - goobi-plugin-workflow-hu-importer - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.m2e.core.maven2Nature - org.eclipse.jdt.core.javanature - - diff --git a/plugin/.settings/org.eclipse.jdt.core.prefs b/plugin/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 0fee6a9..0000000 --- a/plugin/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,15 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning -org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/plugin/.settings/org.eclipse.m2e.core.prefs b/plugin/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f..0000000 --- a/plugin/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/plugin/.settings/org.jboss.ide.eclipse.as.core.prefs b/plugin/.settings/org.jboss.ide.eclipse.as.core.prefs deleted file mode 100644 index cf3aa3a..0000000 --- a/plugin/.settings/org.jboss.ide.eclipse.as.core.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -org.jboss.ide.eclipse.as.core.singledeployable.deployableList= diff --git a/plugin/module-gui/.gitignore b/plugin/module-gui/.gitignore deleted file mode 100644 index 7326dd9..0000000 --- a/plugin/module-gui/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/target/ -.DS_Store \ No newline at end of file diff --git a/plugin/module-gui/pom.xml b/plugin/module-gui/pom.xml deleted file mode 100644 index ec92690..0000000 --- a/plugin/module-gui/pom.xml +++ /dev/null @@ -1,72 +0,0 @@ - - 4.0.0 - de.intranda.goobi.plugins.workflow - hu_importer-gui - 24.02 - - plugin_intranda_workflow_hu_importer-GUI - /opt/digiverso/goobi/plugins/GUI/ - - - de.intranda.goobi.plugins.workflow - hu_importer - 24.02 - - - ${jar.name} - - - ../src/main/resources/GUI - - **/*.java - - - - - - org.codehaus.mojo - buildnumber-maven-plugin - 1.4 - - - validate - - create - - - - - 10 - false - - - - org.apache.maven.plugins - maven-jar-plugin - 3.1.0 - - - - ${maven.build.timestamp} - - - - Versions - - ${project.version} - ${buildNumber} - ${scmBranch} - ${goobi.version} - - - - - - - - - - scm:git:ssh://git@gitea.intranda.com:goobi-workflow/goobi-plugin-workflow-hu_importer.git - scm:git:ssh://git@gitea.intranda.com:goobi-workflow/goobi-plugin-workflow-hu_importer.git - - diff --git a/plugin/module-main/.gitignore b/plugin/module-main/.gitignore deleted file mode 100644 index 7326dd9..0000000 --- a/plugin/module-main/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/target/ -.DS_Store \ No newline at end of file diff --git a/plugin/module-main/pom.xml b/plugin/module-main/pom.xml deleted file mode 100644 index d769f4b..0000000 --- a/plugin/module-main/pom.xml +++ /dev/null @@ -1,100 +0,0 @@ - - 4.0.0 - de.intranda.goobi.plugins.workflow - hu_importer-main - 24.02 - - plugin_intranda_workflow_hu_importer - /opt/digiverso/goobi/plugins/workflow/ - - - de.intranda.goobi.plugins.workflow - hu_importer - 24.02 - - - ${jar.name} - ${project.basedir}/../src/main/java - ${project.basedir}/../src/test/java - - - maven-compiler-plugin - 3.7.0 - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.22.1 - - false - - - - pl.project13.maven - git-commit-id-plugin - 2.2.1 - - - - revision - - - - - flat - - true - - - - - org.codehaus.mojo - buildnumber-maven-plugin - 1.4 - - - validate - - create - - - - - 10 - false - - - - org.apache.maven.plugins - maven-jar-plugin - 3.1.0 - - - - ${maven.build.timestamp} - - - - Versions - - ${project.version} - ${buildNumber} - ${scmBranch} - ${goobi.version} - - - - - - - - - - scm:git:ssh://git@gitea.intranda.com:goobi-workflow/goobi-plugin-workflow-hu_importer.git - scm:git:ssh://git@gitea.intranda.com:goobi-workflow/goobi-plugin-workflow-hu_importer.git - - diff --git a/plugin/src/test/resources/.gitignore b/plugin/src/test/resources/.gitignore deleted file mode 100644 index 496ee2c..0000000 --- a/plugin/src/test/resources/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.DS_Store \ No newline at end of file diff --git a/plugin/pom.xml b/pom.xml similarity index 56% rename from plugin/pom.xml rename to pom.xml index c69517a..b2c6503 100644 --- a/plugin/pom.xml +++ b/pom.xml @@ -1,34 +1,30 @@ 4.0.0 - de.intranda.goobi.plugins.workflow - hu_importer - 24.02 + + io.goobi.workflow + workflow-base + 24.04.2 + + + io.goobi.workflow.plugin + plugin-workflow-hu-importer pom - - 24.02 - UTF-8 - - - - intranda-releases - https://nexus.intranda.com/repository/maven-releases - - + + module-base + module-gui + intranda-public https://nexus.intranda.com/repository/maven-public - - module-main - module-gui - - de.intranda.goobi.workflow - goobi-core-jar - ${goobi.version} + io.goobi.workflow + workflow-core + ${project.version} + classes de.intranda.goobi.plugins.administration @@ -52,18 +48,5 @@ archive-management-main 1.1.3 - - org.projectlombok - lombok - 1.18.22 - provided - - - - junit - junit - 4.12 - test - - + \ No newline at end of file