Skip to content
Snippets Groups Projects
Commit ec17cfe7 authored by jurgenhaas's avatar jurgenhaas
Browse files

Add support for local DB file for testing during build pipeline

parent 8fa1d5b4
Branches
No related tags found
No related merge requests found
......@@ -37,6 +37,9 @@ Import DB:
Import DB NG:
extends: '.importdbNG'
Import Local DB:
extends: '.importdbLocal'
Update DB:
extends: '.updatedb'
......
......@@ -4,8 +4,10 @@ variables:
DISABLE_CI_TEST_BACKSTOP: 1
DISABLE_CI_TEST_BEHAT: 0
DISABLE_CI_TEST_CODESTYLE: 0
DISABLE_CI_TEST_CYPRESSE2E: 1
DISABLE_CI_TEST_INVENTORY: 1
DISABLE_CI_TEST_PHPUNIT: 0
DISABLE_CONFIG_IMPORT: 0
DISABLE_DEPLOYMENT: 0
DISABLE_DEPLOYMENT_LOCAL: 1
DISABLE_GITLAB_CI_TESTS: 0
......@@ -23,6 +25,7 @@ variables:
LAKEDROPS_CI_REF: main
LAKEDROPS_CI_FILE: disabled.yml
LAKEDROPS_DEBUG: 0
LOCALDBFILE: none
NAMESPACES_CHECK_UPDATE: drupal/* bitegra/* lakedrops/*
PHP_MAJOR_VERSION: 7
PHP_MINOR_VERSION: 4
......
......@@ -119,6 +119,23 @@ Debug:
key: build-prod-ng-${COMPOSE_PROJECT_NAME}
<<: *cache_paths
.import_db_default: &import_db_default
stage: prepare
tags:
- default
image: registry.lakedrops.com/docker/gitlab-drupal-ci/php-${PHP_MAJOR_VERSION}.${PHP_MINOR_VERSION}
cache: {}
variables:
GIT_STRATEGY: none
script:
- docker cp ${PROJECT_NAME}.sql ${COMPOSE_PROJECT_NAME}-php-1:/var/www/html
- drush sql:drop --yes
- drush sql:query --file=../${PROJECT_NAME}.sql
- drush cr
- if [[ "${SKIPCONFIGIMPORT}" == "no" ]]; then drush -y config-import; fi
- drush updatedb
- drush cr
.prerequisites:
stage: validation
tags:
......@@ -140,7 +157,7 @@ Debug:
if [[ "$DISABLE_CI_TESTS" == "1" ]]; then
TESTSDISABLED="yes"
GITLABTESTSDISABLED="yes"
elif [[ "$DISABLE_CI_TEST_BEHAT" == "1" ]]; then
elif [[ "$DISABLE_CI_TEST_BACKSTOP" == "1" && "$DISABLE_CI_TEST_BEHAT" == "1" && "$DISABLE_CI_TEST_CYPRESSE2E" == "1" ]]; then
echo "DB not required"
elif [[ "$CI_COMMIT_REF_NAME" == "main" ]]; then
DBREQUIRED="yes"
......@@ -193,6 +210,9 @@ Debug:
if [[ "$CI_COMMIT_MESSAGE" == *"[SKIP_CONFIG_IMPORT]"* ]]; then
SKIPCONFIGIMPORT="yes"
fi
if [[ "$DISABLE_CONFIG_IMPORT" == "1" ]]; then
SKIPCONFIGIMPORT="yes"
fi
if [[ "$TESTSDISABLED" == "no" ]]; then
INCLUDELAKEDROPSTESTS="yes"
......@@ -366,6 +386,8 @@ Debug:
when: never
- if: '$TESTSDISABLED == "yes"'
when: never
- if: '$LOCALDBFILE != "none"'
when: never
- if: '$DISABLE_CI_TESTS != "1"'
.dumpdbNG:
......@@ -396,24 +418,12 @@ Debug:
when: never
- if: '$TESTSDISABLED == "yes"'
when: never
- if: '$LOCALDBFILE != "none"'
when: never
- if: '$DISABLE_CI_TESTS != "1"'
.importdb:
stage: prepare
tags:
- default
image: registry.lakedrops.com/docker/gitlab-drupal-ci/php-${PHP_MAJOR_VERSION}.${PHP_MINOR_VERSION}
cache: {}
variables:
GIT_STRATEGY: none
script:
- docker cp ${PROJECT_NAME}.sql ${COMPOSE_PROJECT_NAME}-php-1:/var/www/html
- drush sql:drop --yes
- drush sql:query --file=../${PROJECT_NAME}.sql
- drush cr
- if [[ "${SKIPCONFIGIMPORT}" == "no" ]]; then drush config-import; fi
- drush updatedb
- drush cr
<<: *import_db_default
rules:
- if: '$DISABLE_DEPLOYMENT != "0"'
when: never
......@@ -425,27 +435,15 @@ Debug:
when: never
- if: '$TESTSDISABLED == "yes"'
when: never
- if: '$LOCALDBFILE != "none"'
when: never
- if: '$DISABLE_CI_TESTS != "1"'
dependencies:
- 'Build Site'
- 'Download DB'
.importdbNG:
stage: prepare
tags:
- default
image: registry.lakedrops.com/docker/gitlab-drupal-ci/php-${PHP_MAJOR_VERSION}.${PHP_MINOR_VERSION}
cache: {}
variables:
GIT_STRATEGY: none
script:
- docker cp ${PROJECT_NAME}.sql ${COMPOSE_PROJECT_NAME}-php-1:/var/www/html
- drush sql:drop --yes
- drush sql:query --file=../${PROJECT_NAME}.sql
- drush cr
- if [[ "${SKIPCONFIGIMPORT}" == "no" ]]; then drush config-import; fi
- drush updatedb
- drush cr
<<: *import_db_default
rules:
- if: '$DISABLE_DEPLOYMENT != "0"'
when: never
......@@ -457,11 +455,35 @@ Debug:
when: never
- if: '$TESTSDISABLED == "yes"'
when: never
- if: '$LOCALDBFILE != "none"'
when: never
- if: '$DISABLE_CI_TESTS != "1"'
dependencies:
- 'Build Site'
- 'Download DB NG'
.importdbLocal:
<<: *import_db_default
variables:
GIT_STRATEGY: fetch
before_script:
- cp ${LOCALDBFILE} ${PROJECT_NAME}.sql.gz
- gunzip ${PROJECT_NAME}.sql.gz
rules:
- if: '$DISABLE_DEPLOYMENT != "0"'
when: never
- if: '$DISABLE_DEPLOYMENT_LOCAL != "0"'
when: never
- if: '$DBREQUIRED == "no"'
when: never
- if: '$TESTSDISABLED == "yes"'
when: never
- if: '$LOCALDBFILE == "none"'
when: never
- if: '$DISABLE_CI_TESTS != "1"'
dependencies:
- 'Build Site'
.updatedb:
stage: prepare
tags:
......
......@@ -92,3 +92,28 @@ Test Backstop:
- 'Build Theme'
rules:
- if: '$DISABLE_CI_TEST_BACKSTOP != "1"'
Test Cypress E2E:
<<: *test_lakedrops_default
needs:
- job: Build Site
- job: Build Theme
- job: Import DB
optional: true
- job: Import DB NG
optional: true
- job: Update DB
optional: true
script:
- cypress run --browser firefox --project /e2e
artifacts:
name: cypresse2e
when: always
paths:
- tests/cypress/screenshots
- tests/cypress/videos
dependencies:
- 'Build Site'
- 'Build Theme'
rules:
- if: '$DISABLE_CI_TEST_CYPRESSE2E != "1"'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment