build in ci
This commit is contained in:
parent
db6fc13092
commit
0872a7fd3f
1 changed files with 101 additions and 159 deletions
260
.gitlab-ci.yml
260
.gitlab-ci.yml
|
@ -1,46 +1,26 @@
|
||||||
stages:
|
stages:
|
||||||
# - build_and_test
|
- build
|
||||||
# - build_native_image
|
# - test
|
||||||
- test
|
|
||||||
# - package
|
# - package
|
||||||
# - security
|
# - publish
|
||||||
# - upload
|
# - release
|
||||||
# - image
|
|
||||||
# - integrationtest
|
|
||||||
|
|
||||||
.img: &img
|
.kotlin-job: &kotlin
|
||||||
image: "domaindrivenarchitecture/ddadevops-dind:4.12.1"
|
image: domaindrivenarchitecture/ddadevops-kotlin:4.10.7
|
||||||
services:
|
cache:
|
||||||
- docker:dind
|
key: ${CI_COMMIT_REF_SLUG}
|
||||||
|
paths:
|
||||||
|
- .gradle/wrapper
|
||||||
|
- .gradle/caches
|
||||||
before_script:
|
before_script:
|
||||||
- export RELEASE_ARTIFACT_TOKEN=$MEISSA_REPO_BUERO_RW
|
- echo "---------- Start CI ----------"
|
||||||
- export IMAGE_DOCKERHUB_USER=$DOCKERHUB_USER
|
- export GRADLE_USER_HOME=`pwd`/.gradle
|
||||||
- export IMAGE_DOCKERHUB_PASSWORD=$DOCKERHUB_PASSWORD
|
- chmod +x gradlew
|
||||||
- export IMAGE_TAG=$CI_COMMIT_TAG
|
- export RELEASE_ARTIFACT_TOKEN=$MEISSA_REPO_BUERO_RW
|
||||||
|
- echo "------ commit info ---------------"
|
||||||
#.cljs-job: &cljs
|
- echo $CI_COMMIT_TAG
|
||||||
# image: "domaindrivenarchitecture/ddadevops-clj-cljs:4.12.1"
|
- echo $CI_COMMIT_REF_NAME
|
||||||
# cache:
|
- echo "----------------------------------"
|
||||||
# key: ${CI_COMMIT_REF_SLUG}
|
|
||||||
# paths:
|
|
||||||
# - node_modules/
|
|
||||||
# - .shadow-cljs/
|
|
||||||
# - .m2
|
|
||||||
# before_script:
|
|
||||||
# - export RELEASE_ARTIFACT_TOKEN=$MEISSA_REPO_BUERO_RW
|
|
||||||
# - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
|
|
||||||
# - npm install
|
|
||||||
|
|
||||||
#.clj-job: &clj
|
|
||||||
# image: "domaindrivenarchitecture/ddadevops-clj:4.12.1"
|
|
||||||
# cache:
|
|
||||||
# key: ${CI_COMMIT_REF_SLUG}
|
|
||||||
# paths:
|
|
||||||
# - .m2
|
|
||||||
# before_script:
|
|
||||||
# - export RELEASE_ARTIFACT_TOKEN=$MEISSA_REPO_BUERO_RW
|
|
||||||
# - mkdir -p /root/.lein
|
|
||||||
# - echo "{:auth {:repository-auth {#\"clojars\" {:username \"${CLOJARS_USER}\" :password \"${CLOJARS_TOKEN_DOMAINDRIVENARCHITECTURE}\" }}}}" > ~/.lein/profiles.clj
|
|
||||||
|
|
||||||
.tag_only: &tag_only
|
.tag_only: &tag_only
|
||||||
rules:
|
rules:
|
||||||
|
@ -48,130 +28,92 @@ stages:
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/'
|
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/'
|
||||||
|
|
||||||
#build-image:
|
|
||||||
# <<: *img
|
build:
|
||||||
# <<: *tag_only
|
<<: *kotlin
|
||||||
# stage: build
|
stage: build
|
||||||
# script:
|
script:
|
||||||
# - pyb image
|
- graalvm_jdk_version="22.0.1"
|
||||||
|
- curl -SsLo /tmp/graalvm-community-jdk.tar.gz https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-${graalvm_jdk_version}/graalvm-community-jdk-${graalvm_jdk_version}_linux-x64_bin.tar.gz
|
||||||
|
- curl -SsLo /tmp/graalvm-checksum https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-${graalvm_jdk_version}/graalvm-community-jdk-${graalvm_jdk_version}_linux-x64_bin.tar.gz.sha256
|
||||||
|
- echo " /tmp/graalvm-jdk-${graalvm_JDK_version}_linux-x64_bin.tar.gz"|tee -a /tmp/graalvm-jdk-${graalvm_JDK_version}_linux-x64_bin.tar.gz.sha256
|
||||||
|
- sha256sum -c --status /tmp/graalvm-jdk-${graalvm_JDK_version}_linux-x64_bin.tar.gz.sha256
|
||||||
|
- mkdir /usr/lib/jvm/
|
||||||
|
- tar -C /usr/lib/jvm/ -xzf /tmp/graalvm-jdk-${graalvm_JDK_version}_linux-x64_bin.tar.gz
|
||||||
|
- dirname_graalvm=$(ls /usr/lib/jvm/|grep -e graa)
|
||||||
|
- ln -s /usr/lib/jvm/$dirname_graalvm /usr/lib/jvm/graalvm
|
||||||
|
- export JAVA_HOME=/usr/lib/jvm/graalvm
|
||||||
|
- ./gradlew clean build -Pvaadin.productionMode
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- build/libs/*.jar
|
||||||
|
expire_in: 1 week
|
||||||
|
|
||||||
|
|
||||||
|
variables:
|
||||||
|
DOCKER_TLS_CERTDIR: "/certs"
|
||||||
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
#image: "domaindrivenarchitecture/ddadevops-python:latest"
|
|
||||||
<<: *img
|
|
||||||
#<<: *tag_only
|
|
||||||
stage: test
|
stage: test
|
||||||
needs: []
|
image: docker:latest
|
||||||
|
services:
|
||||||
|
- docker:dind
|
||||||
|
dependencies:
|
||||||
|
- build
|
||||||
|
before_script:
|
||||||
|
- echo "---------- BEFORE -------------"
|
||||||
|
- echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY --username $CI_REGISTRY_USER --password-stdin
|
||||||
script:
|
script:
|
||||||
- apk -U upgrade
|
- echo "---------- TEST -------------"
|
||||||
- apk add --no-cache python3 py3-pip openjdk17-jdk
|
- apk -U update && apk add bash
|
||||||
- pip3 install --break-system-packages pybuilder ddadevops
|
- docker build --pull -t "$CI_REGISTRY_IMAGE" .
|
||||||
- ./gradlew clean build -Pvaadin.productionMode
|
- docker run --privileged -dit --name meapp_test -v /var/run/docker.sock:/var/run/docker.sock $CI_REGISTRY_IMAGE
|
||||||
- pyb test
|
- docker inspect -f '{{.State.Running}}' meapp_test
|
||||||
|
- ./gradlew -x assemble test -Dtestdockerwithoutsudo=true -DexcludeTags=extensivecontainertest,nonci
|
||||||
|
artifacts:
|
||||||
|
when: on_failure
|
||||||
|
paths:
|
||||||
|
- build/reports/*
|
||||||
|
reports:
|
||||||
|
junit: build/test-results/test/TEST-*.xml
|
||||||
|
|
||||||
|
|
||||||
|
package:
|
||||||
|
<<: *kotlin
|
||||||
|
stage: package
|
||||||
|
script:
|
||||||
|
- pyb package
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- build/libs/*.jar
|
||||||
|
- build/libs/*.lst
|
||||||
|
|
||||||
|
|
||||||
|
publish-maven-package-to-gitlab:
|
||||||
|
<<: *kotlin
|
||||||
|
<<: *tag_only
|
||||||
|
stage: publish
|
||||||
|
script:
|
||||||
|
- ./gradlew -x assemble -x test publishLibraryPublicationToGitlabRepository
|
||||||
|
|
||||||
|
|
||||||
|
publish-maven-package-to-meissa:
|
||||||
|
<<: *kotlin
|
||||||
|
<<: *tag_only
|
||||||
|
stage: publish
|
||||||
|
allow_failure: true
|
||||||
|
script:
|
||||||
|
- ./gradlew -x assemble -x test publishLibraryPublicationToMeissaRepository
|
||||||
|
|
||||||
|
|
||||||
|
release-to-meissa:
|
||||||
|
<<: *kotlin
|
||||||
|
<<: *tag_only
|
||||||
|
stage: release
|
||||||
|
allow_failure: true
|
||||||
|
script:
|
||||||
|
- pyb publish_release
|
||||||
|
|
||||||
after_script:
|
after_script:
|
||||||
- echo "---------- End CI ----------"
|
- echo "---------- End CI ----------"
|
||||||
|
|
||||||
#test-clj:
|
|
||||||
# <<: *clj
|
|
||||||
# stage: build_and_test
|
|
||||||
# script:
|
|
||||||
# - pyb test_clj
|
|
||||||
|
|
||||||
#test-cljs:
|
|
||||||
# <<: *cljs
|
|
||||||
# stage: build_and_test
|
|
||||||
# script:
|
|
||||||
# - pyb test_cljs
|
|
||||||
|
|
||||||
#test-schema:
|
|
||||||
# <<: *clj
|
|
||||||
# stage: build_and_test
|
|
||||||
# script:
|
|
||||||
# - pyb test_schema
|
|
||||||
# artifacts:
|
|
||||||
# paths:
|
|
||||||
# - target/uberjar
|
|
||||||
|
|
||||||
#report-frontend:
|
|
||||||
# <<: *cljs
|
|
||||||
# stage: package
|
|
||||||
# script:
|
|
||||||
# - pyb report_frontend
|
|
||||||
# artifacts:
|
|
||||||
# paths:
|
|
||||||
# - target/frontend-build/build-report.html
|
|
||||||
|
|
||||||
#package-frontend:
|
|
||||||
# <<: *cljs
|
|
||||||
# stage: package
|
|
||||||
# script:
|
|
||||||
# - pyb package_frontend
|
|
||||||
# artifacts:
|
|
||||||
# paths:
|
|
||||||
# - target/frontend-build
|
|
||||||
|
|
||||||
#package-uberjar:
|
|
||||||
# <<: *clj
|
|
||||||
# stage: package
|
|
||||||
# script:
|
|
||||||
# - pyb package_uberjar
|
|
||||||
# artifacts:
|
|
||||||
# paths:
|
|
||||||
# - target/uberjar
|
|
||||||
|
|
||||||
#package-native:
|
|
||||||
# <<: *clj
|
|
||||||
# stage: package
|
|
||||||
# script:
|
|
||||||
# - pyb package_native
|
|
||||||
# artifacts:
|
|
||||||
# paths:
|
|
||||||
# - target/graalvm
|
|
||||||
|
|
||||||
#release-to-clojars:
|
|
||||||
# <<: *clj
|
|
||||||
# <<: *tag_only
|
|
||||||
# stage: upload
|
|
||||||
# script:
|
|
||||||
# - pyb upload_clj
|
|
||||||
|
|
||||||
#release-to-forgejo:
|
|
||||||
# <<: *clj
|
|
||||||
# <<: *tag_only
|
|
||||||
# stage: upload
|
|
||||||
# script:
|
|
||||||
# - pyb publish_artifacts
|
|
||||||
|
|
||||||
#backup-image-publish:
|
|
||||||
# <<: *img
|
|
||||||
# <<: *tag_only
|
|
||||||
# stage: image
|
|
||||||
# script:
|
|
||||||
# - cd infrastructure/backup && pyb image publish
|
|
||||||
|
|
||||||
#nextcloud-image-publish:
|
|
||||||
# <<: *img
|
|
||||||
# <<: *tag_only
|
|
||||||
# stage: image
|
|
||||||
# script:
|
|
||||||
# - cd infrastructure/nextcloud && pyb image publish
|
|
||||||
|
|
||||||
#.nextcloud-integrationtest:
|
|
||||||
# stage: integrationtest
|
|
||||||
# image: registry.gitlab.com/gitlab-org/cluster-integration/helm-install-image/releases/3.7.1-kube-1.20.11-alpine-3.14
|
|
||||||
# services:
|
|
||||||
# - name: registry.gitlab.com/gitlab-org/cluster-integration/test-utils/k3s-gitlab-ci/releases/v1.22.2-k3s2
|
|
||||||
# alias: k3s
|
|
||||||
# script:
|
|
||||||
# - apk add curl sudo bash
|
|
||||||
# - apk add wget curl bash sudo openjdk8
|
|
||||||
# - wget -P /etc/apk/keys/ https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
|
|
||||||
# - apk add --no-cache --repository=https://apkproxy.herokuapp.com/sgerrand/alpine-pkg-leiningen leiningen
|
|
||||||
#
|
|
||||||
# - mkdir -p ${HOME}/.kube/
|
|
||||||
# - curl -f k3s:8081 > ${HOME}/.kube/config
|
|
||||||
# - kubectl version
|
|
||||||
# - kubectl cluster-info
|
|
||||||
# - echo "---------- Integration test -------------"
|
|
||||||
# - pwd
|
|
||||||
# - cd ./src/test/resources/local-integration-test/ && ./setup-local-s3-on-k3d.sh
|
|
Loading…
Reference in a new issue