mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-25 16:55:39 +00:00
Optimize ci
This commit is contained in:
parent
c1b5c0ab81
commit
99ffe18d2b
6 changed files with 153 additions and 57 deletions
140
.gitlab-ci.yml
140
.gitlab-ci.yml
|
|
@ -2,7 +2,7 @@ image: maven:latest
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
BUILD_PROPS: "-Dbuild.revision=$CI_COMMIT_SHA -Dbuild.branch=$CI_COMMIT_REF_NAME -Dbuild.number=$CI_PIPELINE_IID "
|
BUILD_PROPS: "-Dbuild.revision=$CI_COMMIT_SHA -Dbuild.branch=$CI_COMMIT_REF_NAME -Dbuild.number=$CI_PIPELINE_IID "
|
||||||
MAVEN_CLI_OPTS: " --batch-mode -Dmaven.repo.local=repository -Dfile.encoding=UTF-8 -s .settings/settings.xml"
|
MAVEN_CLI_OPTS: " --batch-mode -Dfile.encoding=UTF-8 -s .mvn/settings.xml -Dmaven.repo.local=.mvn/repository -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false"
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- export CI_JOB_TIMESTAMP="-Dbuild.timestamp=$(date --utc --iso-8601=seconds)"
|
- export CI_JOB_TIMESTAMP="-Dbuild.timestamp=$(date --utc --iso-8601=seconds)"
|
||||||
|
|
@ -10,57 +10,11 @@ before_script:
|
||||||
cache:
|
cache:
|
||||||
key: maven
|
key: maven
|
||||||
paths:
|
paths:
|
||||||
- repository
|
- .mvn/repository
|
||||||
|
|
||||||
build-amazoncorretto:
|
|
||||||
stage: build
|
|
||||||
image: maven:amazoncorretto
|
|
||||||
script:
|
|
||||||
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
|
|
||||||
retry: 2
|
|
||||||
artifacts:
|
|
||||||
name: amazoncorretto
|
|
||||||
paths:
|
|
||||||
- target/*.jar
|
|
||||||
reports:
|
|
||||||
junit:
|
|
||||||
- target/surefire-reports/*.xml
|
|
||||||
- target/failsafe-reports/*.xml
|
|
||||||
|
|
||||||
build-java-14:
|
|
||||||
stage: build
|
|
||||||
image: maven:3-jdk-14
|
|
||||||
script:
|
|
||||||
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
|
|
||||||
retry: 2
|
|
||||||
artifacts:
|
|
||||||
when: on_failure
|
|
||||||
name: java-14
|
|
||||||
paths:
|
|
||||||
- target/*
|
|
||||||
reports:
|
|
||||||
junit:
|
|
||||||
- target/surefire-reports/*.xml
|
|
||||||
- target/failsafe-reports/*.xml
|
|
||||||
|
|
||||||
build-java-11-openj9:
|
|
||||||
stage: build
|
|
||||||
image: maven:3-jdk-11-openj9
|
|
||||||
script:
|
|
||||||
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
|
|
||||||
retry: 2
|
|
||||||
artifacts:
|
|
||||||
name: java-11-openj9
|
|
||||||
paths:
|
|
||||||
- target/*.jar
|
|
||||||
reports:
|
|
||||||
junit:
|
|
||||||
- target/surefire-reports/*.xml
|
|
||||||
- target/failsafe-reports/*.xml
|
|
||||||
|
|
||||||
build-java-11:
|
build-java-11:
|
||||||
stage: build
|
stage: build
|
||||||
image: maven:3-jdk-11
|
image: $CI_REGISTRY_IMAGE/maven:3-jdk-11
|
||||||
script:
|
script:
|
||||||
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
|
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
|
||||||
retry: 2
|
retry: 2
|
||||||
|
|
@ -74,9 +28,39 @@ build-java-11:
|
||||||
- target/surefire-reports/*.xml
|
- target/surefire-reports/*.xml
|
||||||
- target/failsafe-reports/*.xml
|
- target/failsafe-reports/*.xml
|
||||||
|
|
||||||
|
build-java-11-openj9:
|
||||||
|
stage: build
|
||||||
|
image: $CI_REGISTRY_IMAGE/maven:3-jdk-11-openj9
|
||||||
|
script:
|
||||||
|
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
|
||||||
|
retry: 2
|
||||||
|
artifacts:
|
||||||
|
name: java-11-openj9
|
||||||
|
paths:
|
||||||
|
- target/*.jar
|
||||||
|
reports:
|
||||||
|
junit:
|
||||||
|
- target/surefire-reports/*.xml
|
||||||
|
- target/failsafe-reports/*.xml
|
||||||
|
|
||||||
|
build-java8:
|
||||||
|
stage: build
|
||||||
|
image: $CI_REGISTRY_IMAGE/maven:3-jdk-8
|
||||||
|
script:
|
||||||
|
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
|
||||||
|
retry: 2
|
||||||
|
artifacts:
|
||||||
|
name: java-8
|
||||||
|
paths:
|
||||||
|
- target/*.jar
|
||||||
|
reports:
|
||||||
|
junit:
|
||||||
|
- target/surefire-reports/*.xml
|
||||||
|
- target/failsafe-reports/*.xml
|
||||||
|
|
||||||
build-java-8-openj9:
|
build-java-8-openj9:
|
||||||
stage: build
|
stage: build
|
||||||
image: maven:3-jdk-8-openj9
|
image: $CI_REGISTRY_IMAGE/maven:3-jdk-8-openj9
|
||||||
script:
|
script:
|
||||||
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
|
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
|
||||||
retry: 2
|
retry: 2
|
||||||
|
|
@ -89,16 +73,49 @@ build-java-8-openj9:
|
||||||
- target/surefire-reports/*.xml
|
- target/surefire-reports/*.xml
|
||||||
- target/failsafe-reports/*.xml
|
- target/failsafe-reports/*.xml
|
||||||
|
|
||||||
build-java8:
|
build-java-15:
|
||||||
stage: build
|
stage: build
|
||||||
image: maven:3-jdk-8-alpine
|
image: $CI_REGISTRY_IMAGE/maven:3-openjdk-15
|
||||||
script:
|
script:
|
||||||
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
|
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
|
||||||
retry: 2
|
retry: 2
|
||||||
artifacts:
|
artifacts:
|
||||||
name: java-8-alpine
|
when: on_failure
|
||||||
|
name: java-15
|
||||||
paths:
|
paths:
|
||||||
- target/*.jar
|
- target/*
|
||||||
|
reports:
|
||||||
|
junit:
|
||||||
|
- target/surefire-reports/*.xml
|
||||||
|
- target/failsafe-reports/*.xml
|
||||||
|
|
||||||
|
build-java-16:
|
||||||
|
stage: build
|
||||||
|
image: $CI_REGISTRY_IMAGE/maven:3-openjdk-16
|
||||||
|
script:
|
||||||
|
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
|
||||||
|
retry: 2
|
||||||
|
artifacts:
|
||||||
|
when: on_failure
|
||||||
|
name: java-16
|
||||||
|
paths:
|
||||||
|
- target/*
|
||||||
|
reports:
|
||||||
|
junit:
|
||||||
|
- target/surefire-reports/*.xml
|
||||||
|
- target/failsafe-reports/*.xml
|
||||||
|
|
||||||
|
build-java-17:
|
||||||
|
stage: build
|
||||||
|
image: $CI_REGISTRY_IMAGE/maven:3-openjdk-17
|
||||||
|
script:
|
||||||
|
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
|
||||||
|
retry: 2
|
||||||
|
artifacts:
|
||||||
|
when: on_failure
|
||||||
|
name: java-17
|
||||||
|
paths:
|
||||||
|
- target/*
|
||||||
reports:
|
reports:
|
||||||
junit:
|
junit:
|
||||||
- target/surefire-reports/*.xml
|
- target/surefire-reports/*.xml
|
||||||
|
|
@ -106,7 +123,7 @@ build-java8:
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
image: maven:3-jdk-11
|
image: $CI_REGISTRY_IMAGE/maven:3-jdk-11
|
||||||
dependencies:
|
dependencies:
|
||||||
- build-java-11
|
- build-java-11
|
||||||
script:
|
script:
|
||||||
|
|
@ -118,3 +135,16 @@ deploy:
|
||||||
- mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validationtool-${PROJECT_VERSION}-java8-standalone.jar -DgroupId=kosit -DartifactId=validator -Dclassifier="java8-standalone" -Dversion=${PROJECT_VERSION} -Dpackaging=jar -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven
|
- mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validationtool-${PROJECT_VERSION}-java8-standalone.jar -DgroupId=kosit -DartifactId=validator -Dclassifier="java8-standalone" -Dversion=${PROJECT_VERSION} -Dpackaging=jar -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven
|
||||||
- mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validationtool-${PROJECT_VERSION}-sources.jar -DgroupId=kosit -DartifactId=validator -Dclassifier="sources" -Dversion=${PROJECT_VERSION} -Dpackaging=jar -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven
|
- mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validationtool-${PROJECT_VERSION}-sources.jar -DgroupId=kosit -DartifactId=validator -Dclassifier="sources" -Dversion=${PROJECT_VERSION} -Dpackaging=jar -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven
|
||||||
when: manual
|
when: manual
|
||||||
|
|
||||||
|
create-build-image:
|
||||||
|
stage: deploy
|
||||||
|
image: docker:latest
|
||||||
|
needs: [ ]
|
||||||
|
services:
|
||||||
|
- docker:dind
|
||||||
|
script:
|
||||||
|
- apk add bash
|
||||||
|
- bash .mvn/createBuildImages.sh
|
||||||
|
when: manual
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
15
.mvn/createBuildImages.sh
Normal file
15
.mvn/createBuildImages.sh
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
TAGS=("3-openjdk-16" "3-jdk-11" "3-jdk-11-openj9" "3-jdk-8" "3-jdk-8-openj9", "3-openjdk-15", "3-openjdk-17")
|
||||||
|
|
||||||
|
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
|
||||||
|
for i in "${TAGS[@]}"
|
||||||
|
do
|
||||||
|
echo Creating build image for "$i"
|
||||||
|
{
|
||||||
|
echo "FROM maven:${i}"
|
||||||
|
} >> Dockerfile
|
||||||
|
docker build -t "$CI_REGISTRY_IMAGE/maven:$i" .
|
||||||
|
docker push "$CI_REGISTRY_IMAGE/maven:${i}"
|
||||||
|
rm Dockerfile
|
||||||
|
done
|
||||||
1
.mvn/jvm.config
Normal file
1
.mvn/jvm.config
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
-Xms128m -Xmx512m
|
||||||
47
.mvn/settings.xml
Normal file
47
.mvn/settings.xml
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
<!--
|
||||||
|
~ Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT)
|
||||||
|
~
|
||||||
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
~ you may not use this file except in compliance with the License.
|
||||||
|
~ You may obtain a copy of the License at
|
||||||
|
~
|
||||||
|
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
~
|
||||||
|
~ Unless required by applicable law or agreed to in writing, software
|
||||||
|
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
~ See the License for the specific language governing permissions and
|
||||||
|
~ limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
|
||||||
|
<!--
|
||||||
|
~ Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT)
|
||||||
|
~
|
||||||
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
~ you may not use this file except in compliance with the License.
|
||||||
|
~ You may obtain a copy of the License at
|
||||||
|
~
|
||||||
|
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
~
|
||||||
|
~ Unless required by applicable law or agreed to in writing, software
|
||||||
|
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
~ See the License for the specific language governing permissions and
|
||||||
|
~ limitations under the License.
|
||||||
|
-->
|
||||||
|
<servers>
|
||||||
|
<server>
|
||||||
|
<id>gitlab-maven</id>
|
||||||
|
<configuration>
|
||||||
|
<httpHeaders>
|
||||||
|
<property>
|
||||||
|
<name>Job-Token</name>
|
||||||
|
<value>${env.CI_JOB_TOKEN}</value>
|
||||||
|
</property>
|
||||||
|
</httpHeaders>
|
||||||
|
</configuration>
|
||||||
|
</server>
|
||||||
|
</servers>
|
||||||
|
</settings>
|
||||||
1
pom.xml
1
pom.xml
|
|
@ -463,6 +463,7 @@
|
||||||
<arguments>
|
<arguments>
|
||||||
<!--suppress MavenModelInspection -->
|
<!--suppress MavenModelInspection -->
|
||||||
<argument>${jacocoFailsafe}</argument>
|
<argument>${jacocoFailsafe}</argument>
|
||||||
|
<argument>-Xmx256m</argument>
|
||||||
<argument>-classpath</argument>
|
<argument>-classpath</argument>
|
||||||
<classpath />
|
<classpath />
|
||||||
<argument>de.kosit.validationtool.cmd.CommandLineApplication</argument>
|
<argument>de.kosit.validationtool.cmd.CommandLineApplication</argument>
|
||||||
|
|
|
||||||
|
|
@ -45,10 +45,12 @@ public class BaseResolverConfigurationTest {
|
||||||
private class TestResolvingStrategy extends StrictRelativeResolvingStrategy {
|
private class TestResolvingStrategy extends StrictRelativeResolvingStrategy {
|
||||||
|
|
||||||
void setInternalProperty(final SchemaFactory factory, final boolean lenient) {
|
void setInternalProperty(final SchemaFactory factory, final boolean lenient) {
|
||||||
allowExternalSchema(factory, lenient, "quatsch");
|
allowExternalSchema(factory, lenient, NOT_EXISTING_SCHEME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String NOT_EXISTING_SCHEME = "not-existing-scheme";
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
public ExpectedException expectedException = ExpectedException.none();
|
public ExpectedException expectedException = ExpectedException.none();
|
||||||
|
|
||||||
|
|
@ -75,7 +77,7 @@ public class BaseResolverConfigurationTest {
|
||||||
final TestResolvingStrategy s = new TestResolvingStrategy();
|
final TestResolvingStrategy s = new TestResolvingStrategy();
|
||||||
s.setInternalProperty(sf, true);
|
s.setInternalProperty(sf, true);
|
||||||
s.setInternalProperty(sf, false);
|
s.setInternalProperty(sf, false);
|
||||||
verify(sf, times(2)).setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "quatsch");
|
verify(sf, times(2)).setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, BaseResolverConfigurationTest.NOT_EXISTING_SCHEME);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue