summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
diff options
context:
space:
mode:
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r--.gitlab-ci.yml35
1 files changed, 19 insertions, 16 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e3468273..051a5bbe 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -51,18 +51,27 @@ test:
when: always
paths:
- ./coverage/
+ - ./unittests.xml
+ when: always
+ reports:
+ junit: ./unittests.xml
coverage: '/^\s*Lines:\s*(\d+(?:\.\d+)?%)/'
before_script:
- apk add $PHPIZE_DEPS && pecl install xdebug && docker-php-ext-enable xdebug
- - apk add mariadb-client
- - mysql -h "$MYSQL_HOST" -u "$MYSQL_USER" -p"$MYSQL_PASSWORD" "$MYSQL_DATABASE" < db/install.sql
- - mysql -h "$MYSQL_HOST" -u "$MYSQL_USER" -p"$MYSQL_PASSWORD" "$MYSQL_DATABASE" < db/update.sql
- curl -sS https://getcomposer.org/installer | php -- --no-ansi --install-dir /usr/local/bin/ --filename composer
- cp -R tests/ phpunit.xml "${DOCROOT}"
- HOMEDIR=$(pwd)
- cd "${DOCROOT}"
- composer --no-ansi install --dev
- script: vendor/bin/phpunit -v --colors=never --coverage-text --coverage-html "${HOMEDIR}/coverage/"
+ - chmod +x ./bin/migrate
+ - ./bin/migrate
+ script:
+ - set +e
+ - vendor/bin/phpunit -v --colors=never --coverage-text --coverage-html "${HOMEDIR}/coverage/" --log-junit "${HOMEDIR}/unittests.xml"
+ - status=$?
+ - set -e
+ - sed -i "s~${DOCROOT}~${HOMEDIR}/~g" "${HOMEDIR}/unittests.xml"
+ - exit $status
release-image:
<<: *docker_definition
@@ -92,15 +101,11 @@ release-image.nginx:
.deploy_template_script:
# Configure SSH
- - &deployment_ssh |-
+ - &deploy_template_script |-
+ apt update && apt install -yqq rsync openssh-client
mkdir -p ~/.ssh
echo "$SSH_PRIVATE_KEY" | sed -e 's/\r//g' > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
-
- # Install project and dependencies
- - &deployment_dependencies |-
- chmod +x ./deploy.sh
- cp ./deploy.sh "${DOCROOT}/deploy.sh"
cd "${DOCROOT}"
build-release-file:
@@ -127,10 +132,9 @@ deploy-staging:
echo "Skipping deployment";
exit
fi
- - *deployment_ssh
- - *deployment_dependencies
+ - *deploy_template_script
# Deploy to server
- - ./deploy.sh -r "${STAGING_REMOTE}" -p "${STAGING_REMOTE_PATH}" -i "${CI_JOB_ID}-${CI_COMMIT_SHA}"
+ - ./bin/deploy.sh -r "${STAGING_REMOTE}" -p "${STAGING_REMOTE_PATH}" -i "${CI_JOB_ID}-${CI_COMMIT_SHA}"
deploy-production:
<<: *deploy_definition
@@ -146,7 +150,6 @@ deploy-production:
echo "Skipping deployment";
exit
fi
- - *deployment_ssh
- - *deployment_dependencies
+ - *deploy_template_script
# Deploy to server
- - ./deploy.sh -r "${PRODUCTION_REMOTE}" -p "${PRODUCTION_REMOTE_PATH}" -i "${CI_JOB_ID}-${CI_COMMIT_SHA}"
+ - ./bin/deploy.sh -r "${PRODUCTION_REMOTE}" -p "${PRODUCTION_REMOTE_PATH}" -i "${CI_JOB_ID}-${CI_COMMIT_SHA}"