Skip to content

Core now creates ufmatches on install, so trying to create it in test setup leads to fails #2492

Core now creates ufmatches on install, so trying to create it in test setup leads to fails

Core now creates ufmatches on install, so trying to create it in test setup leads to fails #2492

Workflow file for this run

name: Integration Tests
on:
push:
pull_request:
branches:
- 6.x
schedule:
# Run Monday/Thursday at 12:13 GMT
- cron: '13 12 * * 1,4'
workflow_dispatch:
inputs:
coreprurl:
description: (optional) Core PR URL
required: false
drupal8prurl:
description: (optional) Drupal 8 PR URL
required: false
jobs:
phpunit:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- drupal: '10.3.*'
civicrm: 'dev-master'
php: '8.3'
name: Drupal ${{ matrix.drupal }} | CiviCRM ${{ matrix.civicrm }}
services:
mysql:
image: mysql:8.0
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: db
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pdo, mysql, pdo_mysql, bcmath, soap, intl, gd, exif, iconv
coverage: none
tools: composer:v2
- name: Get composer cache directory
id: composercache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.drupal }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
# Notes
# - Must enable patching for civicrm/civicrm-core
# - CiviCRM requires `compile-mode: all`
- name: Setup sendmail
run: |
sudo apt-get update
sudo apt-get install sendmail
# Temp thing
- name: Downgrade chrome
run: |
curl -L -o chrome.deb http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_127.0.6533.119-1_amd64.deb
sudo apt-get install libu2f-udev
sudo dpkg -i chrome.deb
google-chrome-stable --version
- name: Setup Drupal
run: |
COMPOSER_MEMORY_LIMIT=-1 composer create-project drupal/recommended-project:${{ matrix.drupal }} ~/drupal --no-interaction --no-install
cd ~/drupal
composer config extra.enable-patching true
composer config extra.compile-mode all
composer config minimum-stability dev
composer config prefer-stable true
composer config preferred-install auto
composer config allow-plugins.civicrm/composer-compile-plugin true
composer config allow-plugins.civicrm/composer-downloads-plugin true
composer config allow-plugins.civicrm/civicrm-asset-plugin true
composer config allow-plugins.cweagans/composer-patches true
composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
# Note in composer v2 the order is more important. We want the path one to have higher priority.
composer config repositories.0 composer https://packages.drupal.org/8
composer config repositories.1 path $GITHUB_WORKSPACE
composer install --no-interaction
COMPOSER_MEMORY_LIMIT=-1 composer require drupal/core-dev-pinned:${{ matrix.drupal }}
- name: Suppress links to screenshots
# There's so many! They can be useful locally if running one test, but they aren't useful here and cause massive scrolling.
run: |
cd ~/drupal
curl -L -O https://raw.githubusercontent.com/colemanw/webform_civicrm/def72b3dce1ea4bc7dd2cdd28a72844885727789/DrupalHtmlOutputTrait.diff
git apply DrupalHtmlOutputTrait.diff
- name: Install CiviCRM ${{ matrix.civicrm }}
run: |
cd ~/drupal
COMPOSER_MEMORY_LIMIT=-1 composer require civicrm/civicrm-asset-plugin:'~1.1' civicrm/civicrm-{core,packages,drupal-8}:${{ matrix.civicrm }} -W
- name: Download Webform
run: |
cd ~/drupal
COMPOSER_MEMORY_LIMIT=-1 composer require 'drupal/webform:^6.2'
- name: Install webform_civicrm
run: |
cd ~/drupal
# We used the github action `checkout` plugin at the start to check out the PR branch, and then set up a composer virtual `path` repo earlier when setting up composer config. So this should pull from that repo not the real one.
COMPOSER_MEMORY_LIMIT=-1 composer require drupal/webform_civicrm:@dev
- name: Install token
run: |
cd ~/drupal
COMPOSER_MEMORY_LIMIT=-1 composer require drupal/token:^1.11
- name: Download some test helpers
run: |
cd ~/drupal
COMPOSER_MEMORY_LIMIT=-1 composer require semperit/minkcivicrmhelpers
- name: Set identity
# Needed for `git am` but otherwise irrelevant
run: |
git config --global user.email "[email protected]"
git config --global user.name "Webform CiviCRM"
- name: Optionally Apply Core PR
if: ${{ github.event.inputs.coreprurl != 0 }}
run: |
cd ~/drupal/vendor/civicrm/civicrm-core
curl -L -o prpatch.patch ${{ github.event.inputs.coreprurl }}.patch
git am prpatch.patch
- name: Optionally Apply Drupal 8 PR
if: ${{ github.event.inputs.drupal8prurl != 0 }}
run: |
cd ~/drupal/web/modules/contrib/civicrm
curl -L -o prpatch.patch ${{ github.event.inputs.drupal8prurl }}.patch
git am prpatch.patch
- name: Do a fake temp install
# so that we can use civi api to get extensions with a version appropriate to the installed civi version
run: |
cd ~/drupal
composer require drush/drush
mkdir -p /home/runner/civicrm-cv
curl -L https://download.civicrm.org/cv/cv.phar -o /home/runner/civicrm-cv/cv
chmod +x /home/runner/civicrm-cv/cv
./vendor/drush/drush/drush -y -l http://civi.localhost site-install standard --db-url='mysql://root:@127.0.0.1:${{ job.services.mysql.ports[3306] }}/fakedb' --site-name=FakeCivi
chmod +w web/sites/default
/home/runner/civicrm-cv/cv core:install --cms-base-url=http://civi.localhost
- name: Download Civi extensions
run: |
mkdir -p ~/drupal/web/sites/default/files/civicrm/ext
cd ~/drupal/web/sites/default/files/civicrm/ext
# Allow "unapproved" extensions
/home/runner/civicrm-cv/cv ev '\Civi::settings()->set("ext_repo_url", "https://civicrm.org/extdir/ver={ver}|cms={uf}|ready=");'
/home/runner/civicrm-cv/cv ev '\Civi::settings()->set("http_timeout", 60);'
# Apparently we have to install it, otherwise stripe gives a dependency error even with install=0. I think that's a bug, but let's just do it. This is a fake install anyway.
/home/runner/civicrm-cv/cv api3 Extension.download install=1 key=mjwshared
/home/runner/civicrm-cv/cv api3 Extension.download install=1 key=firewall
/home/runner/civicrm-cv/cv api3 Extension.download install=1 key=mjwpaymentapi
/home/runner/civicrm-cv/cv api3 Extension.download install=1 key=com.drastikbydesign.stripe
/home/runner/civicrm-cv/cv api3 Extension.download install=0 key=com.iatspayments.civicrm
/home/runner/civicrm-cv/cv api3 Extension.download install=0 key=com.aghstrategies.uscounties
# temporary iats patches for undeclared vars
cd com.iatspayments.civicrm
curl -L -O https://patch-diff.githubusercontent.com/raw/iATSPayments/com.iatspayments.civicrm/pull/455.diff
curl -L -O https://patch-diff.githubusercontent.com/raw/iATSPayments/com.iatspayments.civicrm/pull/456.diff
curl -L -O https://patch-diff.githubusercontent.com/raw/iATSPayments/com.iatspayments.civicrm/pull/457.diff
curl -L -O https://patch-diff.githubusercontent.com/raw/iATSPayments/com.iatspayments.civicrm/pull/458.diff
git apply 455.diff
git apply 456.diff
git apply 457.diff
git apply 458.diff
# temporary patch for stripe keys
cd ../com.drastikbydesign.stripe
curl -L -o stripekeys.diff https://lab.civicrm.org/extensions/stripe/-/commit/916668c5e192050997e4fe687e3c053bed6a7fdc.diff
git apply stripekeys.diff
- uses: nanasess/setup-chromedriver@master
with:
# temporary to match downgraded chrome
chromedriver-version: '127.0.6533.119'
- name: Run chromedriver
run: chromedriver --port=9515 &
- name: Run php built-in server
run: php -S 127.0.0.1:8080 -t ~/drupal/web &
- name: Run PHPUnit
run: |
mkdir -p $BROWSERTEST_OUTPUT_DIRECTORY
cd ~/drupal/web
../vendor/bin/phpunit --verbose -c core modules/contrib/webform_civicrm
env:
SYMFONY_DEPRECATIONS_HELPER: 999999
SIMPLETEST_DB: mysql://root:@127.0.0.1:${{ job.services.mysql.ports[3306] }}/db
SIMPLETEST_BASE_URL: http://127.0.0.1:8080
MINK_DRIVER_ARGS_WEBDRIVER: '["chrome", {"browserName":"chrome","goog:chromeOptions":{"args":["--disable-gpu", "--no-sandbox", "--headless"]}}, "http://127.0.0.1:9515"]'
BROWSERTEST_OUTPUT_DIRECTORY: '/home/runner/drupal/web/sites/simpletest/browser_output'
DEV_EXTENSION_DIR: /home/runner/drupal/web/sites/default/files/civicrm/ext
DEV_EXTENSION_URL: http://127.0.0.1:8080/sites/default/files/civicrm/ext
- name: Helper to make unique name for upload
if: ${{ failure() || success() }}
run: |
# doing this on multiple lines to avoid quote-hell
cd ${{ runner.temp }}
echo '${{ matrix.drupal }}_${{ matrix.civicrm }}_${{ matrix.php }}' > upload_helper.txt
sed -i -e 's/[^0-9a-zA-Z_.\-]//g' upload_helper.txt
echo "UPLOADNAME=$(cat upload_helper.txt)" >> $GITHUB_ENV
- uses: actions/upload-artifact@v4
if: ${{ failure() || success() }}
with:
name: screenshots.${{ env.UPLOADNAME }}
# For some reason Drupal prints here and not our specified BROWSERTEST_OUTPUT_DIRECTORY.
path: '/home/runner/drupal/web/sites/simpletest/browser_output'
retention-days: 7