provs/.gitlab-ci.yml

125 lines
4.1 KiB
YAML
Raw Normal View History

2021-02-14 09:12:50 +00:00
image: openjdk:11-jdk-slim
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
before_script:
- echo "---------- Start CI ----------"
- export GRADLE_USER_HOME=`pwd`/.gradle
- chmod +x gradlew
2023-06-18 14:34:54 +00:00
- echo "------ commit info ---------------"
- echo $CI_COMMIT_TAG
2021-12-04 10:25:16 +00:00
- echo $CI_COMMIT_REF_NAME
2023-06-18 14:34:54 +00:00
- echo "----------------------------------"
2021-02-10 19:24:43 +00:00
2021-11-24 18:18:46 +00:00
cache:
paths:
- .gradle/wrapper
- .gradle/caches
2021-02-10 19:24:43 +00:00
build:
stage: build
script:
- echo "---------- build stage ----------"
2021-11-24 18:18:46 +00:00
- ./gradlew assemble
2021-02-10 19:24:43 +00:00
artifacts:
paths:
- build/libs/*.jar
expire_in: 1 week
2021-12-04 10:25:16 +00:00
test:
2021-02-10 19:24:43 +00:00
stage: test
2021-02-25 18:57:06 +00:00
image: docker:latest
2021-02-10 19:24:43 +00:00
services:
- docker:dind
dependencies:
- build
2021-02-25 18:57:06 +00:00
before_script:
- echo "---------- BEFORE -------------"
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
2021-02-10 19:24:43 +00:00
script:
2021-02-25 18:57:06 +00:00
- echo "---------- TEST -------------"
- apk update && apk add bash openjdk11
- 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:
- build/reports/tests/test
reports:
junit: build/test-results/test/TEST-*.xml
2021-02-10 19:24:43 +00:00
2022-03-25 15:58:29 +00:00
uberjar:
2022-02-01 07:52:33 +00:00
stage: package
rules:
- if: $CI_PIPELINE_SOURCE != "push"
when: never
- if: $CI_COMMIT_TAG =~ /^release-[0-9]+[.][0-9]+([.][0-9]+)?$/
script:
2022-02-01 08:17:07 +00:00
- ./gradlew -x assemble -x test -x jar uberjarDesktop
- ./gradlew -x assemble -x test -x jar uberjarServer
- ./gradlew -x assemble -x test -x jar uberjarSyspec
2022-02-01 07:52:33 +00:00
- cd build/libs/
- find . -type f -exec sha256sum {} \; | sort > sha256sum.lst
- find . -type f -exec sha512sum {} \; | sort > sha512sum.lst
artifacts:
paths:
- 'build/libs/provs-desktop.jar'
- 'build/libs/provs-server.jar'
- 'build/libs/provs-syspec.jar'
2022-02-01 07:52:33 +00:00
- 'build/libs/sha256sum.lst'
- 'build/libs/sha512sum.lst'
expire_in: never
2023-06-18 14:34:54 +00:00
publish-maven-package:
2022-02-01 17:47:54 +00:00
stage: publish
rules:
- if: $CI_PIPELINE_SOURCE != "push"
when: never
2022-03-25 20:25:00 +00:00
- if: $CI_COMMIT_TAG !~ /^release-[0-9]+[.][0-9]+([.][0-9]+)?$/
2022-02-01 17:47:54 +00:00
script:
- ./gradlew -x assemble -x test jar
2023-06-13 16:49:48 +00:00
- ./gradlew -x assemble -x test publishLibraryPublicationToMeissaRepository
2022-02-01 17:47:54 +00:00
artifacts:
paths:
- build/libs/*.jar
2021-11-24 18:18:46 +00:00
release:
2022-02-01 07:52:33 +00:00
image: registry.gitlab.com/gitlab-org/release-cli:latest
2023-06-18 12:35:11 +00:00
stage: release
2021-11-24 18:18:46 +00:00
rules:
- if: $CI_PIPELINE_SOURCE != "push"
when: never
2022-02-01 07:52:33 +00:00
- if: $CI_COMMIT_TAG =~ /^release-[0-9]+[.][0-9]+([.][0-9]+)?$/
artifacts:
paths:
- 'build/libs/provs-desktop.jar'
- 'build/libs/provs-server.jar'
- 'build/libs/provs-syspec.jar'
2022-02-01 07:52:33 +00:00
- 'build/libs/sha256sum.lst'
- 'build/libs/sha512sum.lst'
2021-11-24 18:18:46 +00:00
script:
2023-06-18 13:18:12 +00:00
- apk --no-cache add curl
2023-06-18 11:09:33 +00:00
# release to repo.meissa
2023-06-18 12:35:11 +00:00
- chmod +x ./release/create-release-in-repo.sh && sh ./release/create-release-in-repo.sh
2023-06-18 11:09:33 +00:00
# release to gitlab
2022-02-01 07:52:33 +00:00
- |
release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \
--assets-link "{\"name\":\"provs-desktop.jar\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/provs/-/jobs/${CI_JOB_ID}/artifacts/file/build/libs/provs-desktop.jar\"}" \
--assets-link "{\"name\":\"provs-server.jar\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/provs/-/jobs/${CI_JOB_ID}/artifacts/file/build/libs/provs-server.jar\"}" \
--assets-link "{\"name\":\"provs-syspec.jar\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/provs/-/jobs/${CI_JOB_ID}/artifacts/file/build/libs/provs-syspec.jar\"}" \
2022-02-01 07:52:33 +00:00
--assets-link "{\"name\":\"sha256sum.lst\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/provs/-/jobs/${CI_JOB_ID}/artifacts/file/build/libs/sha256sum.lst\"}" \
--assets-link "{\"name\":\"sha512sum.lst\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/provs/-/jobs/${CI_JOB_ID}/artifacts/file/build/libs/sha512sum.lst\"}" \
2021-11-24 18:18:46 +00:00
2021-02-10 19:24:43 +00:00
after_script:
2021-02-25 18:57:06 +00:00
- echo "---------- End CI ----------"