@@ -0,0 +1,136 @@
# Our base image
image : registry.gitlab.com/wpquark/docker-containers/php-node:2.0.0-php-7.3-node-12.13.0
# Select what we should cache
cache :
key : " $CI_COMMIT_REF_SLUG-$CI_JOB_NAME"
paths :
- .yarn-cache
- .composer-cache
# Our stages
stages :
- test
- build
- deploy
variables :
YARN_CACHE_FOLDER : " $CI_PROJECT_DIR/.yarn-cache"
COMPOSER_CACHE_DIR : " $CI_PROJECT_DIR/.composer-cache"
MYSQL_DATABASE : " wp_wpeform_test"
MYSQL_ROOT_PASSWORD : " 12345678"
test:javascript :
stage : test
tags :
- wordpress
image : registry.gitlab.com/wpquark/docker-containers/php-node:2.0.0-php-7.3-node-12.13.0
before_script :
- yarn install --frozen-lockfile
script :
- yarn lint
- yarn test
- php scripts/coverage-shouter.php -sjs
- bash <(curl -s https://codecov.io/bash) -F client
# We test on php7.1, php7.2 and php7.3, stripped down here
# We generate code-cverage here only
test:php73 :
stage : test
tags :
- wordpress
image : registry.gitlab.com/wpquark/docker-containers/php-node:2.0.0-php-7.3-node-12.13.0
services :
- mariadb:10.3
before_script :
- yarn install --frozen-lockfile
- composer install
- vendor/bin/pcov clobber
script :
- yarn phpcs
- yarn phpunit:install "$MYSQL_DATABASE" root "$MYSQL_ROOT_PASSWORD" mariadb latest true
# - yarn phpunit
- yarn phpunit:ci
- php scripts/coverage-shouter.php -sphp
- bash <(curl -s https://codecov.io/bash) -F server
artifacts :
paths :
- coverage/phpunit
expire_in : 2 days
# Build WordPress plugin file
build :
stage : build
tags :
- wordpress
image : registry.gitlab.com/wpquark/docker-containers/php-node:1.1.0-php-7.3-node-10.15.3
before_script :
- yarn install --frozen-lockfile
# install production dependency and optimize autoload
# https://getcomposer.org/doc/articles/autoloader-optimization.md
- composer install --no-dev --optimize-autoloader
script :
- yarn build
- yarn archive
artifacts :
paths :
- package/wp-eform.zip
expire_in : 1 week
only :
- master@wpquark/wp-eform.io/wp-eform
# And we do continuous deployment
deploy-staging :
stage : deploy
image : registry.gitlab.com/wpquark/docker-containers/php-node:1.1.0-php-7.3-node-10.15.3
tags :
- wordpress
before_script :
- eval $(ssh-agent -s)
- ' [[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
script :
# Make sure we add the Staging Key so that we can SSH
- ssh-add <(cat "$STAGING_KEY")
# Delete and recreate the temporary directory for copying
- ssh -p<PORT> [email protected] "rm -rf ~/tmp_wpeform && mkdir -p ~/tmp_wpeform"
# Copy the distribution ZIP
- scp -P<PORT> package/wp-eform.zip [email protected] :~/tmp_wpeform
# SSH and Delete the current plugin and unzip the new build
- ssh -p<PORT> [email protected] "rm -rf ~/public_html/wp-content/plugins/wp-eform && unzip ~/tmp_wpeform/wp-eform.zip -d ~/public_html/wp-content/plugins"
environment :
name : staging
url : https://staging.wpeform.io/wp-admin/admin.php?page=wpeform#/dashboard
dependencies :
- build
only :
- master@wpquark/wp-eform.io/wp-eform
# Deploy to production but manually
deploy-production :
stage : deploy
image : registry.gitlab.com/wpquark/docker-containers/php-node:1.1.0-php-7.3-node-10.15.3
tags :
- wordpress
before_script :
- eval $(ssh-agent -s)
- ' [[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
script :
# Make sure we add the Staging Key so that we can SSH
- ssh-add <(cat "$PRODUCTION_KEY")
# Delete and recreate the temporary directory for copying
- ssh -p<PORT> [email protected] "rm -rf ~/tmp_wpeform && mkdir -p ~/tmp_wpeform"
# Copy the distribution ZIP
- scp -P<PORT> package/wp-eform.zip [email protected] :~/tmp_wpeform
# SSH and Delete the current plugin and unzip the new build
- ssh -p<PORT> [email protected] "rm -rf ~/public_html/wp-content/plugins/wp-eform && unzip ~/tmp_wpeform/wp-eform.zip -d ~/public_html/wp-content/plugins"
environment :
name : production
url : https://wpeform.io/wp-admin/admin.php?page=wpeform#/dashboard
dependencies :
- build
when : manual
only :
- master@wpquark/wp-eform.io/wp-eform
# Just like above we can deploy to any server.