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:
|
||||
# - build_and_test
|
||||
# - build_native_image
|
||||
- test
|
||||
- build
|
||||
# - test
|
||||
# - package
|
||||
# - security
|
||||
# - upload
|
||||
# - image
|
||||
# - integrationtest
|
||||
# - publish
|
||||
# - release
|
||||
|
||||
.img: &img
|
||||
image: "domaindrivenarchitecture/ddadevops-dind:4.12.1"
|
||||
services:
|
||||
- docker:dind
|
||||
.kotlin-job: &kotlin
|
||||
image: domaindrivenarchitecture/ddadevops-kotlin:4.10.7
|
||||
cache:
|
||||
key: ${CI_COMMIT_REF_SLUG}
|
||||
paths:
|
||||
- .gradle/wrapper
|
||||
- .gradle/caches
|
||||
before_script:
|
||||
- export RELEASE_ARTIFACT_TOKEN=$MEISSA_REPO_BUERO_RW
|
||||
- export IMAGE_DOCKERHUB_USER=$DOCKERHUB_USER
|
||||
- export IMAGE_DOCKERHUB_PASSWORD=$DOCKERHUB_PASSWORD
|
||||
- export IMAGE_TAG=$CI_COMMIT_TAG
|
||||
|
||||
#.cljs-job: &cljs
|
||||
# image: "domaindrivenarchitecture/ddadevops-clj-cljs:4.12.1"
|
||||
# cache:
|
||||
# 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
|
||||
- echo "---------- Start CI ----------"
|
||||
- export GRADLE_USER_HOME=`pwd`/.gradle
|
||||
- chmod +x gradlew
|
||||
- export RELEASE_ARTIFACT_TOKEN=$MEISSA_REPO_BUERO_RW
|
||||
- echo "------ commit info ---------------"
|
||||
- echo $CI_COMMIT_TAG
|
||||
- echo $CI_COMMIT_REF_NAME
|
||||
- echo "----------------------------------"
|
||||
|
||||
.tag_only: &tag_only
|
||||
rules:
|
||||
|
@ -48,130 +28,92 @@ stages:
|
|||
when: never
|
||||
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/'
|
||||
|
||||
#build-image:
|
||||
# <<: *img
|
||||
# <<: *tag_only
|
||||
# stage: build
|
||||
# script:
|
||||
# - pyb image
|
||||
|
||||
build:
|
||||
<<: *kotlin
|
||||
stage: build
|
||||
script:
|
||||
- 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:
|
||||
#image: "domaindrivenarchitecture/ddadevops-python:latest"
|
||||
<<: *img
|
||||
#<<: *tag_only
|
||||
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:
|
||||
- apk -U upgrade
|
||||
- apk add --no-cache python3 py3-pip openjdk17-jdk
|
||||
- pip3 install --break-system-packages pybuilder ddadevops
|
||||
- ./gradlew clean build -Pvaadin.productionMode
|
||||
- pyb test
|
||||
- echo "---------- TEST -------------"
|
||||
- apk -U update && apk add bash
|
||||
- docker build --pull -t "$CI_REGISTRY_IMAGE" .
|
||||
- docker run --privileged -dit --name meapp_test -v /var/run/docker.sock:/var/run/docker.sock $CI_REGISTRY_IMAGE
|
||||
- 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:
|
||||
- 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