Test: release/t24.hydra #504
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
name: 'EVA Codeception Tests' | |
on: [ pull_request ] | |
jobs: | |
test: | |
strategy: | |
matrix: | |
suite: [ eva_integration, restv1, restv1_et, end2end ] | |
runs-on: ubuntu-latest | |
steps: | |
# ------------------------------------------------------------------------------ | |
# Checkout the repo | |
# ------------------------------------------------------------------------------ | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
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 "value=1" >> $GITHUB_OUTPUT | |
echo "## No PHP Files changed, PHP tests automatically pass." >> $GITHUB_STEP_SUMMARY | |
elif [[ "$num_php_files" == "0" || "$num_php_files" == "" ]]; then | |
echo "value=1" >> $GITHUB_OUTPUT | |
echo "## No PHP Files changed, PHP tests automatically pass." >> $GITHUB_STEP_SUMMARY | |
else | |
echo "value=0" >> $GITHUB_OUTPUT | |
echo "## Found PHP file changes, running PHP tests." >> $GITHUB_STEP_SUMMARY | |
fi | |
# ------------------------------------------------------------------------------ | |
# Checkout slic | |
# ------------------------------------------------------------------------------ | |
- name: Checkout slic | |
uses: actions/checkout@v4 | |
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: Move slic directory up | |
if: steps.skip.outputs.value != 1 | |
run: | | |
mv slic ./../slic | |
- name: Set up slic env vars | |
if: steps.skip.outputs.value != 1 | |
run: | | |
echo "SLIC_COMPOSER_VERSION=2" >> $GITHUB_ENV | |
echo "SLIC_BIN=${GITHUB_WORKSPACE}/../slic/slic" >> $GITHUB_ENV | |
echo "SLIC_WP_DIR=${GITHUB_WORKSPACE}/../slic/_wordpress" >> $GITHUB_ENV | |
- name: Set run context for slic | |
if: steps.skip.outputs.value != 1 | |
run: echo "SLIC=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 | |
# ------------------------------------------------------------------------------ | |
# Fetch branches for dependent repos | |
# ------------------------------------------------------------------------------ | |
- 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 | |
- name: Fetch head branch from ET | |
uses: octokit/[email protected] | |
id: fetch-et-head-branch | |
if: steps.skip.outputs.value != 1 | |
with: | |
route: GET /repos/{owner}/{repo}/branches/${{ github.head_ref }} | |
owner: the-events-calendar | |
repo: event-tickets | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }} | |
continue-on-error: true | |
- name: Fetch base branch from ET | |
uses: octokit/[email protected] | |
id: fetch-et-base-branch | |
if: steps.skip.outputs.value != 1 && steps.fetch-et-head-branch.outcome != 'success' | |
with: | |
route: GET /repos/{owner}/{repo}/branches/${{ github.base_ref }} | |
owner: the-events-calendar | |
repo: event-tickets | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }} | |
continue-on-error: true | |
- name: Fetch head branch from ET+ | |
uses: octokit/[email protected] | |
id: fetch-et-plus-head-branch | |
if: steps.skip.outputs.value != 1 | |
with: | |
route: GET /repos/{owner}/{repo}/branches/${{ github.head_ref }} | |
owner: the-events-calendar | |
repo: event-tickets-plus | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }} | |
continue-on-error: true | |
- name: Fetch base branch from ET+ | |
uses: octokit/[email protected] | |
id: fetch-et-plus-base-branch | |
if: steps.skip.outputs.value != 1 && steps.fetch-et-plus-head-branch.outcome != 'success' | |
with: | |
route: GET /repos/{owner}/{repo}/branches/${{ github.base_ref }} | |
owner: the-events-calendar | |
repo: event-tickets-plus | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }} | |
continue-on-error: true | |
- name: Fetch head branch from Pro | |
uses: octokit/[email protected] | |
id: fetch-pro-head-branch | |
if: steps.skip.outputs.value != 1 | |
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 Pro | |
uses: octokit/[email protected] | |
id: fetch-pro-base-branch | |
if: steps.skip.outputs.value != 1 && steps.fetch-pro-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 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 | |
# ------------------------------------------------------------------------------ | |
# Set ET branch | |
# ------------------------------------------------------------------------------ | |
- name: Set ET with head branch | |
if: steps.skip.outputs.value != 1 && steps.fetch-et-head-branch.outcome == 'success' | |
run: echo "ET_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV | |
- name: Set ET with base branch | |
if: steps.skip.outputs.value != 1 && steps.fetch-et-head-branch.outcome != 'success' && steps.fetch-et-base-branch.outcome == 'success' | |
run: echo "ET_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV | |
- name: Set ET with master branch | |
if: steps.skip.outputs.value != 1 && steps.fetch-et-head-branch.outcome != 'success' && steps.fetch-et-base-branch.outcome != 'success' | |
run: echo "ET_BRANCH=master" >> $GITHUB_ENV | |
# ------------------------------------------------------------------------------ | |
# Set ET+ branch | |
# ------------------------------------------------------------------------------ | |
- name: Set ET+ with head branch | |
if: steps.skip.outputs.value != 1 && steps.fetch-et-plus-head-branch.outcome == 'success' | |
run: echo "ET_PLUS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV | |
- name: Set ET+ with base branch | |
if: steps.skip.outputs.value != 1 && steps.fetch-et-plus-head-branch.outcome != 'success' && steps.fetch-et-plus-base-branch.outcome == 'success' | |
run: echo "ET_PLUS_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV | |
- name: Set ET+ with master branch | |
if: steps.skip.outputs.value != 1 && steps.fetch-et-plus-head-branch.outcome != 'success' && steps.fetch-et-plus-base-branch.outcome != 'success' | |
run: echo "ET_PLUS_BRANCH=master" >> $GITHUB_ENV | |
# -------------------------------------------------------------------------- | |
# Set Pro branch | |
# -------------------------------------------------------------------------- | |
- name: Set Pro with head branch | |
if: steps.skip.outputs.value != 1 && steps.fetch-pro-head-branch.outcome == 'success' | |
run: echo "PRO_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV | |
- name: Set Pro with base branch | |
if: steps.skip.outputs.value != 1 && steps.fetch-pro-head-branch.outcome != 'success' && steps.fetch-pro-base-branch.outcome == 'success' | |
run: echo "PRO_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV | |
- name: Set Pro with master branch | |
if: steps.skip.outputs.value != 1 && steps.fetch-pro-head-branch.outcome != 'success' && steps.fetch-pro-base-branch.outcome != 'success' | |
run: echo "PRO_BRANCH=master" >> $GITHUB_ENV | |
# -------------------------------------------------------------------------- | |
# Clone and init TEC | |
# ------------------------------------------------------------------------------ | |
- name: Clone TEC | |
uses: actions/checkout@v4 | |
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 | |
# ------------------------------------------------------------------------------ | |
# Clone and init ET | |
# ------------------------------------------------------------------------------ | |
- name: Clone ET | |
uses: actions/checkout@v4 | |
if: steps.skip.outputs.value != 1 | |
with: | |
fetch-depth: 1 | |
repository: the-events-calendar/event-tickets | |
ref: ${{ env.ET_BRANCH }} | |
token: ${{ secrets.GH_BOT_TOKEN }} | |
path: event-tickets | |
submodules: recursive | |
- name: Init ET | |
if: steps.skip.outputs.value != 1 | |
run: | | |
mv ${GITHUB_WORKSPACE}/event-tickets ${GITHUB_WORKSPACE}/../event-tickets | |
docker network prune -f | |
${SLIC_BIN} use event-tickets | |
${SLIC_BIN} composer install --no-dev | |
- name: Set up Common | |
if: steps.skip.outputs.value != 1 | |
run: | | |
docker network prune -f | |
${SLIC_BIN} use event-tickets/common | |
${SLIC_BIN} composer install --no-dev | |
# ------------------------------------------------------------------------------ | |
# Clone and init ET+ | |
# ------------------------------------------------------------------------------ | |
- name: Clone ET+ | |
uses: actions/checkout@v4 | |
if: steps.skip.outputs.value != 1 | |
with: | |
fetch-depth: 1 | |
repository: the-events-calendar/event-tickets-plus | |
ref: ${{ env.ET_PLUS_BRANCH }} | |
token: ${{ secrets.GH_BOT_TOKEN }} | |
path: event-tickets-plus | |
submodules: recursive | |
- name: Init ET+ | |
if: steps.skip.outputs.value != 1 | |
run: | | |
mv ${GITHUB_WORKSPACE}/event-tickets-plus ${GITHUB_WORKSPACE}/../event-tickets-plus | |
docker network prune -f | |
${SLIC_BIN} use event-tickets-plus | |
${SLIC_BIN} composer install --no-dev | |
# -------------------------------------------------------------------------- | |
# Clone and init Pro | |
# -------------------------------------------------------------------------- | |
- name: Clone Pro | |
uses: actions/checkout@v2 | |
if: steps.skip.outputs.value != 1 | |
with: | |
fetch-depth: 1 | |
repository: the-events-calendar/events-pro | |
ref: ${{ env.PRO_BRANCH }} | |
token: ${{ secrets.GH_BOT_TOKEN }} | |
path: events-pro | |
submodules: recursive | |
- name: Init Pro | |
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 | |
# -------------------------------------------------------------------------- | |
# Install and activate WooCommerce | |
# ------------------------------------------------------------------------------ | |
- name: Install WooCommerce | |
if: steps.skip.outputs.value != 1 | |
run: ${SLIC_BIN} site-cli plugin install woocommerce --version='8.2.2' | |
# ------------------------------------------------------------------------------ | |
# Install and activate Easy Digital Downloads | |
# ------------------------------------------------------------------------------ | |
- name: Install Easy Digital Downloads | |
if: steps.skip.outputs.value != 1 | |
run: ${SLIC_BIN} site-cli plugin install easy-digital-downloads | |
# ------------------------------------------------------------------------------ | |
# Set up Common | |
# ------------------------------------------------------------------------------ | |
- name: Move Common inside TEC | |
if: steps.skip.outputs.value != 1 | |
run: | | |
rm -rf ${GITHUB_WORKSPACE}/../the-events-calendar/common | |
cp -r ${GITHUB_WORKSPACE} ${GITHUB_WORKSPACE}/../the-events-calendar/common | |
# ------------------------------------------------------------------------------ | |
# Set up Common and run tests | |
# ------------------------------------------------------------------------------ | |
- name: Set up Common | |
if: steps.skip.outputs.value != 1 | |
run: | | |
${SLIC_BIN} use the-events-calendar/common | |
${SLIC_BIN} composer install | |
- name: Init the WordPress container | |
if: steps.skip.outputs.value != 1 | |
run: | | |
${SLIC_BIN} up wordpress | |
${SLIC_BIN} wp core version | |
${SLIC_BIN} wp core update --force --version=6.4.1 | |
${SLIC_BIN} wp core version | |
- name: Run suite tests | |
if: steps.skip.outputs.value != 1 | |
run: ${SLIC_BIN} run ${{ matrix.suite }} | |
# ------------------------------------------------------------------------------ | |
# Copy test outputs into workspace (On failure) | |
# ------------------------------------------------------------------------------ | |
- name: Copy test outputs into workspace | |
if: ${{ steps.skip.outputs.value != 1 && failure() }} | |
run: | | |
mkdir -p "${GITHUB_WORKSPACE}/tests/_output/" | |
cp -r "${GITHUB_WORKSPACE}/../the-events-calendar/common/tests/_output/." "${GITHUB_WORKSPACE}/tests/_output/" || echo "No artifacts found to copy." | |
# ------------------------------------------------------------------------------ | |
# Verify artifacts exist | |
# ------------------------------------------------------------------------------ | |
- name: Verify artifacts exist | |
if: ${{ steps.skip.outputs.value != 1 && failure() }} | |
run: | | |
echo "Listing contents of '${GITHUB_WORKSPACE}/tests/_output/':" | |
ls -la "${GITHUB_WORKSPACE}/tests/_output/" || echo "No artifacts found." | |
# ------------------------------------------------------------------------------ | |
# Upload artifacts (On failure) | |
# ------------------------------------------------------------------------------ | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
if: ${{ steps.skip.outputs.value != 1 && failure() }} | |
with: | |
name: output ${{ matrix.suite }} | |
path: tests/_output/ | |
retention-days: 7 |