From 2614be0c268a81e217f9755d80ce688f287e3f09 Mon Sep 17 00:00:00 2001 From: Erick Hitter <git-contrib@ethitter.com> Date: Sat, 10 Oct 2020 16:34:25 -0700 Subject: [PATCH] Copy from test Pantheon install https://git.ethitter.com/pantheon-origins/ethitter-com/-/blob/b948350a1845a0f71e80a5f56134564fd8aac430/.gitlab-ci.yml --- README.md | 7 ++++- pantheon/default.yml | 74 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 pantheon/default.yml diff --git a/README.md b/README.md index 1246b1b..b5e4586 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ # GitLab CI for WordPress -Shared `.gitlab-ci.yml` components for WordPress plugins and themes. +Shared `.gitlab-ci.yml` components for WordPress. + +## Features + +* `plugins`: PHPUnit, PHPCS, and deploys to WordPress.org. +* `pantheon`: deploy a site to Pantheon via their git integration. diff --git a/pantheon/default.yml b/pantheon/default.yml new file mode 100644 index 0000000..dcbb121 --- /dev/null +++ b/pantheon/default.yml @@ -0,0 +1,74 @@ +stages: + - test + - build + +variables: + GIT_SUBMODULE_STRATEGY: recursive + +test-deps: + stage: test + image: containers.ethitter.com:443/docker/images/php:7.3 + before_script: + - curl -sL https://deb.nodesource.com/setup_10.x | bash - + - apt-get install -y nodejs + script: + - cd ${CI_PROJECT_DIR}/wp-content/mu-plugins/solr-power + - composer install --no-dev --no-ansi -n + - sed -i '/vendor\//d' .gitignore + - sed -i '/assets\/*/d' .gitignore + - npm install + - ./node_modules/grunt/bin/grunt + - rm -rf ./node_modules + +git-push: + stage: build + image: containers.ethitter.com:443/docker/images/php:7.3 + only: + - main + allow_failure: false + before_script: + - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' + - eval $(ssh-agent -s) + - ssh-add <(echo "$GIT_SSH_PRIV_KEY") + + - git config --global user.email "$GIT_USER_EMAIL" + - git config --global user.name "$GIT_USER_NAME" + + - mkdir -p ~/.ssh + - echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts + - ssh-keygen -R "$PANTHEON_GIT_HOST" + - ssh-keyscan -t rsa -p "$PANTHEON_GIT_HOST_PORT" "$PANTHEON_GIT_HOST" >> ~/.ssh/known_hosts + + - composer install --no-dev --no-ansi -n -d wp-content/mu-plugins/solr-power + - sed -i '/vendor\//d' wp-content/mu-plugins/solr-power/.gitignore + - sed -i '/assets\/*/d' wp-content/mu-plugins/solr-power/.gitignore + + - curl -sL https://deb.nodesource.com/setup_10.x | bash - + - apt-get install -y nodejs + + - cd ${CI_PROJECT_DIR}/wp-content/mu-plugins/solr-power + - npm install + - ./node_modules/grunt/bin/grunt + - rm -rf ./node_modules + # TODO: add Terminus to handle pushes and cache clearing. + script: + - cd ${CI_PROJECT_DIR} + - ls -la + - rm -rf ${CI_PROJECT_DIR}/.git/ + - rm -rf ${CI_PROJECT_DIR}/.gitignore + - rm -rf ${CI_PROJECT_DIR}/.gitmodules + - rm -rf ${CI_PROJECT_DIR}/.gitlab-ci.yml + - rm -rf ${CI_PROJECT_DIR}/README.md + - rm -rf ${CI_PROJECT_DIR}/readme.txt + - ls -la + + - git init + - git remote add pantheon "$PANTHEON_GIT_REMOTE" + - git status -s + - git add -A + - git status -s + - git commit -m "Build from $CI_COMMIT_SHORT_SHA" + - git diff --exit-code + - git status -s + - git log -n 1 + - git push --force pantheon master -- GitLab