speedup ci & fix release task

This commit is contained in:
jem 2022-02-01 09:17:07 +01:00
parent f2aebb5117
commit 58b5506574

View file

@ -5,7 +5,6 @@ stages:
- test - test
- package - package
- publish - publish
- release
before_script: before_script:
- echo "---------- Start CI ----------" - echo "---------- Start CI ----------"
@ -32,8 +31,6 @@ build:
test: test:
stage: test stage: test
rules:
- if: $CI_COMMIT_TAG == null # don't run for git tags
image: docker:latest image: docker:latest
services: services:
- docker:dind - docker:dind
@ -49,7 +46,7 @@ test:
- docker build --pull -t "$CI_REGISTRY_IMAGE" . - 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 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 - docker inspect -f '{{.State.Running}}' provs_test
- ./gradlew test -Dtestdockerwithoutsudo=true -DexcludeTags=containertest - ./gradlew -x assemble test -Dtestdockerwithoutsudo=true -DexcludeTags=containertest
artifacts: artifacts:
when: on_failure when: on_failure
paths: paths:
@ -58,13 +55,11 @@ test:
junit: build/test-results/test/TEST-*.xml junit: build/test-results/test/TEST-*.xml
publish: publish-snapshot:
stage: publish stage: publish
rules:
- if: $CI_COMMIT_TAG == null # don't run for git tags
script: script:
- ./gradlew jar - ./gradlew -x assemble -x test jar
- ./gradlew publish - ./gradlew -x assemble -x test publish
artifacts: artifacts:
paths: paths:
- build/libs/*.jar - build/libs/*.jar
@ -105,8 +100,8 @@ uberjarjar:
when: never when: never
- if: $CI_COMMIT_TAG =~ /^release-[0-9]+[.][0-9]+([.][0-9]+)?$/ - if: $CI_COMMIT_TAG =~ /^release-[0-9]+[.][0-9]+([.][0-9]+)?$/
script: script:
- ./gradlew uberjarServer - ./gradlew -x assemble -x test -x jar uberjarServer
- ./gradlew uberjarDesktop - ./gradlew -x assemble -x test -x jar uberjarDesktop
- cd build/libs/ - cd build/libs/
- find . -type f -exec sha256sum {} \; | sort > sha256sum.lst - find . -type f -exec sha256sum {} \; | sort > sha256sum.lst
- find . -type f -exec sha512sum {} \; | sort > sha512sum.lst - find . -type f -exec sha512sum {} \; | sort > sha512sum.lst
@ -121,7 +116,7 @@ uberjarjar:
release: release:
image: registry.gitlab.com/gitlab-org/release-cli:latest image: registry.gitlab.com/gitlab-org/release-cli:latest
stage: release stage: publish
rules: rules:
- if: $CI_PIPELINE_SOURCE != "push" - if: $CI_PIPELINE_SOURCE != "push"
when: never when: never
@ -138,7 +133,6 @@ release:
release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \ 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-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-server.jar\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/provs/-/jobs/${CI_JOB_ID}/artifacts/file/build/libs/provs-server.jar\"}" \
--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\":\"sha256sum.lst\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/provs/-/jobs/${CI_JOB_ID}/artifacts/file/build/libs/sha256sum.lst\"}" \ --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\"}" \ --assets-link "{\"name\":\"sha512sum.lst\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/provs/-/jobs/${CI_JOB_ID}/artifacts/file/build/libs/sha512sum.lst\"}" \