Skip to content

updates #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 2 additions & 101 deletions .ci/.github/workflows/build_deploy_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -237,113 +237,14 @@ jobs:
source $BASH_ENV
./.ci/deploy/pantheon/dev-multidev

behat_test:
container:
image: quay.io/pantheon-public/build-tools-ci:6.x
options: --user root
runs-on: ubuntu-latest
continue-on-error: true
needs: [deploy_to_pantheon]
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Cache bash_env.txt
uses: actions/cache@v2
env:
cache-name: cache-bash-env
with:
path: bash_env.txt
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.run_number }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-

- name: Cache composer cache
uses: actions/cache@v2
env:
cache-name: cache-composer-cache
with:
path: ~/.composer/cache
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('composer.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-

- name: Cache vendor folder
uses: actions/cache@v2
env:
cache-name: cache-vendor
with:
path: ./vendor
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('composer.lock') }}

- name: Cache web folder
uses: actions/cache@v2
env:
cache-name: cache-web
with:
path: ./web
key: ${{ runner.os }}-build-${{ env.cache-name }}

- name: Cache drush folder
uses: actions/cache@v2
env:
cache-name: cache-drush
with:
path: ./drush
key: ${{ runner.os }}-build-${{ env.cache-name }}

# Set TERMINUS_ENV and related environment variables.
# https://github.com/pantheon-systems/docker-build-tools-ci/blob/6.x/scripts/set-environment
- name: setup-environment-vars
run: /build-tools-ci/scripts/set-environment

# Uncomment line 26 in .ci/test/behat/initialize to create a backup
# prior to running Behat tests. This is useful to reset the multidev
# environment to the previous state after Behat tests have run.
- name: prepare for Behat testing
run: |
echo "$SSH_PRIVATE_KEY" > ../private.key
chmod 600 ../private.key
eval `ssh-agent -s`
ssh-add ../private.key
source $BASH_ENV
./.ci/test/behat/initialize

- name: run acceptance tests with Behat
run: |
eval `ssh-agent -s`
ssh-add ../private.key
./.ci/test/behat/run

# Uncomment line 13 in .ci/test/behat/cleanup to restore a backup
# after running Behat tests. This is useful to reset the multidev
# environment to the previous state after Behat tests have run.
- name: clean up after Behat
if: ${{ always() }}
run: |
eval `ssh-agent -s`
ssh-add ../private.key
source $BASH_ENV
./.ci/test/behat/cleanup

- name: Upload artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: behat-report
path: /tmp/artifacts

visual_regression_test:
container:
image: backstopjs/backstopjs:5.3.2
options: --user root
runs-on: ubuntu-latest
if: ${{ github.ref != 'refs/heads/master' }}
needs: [configure_env_vars, behat_test]
needs: [configure_env_vars]
steps:
- name: Update git version
run: |
Expand Down Expand Up @@ -417,4 +318,4 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: vrt-report
path: /tmp/artifacts
path: /tmp/artifacts
47 changes: 25 additions & 22 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# NOTE: See Pantheon example WP repo for original version this config file was based off of
# https://github.com/pantheon-systems/example-wordpress-composer/blob/master/.circleci/config.yml
# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs
defaults: &defaults
docker:
- image: quay.io/pantheon-public/build-tools-ci:6.x
- image: quay.io/pantheon-public/build-tools-ci:8.x-php8.2
working_directory: ~/example_wordpress_composer
environment:
#=========================================================================
Expand All @@ -13,24 +15,22 @@ defaults: &defaults
# TERMINUS_SITE: Name of the Pantheon site to run tests on, e.g. my_site
# TERMINUS_TOKEN: The Pantheon machine token
# GITHUB_TOKEN: The GitHub personal access token
# GIT_EMAIL: The email address to use when making commits
# GIT_EMAIL: The email address to use when making commits
#
# TEST_SITE_NAME: The name of the test site to provide when installing.
# ADMIN_PASSWORD: The admin password to use when installing.
# ADMIN_EMAIL: The email address to give the admin when installing.
# ADMIN_EMAIL: The email address to give the admin when installing.
#=========================================================================
TZ: "/usr/share/zoneinfo/America/Los_Angeles"
TZ: "/usr/share/zoneinfo/America/New_York"

# The variables below usually do not need to be modified.

#======================================================================================================================================
# Circle CI 2.0 does not yet expand environment variables so they have to be manually EXPORTed
# Once environment variables can be expanded the variables below can be uncommented and the EXPORTs in set-up-globals.sh can be removed
# See: https://discuss.circleci.com/t/unclear-how-to-work-with-user-variables-circleci-provided-env-variables/12810/11
# See: https://discuss.circleci.com/t/environment-variable-expansion-in-working-directory/11322
# See: https://discuss.circleci.com/t/circle-2-0-global-environment-variables/8681
#======================================================================================================================================

NOTIFY: 'scripts/github/add-commit-comment {project} {sha} "Created multidev environment [{site}#{env}]({dashboard-url})." {site-url}'
ADMIN_USERNAME: admin
TERM: dumb
Expand Down Expand Up @@ -109,7 +109,9 @@ jobs:

- run:
name: install theme composer dependencies
command: cd web/wp-content/themes/sage && composer install
# Note: Add `--ignore-platform-req=ext-redis` for sites using Object Cache Pro
# https://docs.pantheon.io/object-cache/wordpress
command: cd web/wp-content/themes/sage && composer install --ignore-platform-req=ext-redis --no-interaction --optimize-autoloader

- save_cache:
key: vendor-{{ checksum "composer.lock" }}
Expand All @@ -125,7 +127,9 @@ jobs:
build_yarn:
<<: *defaults
docker:
- image: circleci/node:10.16.2
# Note: Use the latest active Node release
# https://nodejs.org/en/about/previous-releases
- image: cimg/node:20.17.0

steps:
- checkout
Expand All @@ -141,7 +145,6 @@ jobs:

- run:
name: build theme assets
# If non-hashed versions of site assets are needed for 3rd parties, also run `yarn build:nohash`
command: cd web/wp-content/themes/sage && yarn build

- save_cache:
Expand All @@ -155,7 +158,7 @@ jobs:
root: .
# Must be relative path from root
paths:
- web/wp-content/themes/sage/dist
- web/wp-content/themes/sage/public

deploy_to_pantheon:
<<: *defaults
Expand Down Expand Up @@ -272,7 +275,7 @@ workflows:
# - static_tests
- build_yarn
- build_php:
context:
context:
- acf_license
- deploy_to_pantheon:
requires:
Expand All @@ -292,13 +295,13 @@ workflows:
# - deploy_to_pantheon
# - visual_regression_test

scheduled_update_check:
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- master
jobs:
- composer_lock_updater
# scheduled_update_check:
# triggers:
# - schedule:
# cron: "0 0 * * *"
# filters:
# branches:
# only:
# - master
# jobs:
# - composer_lock_updater
35 changes: 35 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This is a sample config for local development.
# Simply edit/copy as needed and rename to .env.local.
# application.php will load this file if you're not in a Pantheon (dev/test/live) environment.

# FIXME: Update app name below
WP_HOME=https://fixme-app-name
WP_SITEURL=${WP_HOME}/wp
WP_ENV=development

DB_NAME=pantheon
DB_USER=pantheon
DB_PASSWORD=pantheon
DB_HOST=database

# Optional database variables
# DB_HOST='localhost'
# DB_PREFIX='wp_'

# Specify optional debug.log path starting from web root.
# WP_DEBUG_LOG='/app/debug.log'

# Generate your keys here: https://roots.io/salts.html
AUTH_KEY=generateme
SECURE_AUTH_KEY=generateme
LOGGED_IN_KEY=generateme
NONCE_KEY=generateme
AUTH_SALT=generateme
SECURE_AUTH_SALT=generateme
LOGGED_IN_SALT=generateme
NONCE_SALT=generateme

# 3rd-party vars
ACF_PRO_KEY='fixme-get-from-1password'
# https://www.advancedcustomfields.com/resources/installing-acf-pro-with-composer/
COMPOSER_AUTH='{"http-basic": {"connect.advancedcustomfields.com": {"username": "${ACF_PRO_KEY}", "password": "${WP_HOME}"}}}'
13 changes: 13 additions & 0 deletions .env.pantheon
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
DB_NAME=$_ENV['DB_NAME']
DB_USER=$_ENV['DB_USER']
DB_PASSWORD=$_ENV['DB_PASSWORD']

# Pantheon sets these values for you. If you want to shuffle them you can do so via your dashboard.
AUTH_KEY=$_ENV['AUTH_KEY']
SECURE_AUTH_KEY=$_ENV['SECURE_AUTH_KEY']
LOGGED_IN_KEY=$_ENV['LOGGED_IN_KEY']
NONCE_KEY=$_ENV['NONCE_KEY']
AUTH_SALT=$_ENV['AUTH_SALT']
SECURE_AUTH_SALT=$_ENV['SECURE_AUTH_SALT']
LOGGED_IN_SALT=$_ENV['LOGGED_IN_SALT']
NONCE_SALT=$_ENV['NONCE_SALT']
Loading