Skip to content

Commit

Permalink
Issue #155: Run tests on pull requests.
Browse files Browse the repository at this point in the history
  • Loading branch information
quicksketch committed Oct 20, 2023
1 parent 25f701a commit fa37b62
Show file tree
Hide file tree
Showing 42 changed files with 164 additions and 180 deletions.
13 changes: 13 additions & 0 deletions .github/misc/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<VirtualHost *:80>
# Variables in this file will be substituted in step "Setup Apache".
DocumentRoot _PWD

<Directory _PWD>
AllowOverride All
Require all granted
</Directory>

<FilesMatch ".+\.php$">
SetHandler "proxy:unix:/run/php/php_PHP_V-fpm.sock|fcgi://localhost"
</FilesMatch>
</VirtualHost>
8 changes: 8 additions & 0 deletions .github/misc/settings.local.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
/**
* @file
* Custom settings for test runs.
*/

// Never send telemetry data.
$settings['telemetry_enabled'] = FALSE;
59 changes: 59 additions & 0 deletions .github/workflows/functional-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Functional Tests
on: [pull_request]
jobs:
simpletest:
name: Run Simpletest
runs-on: ubuntu-20.04
steps:
- name: Setup env
run: |
echo "REPO_NAME=${PWD##*/}" >> $GITHUB_ENV
echo 'USE_PHP_V=8.2' >> $GITHUB_ENV
- name: Install MariaDB
uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: 'mariadb-10.5'
root-password: 'root'
auto-start: true

- name: Verify setup and create database
run: |
echo -e '[client]\nuser = root\npassword = root\nhost = 127.0.0.1' > ~/.my.cnf
mysql -e 'SELECT version()\G'
mysql -e 'CREATE DATABASE backdrop;'
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.USE_PHP_V }}
coverage: none

- name: Checkout Backdrop core
uses: actions/checkout@v3
with:
repository: backdrop/backdrop

- name: Checkout module
uses: actions/checkout@v3
with:
path: modules/${{ env.REPO_NAME }}

- name: Setup Apache
run: |
sudo cp -f modules/${{ env.REPO_NAME }}/.github/misc/default.conf /etc/apache2/sites-available/000-default.conf
sudo sed -i -e "s?_PWD?$PWD?g" -e "s/_PHP_V/${{ env.USE_PHP_V }}/g" /etc/apache2/sites-available/000-default.conf
sudo apt-get install libapache2-mod-fcgid
sudo a2enmod rewrite proxy fcgid proxy_fcgi
sudo systemctl start apache2.service
sudo sed -i -e 's/user = www-data/user = runner/' /etc/php/${{ env.USE_PHP_V }}/fpm/pool.d/www.conf
sudo sed -i -e 's/listen.owner = www-data/listen.owner = runner/' /etc/php/${{ env.USE_PHP_V }}/fpm/pool.d/www.conf
sudo systemctl restart php${{ env.USE_PHP_V }}-fpm.service
- name: Install Backdrop
run: |
cp modules/${{ env.REPO_NAME }}/.github/misc/settings.local.php .
core/scripts/install.sh --db-url=mysql://root:[email protected]/backdrop
- name: Run functional tests
run: core/scripts/run-tests.sh --force --directory=modules/${{ env.REPO_NAME }} --verbose --color --concurrency=3 --cache --group Metatag 2>&1
2 changes: 2 additions & 0 deletions metatag_app_links/tests/metatag_app_links.tags.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Tests that each of the Metatag App Links tags work correctly.
*/

include_once __DIR__ . '/metatag.tags.test';

class MetatagAppLinksTagsTest extends MetatagTagsTestBase {

/**
Expand Down
2 changes: 2 additions & 0 deletions metatag_devel/tests/metatag_devel.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Tests for the Metatag Devel module.
*/

include_once __DIR__ . '/../../tests/metatag.helper.test';

class MetatagDevelest extends MetatagTestHelper {

/**
Expand Down
3 changes: 3 additions & 0 deletions metatag_facebook/tests/metatag_facebook.tags.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
* @file
* Tests that each of the Metatag Facebook tags work correctly.
*/

include_once __DIR__ . '/../../tests/metatag.tags.test';

class MetatagFacebookTagsTest extends MetatagTagsTestBase {

/**
Expand Down
3 changes: 3 additions & 0 deletions metatag_facebook/tests/metatag_facebook.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
* @file
* Tests for the Metatag Facebook module.
*/

include_once __DIR__ . '/../../tests/metatag.helper.test';

class MetatagFacebookTest extends MetatagTestHelper {

/**
Expand Down
2 changes: 2 additions & 0 deletions metatag_favicons/tests/metatag_favicons.tags.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Tests that each of the Metatag Favicons tags work correctly.
*/

include_once __DIR__ . '/../../tests/metatag.tags.test';

class MetatagFaviconsTagsTest extends MetatagTagsTestBase {

/**
Expand Down
2 changes: 2 additions & 0 deletions metatag_favicons/tests/metatag_favicons.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Tests for the Metatag Favicons module.
*/

include_once __DIR__ . '/../../tests/metatag.helper.test';

class MetatagFaviconsTest extends MetatagTestHelper {

/**
Expand Down
3 changes: 3 additions & 0 deletions metatag_opengraph/tests/metatag_opengraph.tags.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
* @file
* Tests that each of the Metatag OpenGraph tags work correctly.
*/

include_once __DIR__ . '/../../tests/metatag.tags.test';

class MetatagOpenGraphTagsTest extends MetatagTagsTestBase {

/**
Expand Down
3 changes: 3 additions & 0 deletions metatag_opengraph/tests/metatag_opengraph.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
* @file
* Tests for the Metatag OpenGraph module.
*/

include_once __DIR__ . '/../../tests/metatag.helper.test';

class MetatagOpenGraphTest extends MetatagTestHelper {

/**
Expand Down
3 changes: 3 additions & 0 deletions metatag_twitter_cards/tests/metatag_twitter_cards.tags.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
* @file
* Tests that each of the Metatag Twitter Cards tags work correctly.
*/

include_once __DIR__ . '/../../tests/metatag.tags.test';

class MetatagTwitterCardsTagsTest extends MetatagTagsTestBase {

/**
Expand Down
3 changes: 3 additions & 0 deletions metatag_twitter_cards/tests/metatag_twitter_cards.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
* @file
* Tests for the Metatag Twitter Cards module.
*/

include_once __DIR__ . '/../../tests/metatag.helper.test';

class MetatagTwitterCardsTest extends MetatagTestHelper {
/**
* {@inheritdoc}
Expand Down
2 changes: 2 additions & 0 deletions metatag_verification/tests/metatag_verification.tags.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Tests that each of the Metatag Verification tags work correctly.
*/

include_once __DIR__ . '/../../tests/metatag.tags.test';

class MetatagVerificationTagsTest extends MetatagTagsTestBase {

/**
Expand Down
2 changes: 2 additions & 0 deletions metatag_verification/tests/metatag_verification.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Tests for the Metatag Verification module.
*/

include_once __DIR__ . '/../../tests/metatag.helper.test';

class MetatagVerificationTest extends MetatagTestHelper {

/**
Expand Down
2 changes: 2 additions & 0 deletions metatag_views/tests/metatag_views.i18n.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Tests for the Metatag module for the direct Views integration.
*/

include_once __DIR__ . '/../../tests/metatag.helper.test';

class MetatagViewsI18nTest extends MetatagTestHelper {
/**
* {@inheritdoc}
Expand Down
2 changes: 2 additions & 0 deletions metatag_views/tests/metatag_views.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Tests for the Metatag module for the direct Views integration.
*/

include_once __DIR__ . '/../../tests/metatag.helper.test';

class MetatagViewsTest extends MetatagTestHelper {
/**
* {@inheritdoc}
Expand Down
2 changes: 2 additions & 0 deletions tests/metatag.bulk_revert.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Tests for the Metatag module to ensure the bulk revert functionality works
*/

include_once __DIR__ . '/metatag.helper.test';

class MetatagBulkRevertTest extends MetatagTestHelper {
/**
* {@inheritdoc}
Expand Down
2 changes: 2 additions & 0 deletions tests/metatag.core_tag_removal.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Tests for the Metatag module to ensure removal of core tags works correctly.
*/

include_once __DIR__ . '/metatag.helper.test';

class MetatagCoreTagRemovalTest extends MetatagTestHelper {

/**
Expand Down
2 changes: 2 additions & 0 deletions tests/metatag.image.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Tests for the Metatag module to ensure image handling doesn't break.
*/

include_once __DIR__ . '/metatag.helper.test';

class MetatagCoreImageTest extends MetatagTestHelper {
/**
* {@inheritdoc}
Expand Down
2 changes: 2 additions & 0 deletions tests/metatag.locale.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Tests for the Metatag module to ensure Locale integration doesn't break.
*/

include_once __DIR__ . '/metatag.helper.test';

class MetatagCoreLocaleTest extends MetatagTestHelper {

/**
Expand Down
2 changes: 2 additions & 0 deletions tests/metatag.node.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Tests for the Metatag module and node entities.
*/

include_once __DIR__ . '/metatag.helper.test';

class MetatagCoreNodeTest extends MetatagTestHelper {

/**
Expand Down
2 changes: 2 additions & 0 deletions tests/metatag.node.with_i18n.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Tests for the Metatag module to ensure i18n integration doesn't break.
*/

include_once __DIR__ . '/metatag.helper.test';

class MetatagCoreNodeWithI18nTest extends MetatagTestHelper {
/**
* {@inheritdoc}
Expand Down
2 changes: 2 additions & 0 deletions tests/metatag.output_caching.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* @file
*/

include_once __DIR__ . '/metatag.helper.test';

/**
* Tests for the Metatag module's output caching
*/
Expand Down
2 changes: 2 additions & 0 deletions tests/metatag.string_handling.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Contains the tests for Metatag's string handling.
*/

include_once __DIR__ . '/metatag.helper.test';

/**
* Tests the Metatag string handling.
*/
Expand Down
2 changes: 2 additions & 0 deletions tests/metatag.string_handling_with_i18n.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Contains the tests for Metatag's string handling.
*/

include_once __DIR__ . '/metatag.string_handling.test';

/**
* Tests the Metatag string handling.
*/
Expand Down
6 changes: 4 additions & 2 deletions tests/metatag.tags.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Tests that each of the Metatag base tags work correctly.
*/

include_once __DIR__ . '/metatag.helper.test';

class MetatagTagsTestBase extends MetatagTestHelper {

/**
Expand Down Expand Up @@ -103,9 +105,9 @@ class MetatagTagsTestBase extends MetatagTestHelper {
}

/**
*
* Tests the built-in tags provided directly by metatag.module.
*/
class MetatagTagsTest extends MetatagTagsTestBase {
class MetatagBuiltInTagsTest extends MetatagTagsTestBase {

/**
* {@inheritdoc}
Expand Down
2 changes: 2 additions & 0 deletions tests/metatag.term.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Tests for the Metatag module and taxonomy term entities.
*/

include_once __DIR__ . '/metatag.helper.test';

class MetatagCoreTermTest extends MetatagTestHelper {

/**
Expand Down
2 changes: 2 additions & 0 deletions tests/metatag.term.with_i18n.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Tests for the Metatag module to ensure i18n integration doesn't break.
*/

include_once __DIR__ . '/metatag.helper.test';

class MetatagCoreTermWithI18nTest extends MetatagTestHelper {
/**
* {@inheritdoc}
Expand Down
4 changes: 2 additions & 2 deletions tests/metatag.tests.info
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ description = Unit tests for meta tags (sort-of)
group = Metatag
file = metatag.unit.test

[MetatagTagsTestBase]
name = Metatag base tag tests
[MetatagBuiltInTagsTest]
name = Metatag built-in tags tests
description = Tests that each of the Metatag base tags work correctly.
group = Metatag
file = metatag.tags.test
Expand Down
2 changes: 2 additions & 0 deletions tests/metatag.unit.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Unit tests for the Metatag module.
*/

include_once __DIR__ . '/metatag.helper.test';

/**
* @todo These aren't really unit tests, we might need to fix that.
*/
Expand Down
2 changes: 2 additions & 0 deletions tests/metatag.user.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Tests for the Metatag module and user entities.
*/

include_once __DIR__ . '/metatag.helper.test';

class MetatagCoreUserTest extends MetatagTestHelper {

/**
Expand Down
2 changes: 2 additions & 0 deletions tests/metatag.with_i18n_config.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Tests for the Metatag module to ensure i18n integration doesn't break.
*/

include_once __DIR__ . '/metatag.helper.test';

class MetatagCoreWithI18nConfigTest extends MetatagTestHelper {
/**
* {@inheritdoc}
Expand Down
2 changes: 2 additions & 0 deletions tests/metatag.with_i18n_disabled.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Tests for the Metatag module to ensure i18n integration doesn't break.
*/

include_once __DIR__ . '/metatag.helper.test';

class MetatagCoreWithI18nDisabledTest extends MetatagTestHelper {
/**
* {@inheritdoc}
Expand Down
2 changes: 2 additions & 0 deletions tests/metatag.with_i18n_output.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Tests for the Metatag module to ensure i18n integration doesn't break.
*/

include_once __DIR__ . '/metatag.helper.test';

class MetatagCoreWithI18nOutputTest extends MetatagTestHelper {
/**
* {@inheritdoc}
Expand Down
2 changes: 2 additions & 0 deletions tests/metatag.with_me.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Tests for the Metatag module for Me module integration.
*/

include_once __DIR__ . '/metatag.helper.test';

class MetatagCoreWithMeTest extends MetatagTestHelper {

/**
Expand Down
Loading

0 comments on commit fa37b62

Please sign in to comment.