mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-25 16:55:39 +00:00
Merge branch 'optimize_ci' into 'master'
Optimize ci See merge request kosit/validator!40
This commit is contained in:
commit
27f0f5e1f4
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:
|
||||
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:
|
||||
- export CI_JOB_TIMESTAMP="-Dbuild.timestamp=$(date --utc --iso-8601=seconds)"
|
||||
|
|
@ -10,57 +10,11 @@ before_script:
|
|||
cache:
|
||||
key: maven
|
||||
paths:
|
||||
- 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
|
||||
- .mvn/repository
|
||||
|
||||
build-java-11:
|
||||
stage: build
|
||||
image: maven:3-jdk-11
|
||||
image: $CI_REGISTRY_IMAGE/maven:3-jdk-11
|
||||
script:
|
||||
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
|
||||
retry: 2
|
||||
|
|
@ -74,9 +28,39 @@ build-java-11:
|
|||
- target/surefire-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:
|
||||
stage: build
|
||||
image: maven:3-jdk-8-openj9
|
||||
image: $CI_REGISTRY_IMAGE/maven:3-jdk-8-openj9
|
||||
script:
|
||||
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
|
||||
retry: 2
|
||||
|
|
@ -89,16 +73,49 @@ build-java-8-openj9:
|
|||
- target/surefire-reports/*.xml
|
||||
- target/failsafe-reports/*.xml
|
||||
|
||||
build-java8:
|
||||
build-java-15:
|
||||
stage: build
|
||||
image: maven:3-jdk-8-alpine
|
||||
image: $CI_REGISTRY_IMAGE/maven:3-openjdk-15
|
||||
script:
|
||||
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
|
||||
retry: 2
|
||||
artifacts:
|
||||
name: java-8-alpine
|
||||
when: on_failure
|
||||
name: java-15
|
||||
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:
|
||||
junit:
|
||||
- target/surefire-reports/*.xml
|
||||
|
|
@ -106,7 +123,7 @@ build-java8:
|
|||
|
||||
deploy:
|
||||
stage: deploy
|
||||
image: maven:3-jdk-11
|
||||
image: $CI_REGISTRY_IMAGE/maven:3-jdk-11
|
||||
dependencies:
|
||||
- build-java-11
|
||||
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}-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
|
||||
|
||||
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>
|
||||
<!--suppress MavenModelInspection -->
|
||||
<argument>${jacocoFailsafe}</argument>
|
||||
<argument>-Xmx256m</argument>
|
||||
<argument>-classpath</argument>
|
||||
<classpath />
|
||||
<argument>de.kosit.validationtool.cmd.CommandLineApplication</argument>
|
||||
|
|
|
|||
|
|
@ -45,10 +45,12 @@ public class BaseResolverConfigurationTest {
|
|||
private class TestResolvingStrategy extends StrictRelativeResolvingStrategy {
|
||||
|
||||
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
|
||||
public ExpectedException expectedException = ExpectedException.none();
|
||||
|
||||
|
|
@ -75,7 +77,7 @@ public class BaseResolverConfigurationTest {
|
|||
final TestResolvingStrategy s = new TestResolvingStrategy();
|
||||
s.setInternalProperty(sf, true);
|
||||
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