provs/.gitlab-ci.yml

111 lines
2.4 KiB
YAML
Raw Normal View History

2021-02-10 19:24:43 +00:00
stages:
- build
- test
2022-02-01 07:52:33 +00:00
- package
2021-02-10 19:24:43 +00:00
- publish
2023-06-18 12:35:11 +00:00
- release
2021-02-10 19:24:43 +00:00
2023-08-08 07:18:10 +00:00
.kotlin-job: &kotlin
image: domaindrivenarchitecture/ddadevops-kotlin:4.10.7
2023-08-08 07:18:10 +00:00
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .gradle/wrapper
- .gradle/caches
2023-08-08 07:20:41 +00:00
before_script:
- echo "---------- Start CI ----------"
- export GRADLE_USER_HOME=`pwd`/.gradle
- chmod +x gradlew
2023-12-15 09:38:52 +00:00
- export RELEASE_ARTIFACT_TOKEN=$MEISSA_REPO_BUERO_RW
2023-08-08 07:20:41 +00:00
- echo "------ commit info ---------------"
- echo $CI_COMMIT_TAG
- echo $CI_COMMIT_REF_NAME
- echo "----------------------------------"
2023-08-08 07:18:10 +00:00
.tag_only: &tag_only
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/'
2021-11-24 18:18:46 +00:00
2023-06-30 11:56:31 +00:00
2021-02-10 19:24:43 +00:00
build:
2023-08-08 07:18:10 +00:00
<<: *kotlin
2021-02-10 19:24:43 +00:00
stage: build
script:
2023-08-08 07:43:28 +00:00
- pyb build
2021-02-10 19:24:43 +00:00
artifacts:
paths:
- build/libs/*.jar
expire_in: 1 week
2023-06-30 11:56:31 +00:00
2023-12-15 08:54:52 +00:00
variables:
DOCKER_TLS_CERTDIR: "/certs"
2023-11-25 16:49:36 +00:00
test:
2021-02-10 19:24:43 +00:00
stage: test
2023-12-15 09:25:15 +00:00
image: docker:24.0.5
2021-02-10 19:24:43 +00:00
services:
2023-12-15 09:25:15 +00:00
- docker:24.0.5-dind
2021-02-10 19:24:43 +00:00
dependencies:
- build
2021-02-25 18:57:06 +00:00
before_script:
- echo "---------- BEFORE -------------"
2023-12-15 09:07:45 +00:00
- echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY --username $CI_REGISTRY_USER --password-stdin
2021-02-10 19:24:43 +00:00
script:
2021-02-25 18:57:06 +00:00
- echo "---------- TEST -------------"
2023-11-15 17:28:31 +00:00
- apk update && apk add bash openjdk11 git
2021-02-25 18:57:06 +00:00
- export JAVA_HOME=/usr/lib/jvm/java-11-openjdk
- docker build --pull -t "$CI_REGISTRY_IMAGE" .
- docker run --privileged -dit --name provs_test -v /var/run/docker.sock:/var/run/docker.sock $CI_REGISTRY_IMAGE
- docker inspect -f '{{.State.Running}}' provs_test
2023-02-23 21:39:34 +00:00
- ./gradlew -x assemble test -Dtestdockerwithoutsudo=true -DexcludeTags=extensivecontainertest,nonci
2021-02-25 18:57:06 +00:00
artifacts:
when: on_failure
paths:
2023-12-15 08:42:16 +00:00
- build/reports/*
2021-02-25 18:57:06 +00:00
reports:
junit: build/test-results/test/TEST-*.xml
2021-02-10 19:24:43 +00:00
2023-06-18 14:34:54 +00:00
2023-06-30 11:56:31 +00:00
package:
2023-08-08 07:18:10 +00:00
<<: *kotlin
2023-06-30 11:56:31 +00:00
stage: package
2022-02-01 17:47:54 +00:00
script:
- pyb package
2022-02-01 17:47:54 +00:00
artifacts:
paths:
- build/libs/*.jar
2023-06-30 12:39:32 +00:00
- build/libs/*.lst
2022-02-01 17:47:54 +00:00
2021-11-24 18:18:46 +00:00
2023-06-30 11:56:31 +00:00
publish-maven-package-to-gitlab:
2023-08-08 07:18:10 +00:00
<<: *kotlin
<<: *tag_only
2023-06-30 11:56:31 +00:00
stage: publish
script:
- ./gradlew -x assemble -x test publishLibraryPublicationToGitlabRepository
publish-maven-package-to-meissa:
2023-08-08 07:18:10 +00:00
<<: *kotlin
<<: *tag_only
2023-06-30 11:56:31 +00:00
stage: publish
allow_failure: true
script:
- ./gradlew -x assemble -x test publishLibraryPublicationToMeissaRepository
2023-06-30 12:30:01 +00:00
release-to-meissa:
2023-08-08 07:18:10 +00:00
<<: *kotlin
<<: *tag_only
2023-06-18 12:35:11 +00:00
stage: release
2023-06-30 12:30:01 +00:00
allow_failure: true
2021-11-24 18:18:46 +00:00
script:
- pyb publish_release
2023-06-18 19:56:47 +00:00
2021-02-10 19:24:43 +00:00
after_script:
2021-02-25 18:57:06 +00:00
- echo "---------- End CI ----------"