Skip to content

Commit

Permalink
Merge branch '6.x' into issue-3375337
Browse files Browse the repository at this point in the history
  • Loading branch information
herbdool authored Nov 21, 2024
2 parents bb81ad1 + f212472 commit 5d7a2a8
Show file tree
Hide file tree
Showing 51 changed files with 2,077 additions and 579 deletions.
114 changes: 66 additions & 48 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
coreprurl:
description: (optional) Core PR URL
required: false
drupal8prurl:
description: (optional) Drupal 8 PR URL
required: false

jobs:
phpunit:
Expand All @@ -20,33 +23,30 @@ jobs:
fail-fast: false
matrix:
include:
- drupal: '9.4.*'
civicrm: '5.57.*'
php: '7.4'
- drupal: '9.5.*'
civicrm: '5.58.*'
php: '7.4'
- drupal: '9.5.*'
civicrm: '5.60.x-dev'
php: '7.4'
- drupal: '9.5.*'
civicrm: 'dev-master'
php: '7.4'
- drupal: '10.0.*'
- drupal: '10.2.*'
civicrm: '5.78.*'
php: '8.2'
- drupal: '10.2.*'
civicrm: '5.79.*'
php: '8.2'
- drupal: '10.2.*'
civicrm: '5.80.x-dev'
php: '8.2'
- drupal: '10.3.*'
civicrm: 'dev-master'
php: '8.1'
php: '8.3'
name: Drupal ${{ matrix.drupal }} | CiviCRM ${{ matrix.civicrm }}
services:
mysql:
image: mysql:5.7
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@v3
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
Expand All @@ -56,7 +56,7 @@ jobs:
- name: Get composer cache directory
id: composercache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.drupal }}-composer-${{ hashFiles('**/composer.json') }}
Expand All @@ -68,7 +68,15 @@ jobs:
# - 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
Expand Down Expand Up @@ -98,18 +106,10 @@ jobs:
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: Ensure Webform ^6.2
if: ${{ matrix.drupal == '10.0.*' }}
- name: Download Webform
run: |
cd ~/drupal
COMPOSER_MEMORY_LIMIT=-1 composer require 'drupal/webform:^6.2@beta'
- name: Ensure Webform ^6.0
if: ${{ matrix.drupal != '10.0.*' }}
run: |
cd ~/drupal
#COMPOSER_MEMORY_LIMIT=-1 composer require cweagans/composer-patches
#jq '.extra.patches = {"drupal/webform": {"Regression": "https://www.drupal.org/files/issues/2021-12-13/3254028-2.patch"}}' composer.json > temp.json && mv temp.json composer.json
COMPOSER_MEMORY_LIMIT=-1 composer require 'drupal/webform:6.x-dev@dev'
COMPOSER_MEMORY_LIMIT=-1 composer require 'drupal/webform:^6.2'
- name: Install webform_civicrm
run: |
cd ~/drupal
Expand All @@ -134,6 +134,12 @@ jobs:
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: |
Expand All @@ -145,51 +151,63 @@ jobs:
./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 from git
if: ${{ matrix.drupal == '10.0.*' }}
- name: Download Civi extensions
run: |
mkdir -p ~/drupal/web/sites/default/files/civicrm/ext
cd ~/drupal/web/sites/default/files/civicrm/ext
/home/runner/civicrm-cv/cv api3 Extension.download install=0 key=com.aghstrategies.uscounties
# Let's get latest git versions of these
git clone https://lab.civicrm.org/extensions/mjwshared.git
git clone https://lab.civicrm.org/extensions/firewall.git
git clone https://lab.civicrm.org/extensions/stripe.git
git clone https://github.com/iATSPayments/com.iatspayments.civicrm.git
- name: Download Civi extensions normal
if: ${{ matrix.drupal != '10.0.*' }}
run: |
mkdir -p ~/drupal/web/sites/default/files/civicrm/ext
cd ~/drupal/web/sites/default/files/civicrm/ext
# Normally we'll just let civi decide which version to download.
# 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
- uses: nanasess/setup-chromedriver@master
with:
# temporary to match downgraded chrome
chromedriver-version: '127.0.6533.119'
- name: Run chromedriver
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 $BROWSERTEST_OUTPUT_DIRECTORY
mkdir -p $BROWSERTEST_OUTPUT_DIRECTORY
cd ~/drupal/web
../vendor/bin/phpunit -c core modules/contrib/webform_civicrm
../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","chromeOptions":{"args":["--disable-gpu", "--no-sandbox", "--headless"]}}, "http://127.0.0.1:9515"]'
BROWSERTEST_OUTPUT_DIRECTORY: '${{ runner.temp }}/browser_output'
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
- uses: actions/upload-artifact@v3
- 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: phpunit_browser_output
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
16 changes: 8 additions & 8 deletions js/jquery.tokeninput.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@
hiddenInput.val("");
var li_data = $(input).data("settings").prePopulate || hiddenInput.data("pre");

if ($(input).data("settings").processPrePopulate && $.isFunction($(input).data("settings").onResult)) {
if ($(input).data("settings").processPrePopulate && (typeof $(input).data("settings").onResult === "function")) {
li_data = $(input).data("settings").onResult.call(hiddenInput, li_data);
}

Expand Down Expand Up @@ -581,14 +581,14 @@
}

function add_freetagging_tokens() {
var value = $.trim(input_box.val());
var value = input_box.val().trim();
var tokens = value.split($(input).data("settings").tokenDelimiter);
$.each(tokens, function(i, token) {
if (!token) {
return;
}

if ($.isFunction($(input).data("settings").onFreeTaggingAdd)) {
if (typeof $(input).data("settings").onFreeTaggingAdd === "function") {
token = $(input).data("settings").onFreeTaggingAdd.call(hiddenInput, token);
}
var object = {};
Expand Down Expand Up @@ -684,7 +684,7 @@
hide_dropdown();

// Execute the onAdd callback if defined
if($.isFunction(callback)) {
if (typeof callback === "function") {
callback.call(hiddenInput,item);
}
}
Expand Down Expand Up @@ -774,7 +774,7 @@
}

// Execute the onDelete callback if defined
if($.isFunction(callback)) {
if (typeof callback === "function") {
callback.call(hiddenInput,token_data);
}
}
Expand Down Expand Up @@ -973,7 +973,7 @@
var cache_key = query + computeURL();
var cached_results = cache.get(cache_key);
if (cached_results) {
if ($.isFunction($(input).data("settings").onCachedResult)) {
if (typeof $(input).data("settings").onCachedResult === "function") {
cached_results = $(input).data("settings").onCachedResult.call(hiddenInput, cached_results);
}
populateDropdown(query, cached_results);
Expand Down Expand Up @@ -1022,7 +1022,7 @@
// Attach the success callback
ajax_params.success = function(results) {
cache.add(cache_key, $(input).data("settings").jsonContainer ? results[$(input).data("settings").jsonContainer] : results);
if($.isFunction($(input).data("settings").onResult)) {
if (typeof $(input).data("settings").onResult === "function") {
results = $(input).data("settings").onResult.call(hiddenInput, results);
}

Expand All @@ -1046,7 +1046,7 @@
});

cache.add(cache_key, results);
if($.isFunction($(input).data("settings").onResult)) {
if (typeof $(input).data("settings").onResult === "function") {
results = $(input).data("settings").onResult.call(hiddenInput, results);
}
populateDropdown(query, results);
Expand Down
23 changes: 2 additions & 21 deletions js/webform_civicrm_admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ var wfCiviAdmin = (function (D, $, once) {
if ($('select[name$="_contact_sub_type[]"]', context).val()) {
var first = true;
$('select[name$="_contact_sub_type[]"] option:selected', context).each(function() {
label += (first ? ' (' : ', ') + $.trim($(this).text());
label += (first ? ' (' : ', ') + $(this).text().trim();
first = false;
});
label += ')';
Expand Down Expand Up @@ -325,7 +325,7 @@ var wfCiviAdmin = (function (D, $, once) {
$(once('wf-civi', 'details#edit-additional-options', context)).drupalSetSummary(function (context) {
var label = [];
$(':checked', context).each(function() {
label.push($.trim($(this).siblings('label').contents().first().text()));
label.push($(this).siblings('label').contents().first().text().trim());
});
return label.join(', ') || Drupal.t('- None -');
});
Expand Down Expand Up @@ -500,25 +500,6 @@ var wfCiviAdmin = (function (D, $, once) {
changeContactLabel.call(this);
});

// Contribution honoree fields
$(once('crm-contrib', 'select[name$=contribution_honor_contact_id]', context)).change(function() {
if ($(this).val() == '0') {
$('.form-item-civicrm-1-contribution-1-contribution-honor-type-id').hide();
}
else {
$('.form-item-civicrm-1-contribution-1-contribution-honor-type-id').show();
}
}).change();
$(once('crm-contrib', 'select[name$=contribution_honor_type_id]', context)).change(function() {
var $label = $('.form-item-civicrm-1-contribution-1-contribution-honor-contact-id label');
if ($(this).val() == 'create_civicrm_webform_element') {
$label.html(Drupal.t('In Honor/Memory of'));
}
else {
$label.html($('option:selected', this).html());
}
}).change();

// Membership constraints
$(once('crm-mem-date', 'select[name$=_membership_num_terms]', context)).change(function(e, type) {
var $dateWrappers = $(this).parent().siblings('[class$="-date"]').not('[class$="-status-override-end-date"]');
Expand Down
23 changes: 14 additions & 9 deletions js/webform_civicrm_contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,22 @@
hintText: field.data('search-prompt'),
noResultsText: field.data('none-prompt'),
resultsFormatter: formatChoices,
searchingText: "Searching..."
searchingText: "Searching...",
enableHTML: true
};
wfCivi.existingInit(
field,
field.data('civicrm-contact'),
field.data('form-id'),
autocompleteUrl,
toHide,
tokenValues
);
}
else {
var tokenValues = false;
}

wfCivi.existingInit(
field,
field.data('civicrm-contact'),
field.data('form-id'),
autocompleteUrl,
toHide,
tokenValues
);

field.change(function () {
wfCivi.existingSelect(
Expand Down
Loading

0 comments on commit 5d7a2a8

Please sign in to comment.