Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Added functional tests to submodule projects

Michal Rutka5e80a1521c32
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f4fe43783..dfb53aaec 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -135,7 +135,7 @@ build-keycloak-postgresql-proxy:
retry:
max: 2
-.email_template: &email_definition
+.email_template: &notify_email
image: docker:latest
before_script:
- cat $AWS_MAIL > aws_mail.py
@@ -231,7 +231,7 @@ build-keycloak-postgresql-proxy:
# This step is executed when build fails. The purpose is to e-mail a git commiter about the problem.
email failed build:
stage: build_fail
- <<: *email_definition
+ <<: *notify_email
rules:
- if: $CI_COMMIT_MESSAGE !~ /skip-build/
when: on_failure
@@ -263,7 +263,7 @@ test-master:
paths:
- "test/build/reports/tests/test/*"
- "test/build/reports/tests/test/*/*"
- expire_in: 2 weeks
+ expire_in: 4 weeks
retry:
max: 2
@@ -306,7 +306,7 @@ email failed tests:
stage: tests_fail
before_script:
- export STAGE='tests'
- <<: *email_definition
+ <<: *notify_email
rules:
- if: $CI_COMMIT_MESSAGE !~ /skip-test/
when: on_failure
diff --git a/gitlab-ci/gitlab-ci-submodule.yml b/gitlab-ci/gitlab-ci-submodule.yml
index a4a4c1560..94416067d 100644
--- a/gitlab-ci/gitlab-ci-submodule.yml
+++ b/gitlab-ci/gitlab-ci-submodule.yml
@@ -22,6 +22,7 @@ stages:
- build_staging
- build_fail
- test
+ - tests_fail
- deploy
- notify_deploy_staging_fail
- dast
@@ -106,9 +107,7 @@ build manually staging docker images:
environment: staging
<<: *build_definition
-# This step is executed when build fails. The purpose is to e-mail a git commiter about the problem.
-email failed pipeline:
- stage: build_fail
+.email_template: &notify_email
image: docker:latest
# Do not clone git repo as it can fail and sending mail'll fail too
variables:
@@ -123,6 +122,7 @@ email failed pipeline:
- export REPO=$(docker run --rm -v $(pwd):/or registry.gitlab.com/openremote/openremote:master git remote get-url origin|xargs basename)
- echo $REPO
- docker run -v $(pwd):/usr/src/myapp -w /usr/src/myapp
+ -e "STAGE=$CI_JOB_STAGE"
-e "WHO=$WHO"
-e "WHAT=$WHAT"
-e "WHEN=$WHEN"
@@ -130,6 +130,13 @@ email failed pipeline:
-e "SMTP_USERNAME=$SMTP_USERNAME"
-e "SMTP_PASSWORD=$SMTP_PASSWORD"
--rm python:3 python aws_mail.py
+ retry:
+ max: 2
+
+# This step is executed when build fails. The purpose is to e-mail a git commiter about the problem.
+email failed pipeline:
+ stage: build_fail
+ <<: *notify_email
when: on_failure
build FAILED:
@@ -137,6 +144,44 @@ build FAILED:
<<: *notify_whatsapp
when: on_failure
+test-master:
+ stage: test
+ before_script:
+ - docker run -v $(pwd):/or
+ -v /var/run/docker.sock:/var/run/docker.sock "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
+ /bin/sh -c "docker-compose -f profile/dev-testing.yml pull"
+ - docker run -v $(pwd):/or
+ -v /var/run/docker.sock:/var/run/docker.sock "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
+ /bin/sh -c "docker-compose -f profile/dev-testing.yml up --no-build -d"
+ script:
+ - docker run --network host -v $(pwd):/or "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
+ /bin/sh -c "./gradlew clean test"
+ rules:
+ - if: $CI_COMMIT_MESSAGE !~ /skip-test/
+ when: on_success
+ artifacts:
+ when: on_failure
+ paths:
+ - "test/build/reports/tests/test/*"
+ - "test/build/reports/tests/test/*/*"
+ expire_in: 4 weeks
+ retry:
+ max: 2
+
+email failed tests:
+ stage: tests_fail
+ <<: *notify_email
+ rules:
+ - if: $CI_COMMIT_MESSAGE !~ /skip-test/
+ when: on_failure
+
+test FAILED:
+ stage: tests_fail
+ <<: *notify_whatsapp
+ rules:
+ - if: $CI_COMMIT_MESSAGE !~ /skip-test/
+ when: on_failure
+
include:
- template: Container-Scanning.gitlab-ci.yml
- template: Dependency-Scanning.gitlab-ci.yml