-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from the-events-calendar/release/B23.boilerplate
Merge B23.boilerplate
- Loading branch information
Showing
24 changed files
with
54,183 additions
and
5,149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# This file will be consumed by both the CI and the tests. | ||
# Some environment variables might not apply to one but might apply to the other: modify with care. | ||
|
||
# What version of WordPress we want to install and test against. | ||
# This has to be compatible with the `wp core download` command, see https://developer.wordpress.org/cli/commands/core/download/. | ||
WP_VERSION=latest | ||
|
||
# This is where, in the context of the CI, we'll install and configure WordPress. | ||
# See `.travis.yml` for more information. | ||
WP_ROOT_FOLDER=/var/www/html | ||
|
||
# The WordPress installation will be served from the Docker container. | ||
# See `dev/docker/ci-compose.yml` for more information. | ||
WP_URL=http://wordpress.test | ||
WP_DOMAIN=wordpress.test | ||
|
||
# The credentials that will be used to access the site in acceptance tests | ||
# in methods like `$I->loginAsAdmin();`. | ||
WP_ADMIN_USERNAME=admin | ||
WP_ADMIN_PASSWORD=password | ||
|
||
WP_DB_PORT=3306 | ||
|
||
# The databse is served from the Docker `db` container. | ||
# See `dev/docker/ci-compose.yml` for more information. | ||
WP_TABLE_PREFIX=wp_ | ||
WP_DB_HOST=db | ||
WP_DB_NAME=test | ||
WP_DB_USER=root | ||
WP_DB_PASSWORD=password | ||
|
||
# We're using Selenium and Chrome for acceptance testing. | ||
# In CI context we're starting a Docker container to handle that. | ||
# See the `dev/docker/ci-compose.yml` file. | ||
CHROMEDRIVER_HOST=chrome | ||
CHROMEDRIVER_PORT=4444 | ||
|
||
# The URL of the WordPress installation from the point of view of the Chromedriver container. | ||
# Why not just use `wordpress`? While Chrome will accept an `http://wordpress` address WordPress | ||
# will not, we call the WordPress container with a seemingly looking legit URL and leverage the | ||
# lines that, in the `wp-config.php` file, will make it so that WordPress will use as its home | ||
# URL whatever URL we reach it with. | ||
# See the `dev/docker/wp-config.php` template for more information. | ||
WP_CHROMEDRIVER_URL=http://wordpress.test | ||
|
||
# To run the tests let's force the background-processing lib to run in synchronous (single PHP thread) mode. | ||
TRIBE_NO_ASYNC=1 | ||
|
||
# We're using Docker to run the tests. | ||
USING_CONTAINERS=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,231 @@ | ||
name: 'Codeception Tests' | ||
on: [ pull_request ] | ||
jobs: | ||
test: | ||
strategy: | ||
matrix: | ||
suite: | ||
- integration | ||
runs-on: ubuntu-latest | ||
steps: | ||
# ------------------------------------------------------------------------------ | ||
# Checkout the repo | ||
# ------------------------------------------------------------------------------ | ||
- name: Checkout the repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1000 | ||
token: ${{ secrets.GH_BOT_TOKEN }} | ||
submodules: recursive | ||
# ------------------------------------------------------------------------------ | ||
# Check if any PHP files have changed | ||
# ------------------------------------------------------------------------------ | ||
- name: Check changed files | ||
id: skip | ||
run: | | ||
num_php_files=$(git diff ${{ github.event.pull_request.base.sha }} HEAD --name-only | grep -P "\.php" | wc -l) | ||
if [[ -z "$num_php_files" ]]; then | ||
echo "::set-output name=value::1" | ||
elif [[ "$num_php_files" == "0" || "$num_php_files" == "" ]]; then | ||
echo "::set-output name=value::1" | ||
else | ||
echo "::set-output name=value::0" | ||
fi | ||
# ------------------------------------------------------------------------------ | ||
# Checkout slic | ||
# ------------------------------------------------------------------------------ | ||
- name: Checkout slic | ||
uses: actions/checkout@v2 | ||
if: steps.skip.outputs.value != 1 | ||
with: | ||
repository: stellarwp/slic | ||
ref: main | ||
path: slic | ||
fetch-depth: 1 | ||
# ------------------------------------------------------------------------------ | ||
# Prepare our composer cache directory | ||
# ------------------------------------------------------------------------------ | ||
- name: Get Composer Cache Directory | ||
id: get-composer-cache-dir | ||
if: steps.skip.outputs.value != 1 | ||
run: | | ||
echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- uses: actions/cache@v2 | ||
id: composer-cache | ||
if: steps.skip.outputs.value != 1 | ||
with: | ||
path: ${{ steps.get-composer-cache-dir.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-composer- | ||
# ------------------------------------------------------------------------------ | ||
# Initialize slic | ||
# ------------------------------------------------------------------------------ | ||
- name: Set up slic env vars | ||
if: steps.skip.outputs.value != 1 | ||
run: | | ||
echo "SLIC_BIN=${GITHUB_WORKSPACE}/slic/slic" >> $GITHUB_ENV | ||
echo "TRIC_WP_DIR=${GITHUB_WORKSPACE}/slic/_wordpress" >> $GITHUB_ENV | ||
echo "TRIC_WORDPRESS_DOCKERFILE=Dockerfile.base" >> $GITHUB_ENV | ||
- name: Set run context for slic | ||
if: steps.skip.outputs.value != 1 | ||
run: echo "TRIC=1" >> $GITHUB_ENV && echo "CI=1" >> $GITHUB_ENV | ||
- name: Start ssh-agent | ||
if: steps.skip.outputs.value != 1 | ||
run: | | ||
mkdir -p "${HOME}/.ssh"; | ||
ssh-agent -a /tmp/ssh_agent.sock; | ||
- name: Export SSH_AUTH_SOCK env var | ||
if: steps.skip.outputs.value != 1 | ||
run: echo "SSH_AUTH_SOCK=/tmp/ssh_agent.sock" >> $GITHUB_ENV | ||
- name: Set up slic for CI | ||
if: steps.skip.outputs.value != 1 | ||
run: | | ||
cd ${GITHUB_WORKSPACE}/.. | ||
${SLIC_BIN} here | ||
${SLIC_BIN} interactive off | ||
${SLIC_BIN} build-prompt off | ||
${SLIC_BIN} build-subdir off | ||
${SLIC_BIN} xdebug off | ||
${SLIC_BIN} composer-cache set /home/runner/.cache/composer | ||
${SLIC_BIN} debug on | ||
${SLIC_BIN} info | ||
${SLIC_BIN} config | ||
# ------------------------------------------------------------------------------ | ||
# Determine TEC branch | ||
# ------------------------------------------------------------------------------ | ||
- name: Fetch head branch from TEC | ||
uses: octokit/[email protected] | ||
if: steps.skip.outputs.value != 1 | ||
id: fetch-tec-head-branch | ||
with: | ||
route: GET /repos/{owner}/{repo}/branches/${{ github.head_ref }} | ||
owner: the-events-calendar | ||
repo: the-events-calendar | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }} | ||
continue-on-error: true | ||
- name: Fetch base branch from TEC | ||
uses: octokit/[email protected] | ||
id: fetch-tec-base-branch | ||
if: steps.skip.outputs.value != 1 && steps.fetch-tec-head-branch.outcome != 'success' | ||
with: | ||
route: GET /repos/{owner}/{repo}/branches/${{ github.base_ref }} | ||
owner: the-events-calendar | ||
repo: the-events-calendar | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }} | ||
continue-on-error: true | ||
# ------------------------------------------------------------------------------ | ||
# Set TEC branch | ||
# ------------------------------------------------------------------------------ | ||
- name: Set TEC with head branch | ||
if: steps.skip.outputs.value != 1 && steps.fetch-tec-head-branch.outcome == 'success' | ||
run: echo "TEC_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV | ||
- name: Set TEC with base branch | ||
if: steps.skip.outputs.value != 1 && steps.fetch-tec-head-branch.outcome != 'success' && steps.fetch-tec-base-branch.outcome == 'success' | ||
run: echo "TEC_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV | ||
- name: Set TEC with master branch | ||
if: steps.skip.outputs.value != 1 && steps.fetch-tec-head-branch.outcome != 'success' && steps.fetch-tec-base-branch.outcome != 'success' | ||
run: echo "TEC_BRANCH=master" >> $GITHUB_ENV | ||
# ------------------------------------------------------------------------------ | ||
# Clone and init TEC | ||
# ------------------------------------------------------------------------------ | ||
- name: Clone TEC | ||
uses: actions/checkout@v2 | ||
if: steps.skip.outputs.value != 1 | ||
with: | ||
fetch-depth: 1 | ||
repository: the-events-calendar/the-events-calendar | ||
ref: ${{ env.TEC_BRANCH }} | ||
token: ${{ secrets.GH_BOT_TOKEN }} | ||
path: the-events-calendar | ||
submodules: recursive | ||
- name: Init TEC | ||
if: steps.skip.outputs.value != 1 | ||
run: | | ||
mv ${GITHUB_WORKSPACE}/the-events-calendar ${GITHUB_WORKSPACE}/../the-events-calendar | ||
docker network prune -f | ||
${SLIC_BIN} use the-events-calendar | ||
${SLIC_BIN} composer install --no-dev | ||
- name: Set up Common | ||
if: steps.skip.outputs.value != 1 | ||
run: | | ||
docker network prune -f | ||
${SLIC_BIN} use the-events-calendar/common | ||
${SLIC_BIN} composer install --no-dev | ||
# ------------------------------------------------------------------------------ | ||
# Determine ECP branch | ||
# ------------------------------------------------------------------------------ | ||
- name: Fetch head branch from ECP | ||
uses: octokit/[email protected] | ||
if: steps.skip.outputs.value != 1 | ||
id: fetch-ecp-head-branch | ||
with: | ||
route: GET /repos/{owner}/{repo}/branches/${{ github.head_ref }} | ||
owner: the-events-calendar | ||
repo: events-pro | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }} | ||
continue-on-error: true | ||
- name: Fetch base branch from ECP | ||
uses: octokit/[email protected] | ||
id: fetch-ecp-base-branch | ||
if: steps.skip.outputs.value != 1 && steps.fetch-ecp-head-branch.outcome != 'success' | ||
with: | ||
route: GET /repos/{owner}/{repo}/branches/${{ github.base_ref }} | ||
owner: the-events-calendar | ||
repo: events-pro | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }} | ||
continue-on-error: true | ||
# ------------------------------------------------------------------------------ | ||
# Set ECP branch | ||
# ------------------------------------------------------------------------------ | ||
- name: Set ECP with head branch | ||
if: steps.skip.outputs.value != 1 && steps.fetch-ecp-head-branch.outcome == 'success' | ||
run: echo "ECP_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV | ||
- name: Set ECP with base branch | ||
if: steps.skip.outputs.value != 1 && steps.fetch-ecp-head-branch.outcome != 'success' && steps.fetch-ecp-base-branch.outcome == 'success' | ||
run: echo "ECP_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV | ||
- name: Set ECP with master branch | ||
if: steps.skip.outputs.value != 1 && steps.fetch-ecp-head-branch.outcome != 'success' && steps.fetch-ecp-base-branch.outcome != 'success' | ||
run: echo "ECP_BRANCH=master" >> $GITHUB_ENV | ||
# ------------------------------------------------------------------------------ | ||
# Clone and init ECP | ||
# ------------------------------------------------------------------------------ | ||
- name: Clone ECP | ||
uses: actions/checkout@v2 | ||
if: steps.skip.outputs.value != 1 | ||
with: | ||
fetch-depth: 1 | ||
repository: the-events-calendar/events-pro | ||
ref: ${{ env.ECP_BRANCH }} | ||
token: ${{ secrets.GH_BOT_TOKEN }} | ||
path: events-pro | ||
submodules: recursive | ||
- name: Init ECP | ||
if: steps.skip.outputs.value != 1 | ||
run: | | ||
mv ${GITHUB_WORKSPACE}/events-pro ${GITHUB_WORKSPACE}/../events-pro | ||
docker network prune -f | ||
${SLIC_BIN} use events-pro | ||
${SLIC_BIN} composer install --no-dev | ||
# ------------------------------------------------------------------------------ | ||
# Set up Advanced Post Manager and run tests | ||
# ------------------------------------------------------------------------------ | ||
- name: Set up Advanced Post Manager | ||
if: steps.skip.outputs.value != 1 | ||
run: | | ||
${SLIC_BIN} use advanced-post-manager | ||
${SLIC_BIN} composer install | ||
- name: Init the WordPress container | ||
if: steps.skip.outputs.value != 1 | ||
run: ${SLIC_BIN} up wordpress | ||
- name: Ensure Twenty-Twenty is installed | ||
if: steps.skip.outputs.value != 1 | ||
run: | | ||
${SLIC_BIN} wp theme install twentytwenty --activate | ||
- name: Run suite tests | ||
if: steps.skip.outputs.value != 1 | ||
run: ${SLIC_BIN} run ${{ matrix.suite }} --ext DotReporter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
node_modules | ||
|
||
/vendor/ | ||
|
||
# Codeception configuration files. | ||
codeception.yml | ||
tests/*.suite.yml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
10.16.0 | ||
18.13.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
paths: | ||
tests: tests | ||
output: tests/_output | ||
data: tests/_data | ||
support: tests/_support | ||
envs: tests/_envs | ||
actor_suffix: Tester | ||
extensions: | ||
commands: | ||
- 'Codeception\Command\GenerateWPUnit' | ||
- 'Codeception\Command\GenerateWPRestApi' | ||
- 'Codeception\Command\GenerateWPRestController' | ||
- 'Codeception\Command\GenerateWPRestPostTypeController' | ||
- 'Codeception\Command\GenerateWPAjax' | ||
- 'Codeception\Command\GenerateWPCanonical' | ||
- 'Codeception\Command\GenerateWPXMLRPC' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
params: | ||
# read dynamic configuration parameters from the .env file | ||
- .env.testing.slic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "the-events-calendar/advanced-post-manager", | ||
"description": "Dialing custom post types to 11 with advanced filtering controls.", | ||
"type": "wordpress-plugin", | ||
"license": "GPLv2 or later", | ||
"authors": [ | ||
{ | ||
"name": "The Events Calendar" | ||
} | ||
], | ||
"minimum-stability": "stable", | ||
"require": {}, | ||
"require-dev": { | ||
"lucatume/wp-browser": "3.1.7" | ||
}, | ||
"autoload-dev": { | ||
"files": [ | ||
"tests/_autoload.php" | ||
] | ||
} | ||
} |
Oops, something went wrong.