diff --git a/.gitattributes b/.gitattributes index eebd934..5392ca4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,7 +1,5 @@ /tests/ export-ignore -/travis/ export-ignore .github/ export-ignore -.travis.yml export-ignore .gitignore export-ignore .gitattributes export-ignore phpunit.xml.dist export-ignore diff --git a/build.xml b/build.xml index 4b44a2f..54f1401 100644 --- a/build.xml +++ b/build.xml @@ -15,10 +15,8 @@ --> - - diff --git a/config/skeletons.yml b/config/skeletons.yml index 4ba3583..50ae61e 100644 --- a/config/skeletons.yml +++ b/config/skeletons.yml @@ -155,7 +155,7 @@ services: - 'tests' - false - [] - - ['tests/controller/main_test.php', 'tests/dbal/fixtures/config.xml', 'tests/dbal/simple_test.php', 'tests/functional/view_test.php', 'phpunit.xml.dist'] + - ['tests/controller/main_test.php', 'tests/dbal/fixtures/config.xml', 'tests/dbal/simple_test.php', 'tests/functional/view_test.php', 'phpunit.xml.dist', '.github/workflows/tests.yml'] - 'TEST_DEPLOY' tags: - { name: phpbb.skeleton.ext.skeleton } @@ -165,19 +165,19 @@ services: arguments: - 'githubactions' - false - - ['tests'] + - [] - ['.github/workflows/tests.yml'] - 'TEST_DEPLOY' tags: - { name: phpbb.skeleton.ext.skeleton } - phpbb.skeleton.ext.skeleton.travis: + phpbb.skeleton.ext.skeleton.githubactions_custom: class: phpbb\skeleton\skeleton arguments: - - 'travis' + - 'githubactions_custom' - false - - ['tests'] - - ['travis/prepare-phpbb.sh', '.travis.yml'] + - [] + - ['.github/workflows/tests.yml'] - 'TEST_DEPLOY' tags: - { name: phpbb.skeleton.ext.skeleton } diff --git a/helper/packager.php b/helper/packager.php index 237a402..dd6df41 100644 --- a/helper/packager.php +++ b/helper/packager.php @@ -95,7 +95,7 @@ public function get_component_dialog_values() $components[$service->get_name()] = [ 'default' => $service->get_default(), 'dependencies' => $service->get_dependencies(), - 'files' => $service->get_files(), + 'files' => $service->get_files(), 'group' => $service->get_group(), ]; } diff --git a/language/en/common.php b/language/en/common.php index b1b6758..4744f0b 100644 --- a/language/en/common.php +++ b/language/en/common.php @@ -24,8 +24,9 @@ $lang = array_merge($lang, [ 'CLI_DESCRIPTION_SKELETON_CREATE' => 'Create a basic skeleton extension', 'PHPBB_SKELETON_EXT' => 'Skeleton Extension', - 'PHPBB_CREATE_SKELETON_EXT' => 'Create skeleton extension', - 'PHPBB_SKELETON_EXT_DOCS' => 'Read the Documentation', + 'PHPBB_CREATE_SKELETON_EXT' => 'Create a Skeleton Extension', + 'PHPBB_CREATE_SKELETON_EXPLAIN' => 'Generate your extension’s foundation in seconds. No more setting up files by hand — Skeleton builds it all for you, with clean, fully documented templates based on phpBB’s best practices. Before you begin, be sure to review the 📖 [Skeleton Extension Documentation], 🛡️ [Extension Validation Rules], and 🛠️ [Coding Guidelines].', + 'PHPBB_SKELETON_EXT_HELP' => 'Learn More', 'EXTENSION_CLI_SKELETON_SUCCESS' => "Extension created successfully.\nCopy the extension from `store/tmp-ext/` into the `ext/` folder.", 'SKELETON_CLI_COMPOSER_QUESTIONS' => 'Enter composer.json details (hit enter to leave an option empty)', @@ -119,12 +120,12 @@ 'SKELETON_QUESTION_COMPONENT_TESTS' => 'Create sample PHPUnit tests?', 'SKELETON_QUESTION_COMPONENT_TESTS_UI' => 'Tests (PHPUnit)', 'SKELETON_QUESTION_COMPONENT_TESTS_EXPLAIN' => 'Unit tests can test an extension to verify that specific portions of its source code work properly. This helps ensure basic code integrity and prevents regressions as an extension is being developed and debugged.', - 'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS' => 'Create a workflow for test execution using Github Actions?', - 'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_UI' => 'Github Actions CI configuration', - 'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_EXPLAIN' => 'Github Actions allow you to run PHPUnit tests on your GitHub repository. This will generate the workflow YML needed to begin testing your phpBB extension with each commit and pull request. Note that this workflow will be inside a hidden folder (.github/workflows).', - 'SKELETON_QUESTION_COMPONENT_TRAVIS' => 'Create a sample for test execution on Travis CI?', - 'SKELETON_QUESTION_COMPONENT_TRAVIS_UI' => 'Travis CI configuration', - 'SKELETON_QUESTION_COMPONENT_TRAVIS_EXPLAIN' => 'Travis CI is a platform for running your PHPUnit tests on a GitHub repository. This will generate the basic config and script files needed to begin testing your phpBB extension with each commit and pull request.', + 'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS' => 'Create a GitHub Actions workflow to run tests in your repository?', + 'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_UI' => 'Github Actions workflow', + 'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_EXPLAIN' => 'Creates a GitHub Actions workflow to run PHPUnit tests on your repository using a framework maintained by phpBB. The workflow YML file will be placed in the .github/workflows folder and will run tests automatically on each commit and pull request.', + 'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_CUSTOM' => 'Create a fully customisable GitHub Actions workflow? (Select this if you plan to modify jobs or steps.)', + 'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_CUSTOM_UI' => 'Github Actions custom workflow', + 'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_CUSTOM_EXPLAIN' => 'Creates a customisable GitHub Actions workflow to run PHPUnit tests on your repository. This workflow is flexible to fit your specific testing needs and will be saved in the .github/workflows folder, triggered by each commit and pull request. Choosing this will override the non-customisable workflow.', 'SKELETON_QUESTION_COMPONENT_BUILD' => 'Create a sample build script for phing?', 'SKELETON_QUESTION_COMPONENT_BUILD_UI' => 'Build script (phing)', 'SKELETON_QUESTION_COMPONENT_BUILD_EXPLAIN' => 'A phing build script is generated for your extension which can be used to generate build packages to help simplify the release or deployment processes.', diff --git a/skeleton/.github/workflows/tests.yml.twig b/skeleton/.github/workflows/tests.yml.twig index 2ee6413..f6fb211 100644 --- a/skeleton/.github/workflows/tests.yml.twig +++ b/skeleton/.github/workflows/tests.yml.twig @@ -1,5 +1,6 @@ name: Tests +{% if COMPONENT.githubactions_custom %} env: EXTNAME: {{ EXTENSION.vendor_name }}/{{ EXTENSION.extension_name }} # Your extension vendor/package name SNIFF: 1 # Run code sniffer on your code? 1 or 0 @@ -336,9 +337,9 @@ jobs: - php: '7.2' db: "mcr.microsoft.com/mssql/server:2019-CU27-ubuntu-20.04" db_alias: 'MSSQL 2019' - - php: '7.2' - db: "mcr.microsoft.com/mssql/server:2022-CU13-ubuntu-22.04" - db_alias: 'MSSQL 2022' + - php: '7.2' + db: "mcr.microsoft.com/mssql/server:2022-CU13-ubuntu-22.04" + db_alias: 'MSSQL 2022' name: PHP ${{ '{{' }} matrix.php }} - ${{ '{{' }} matrix.db_alias != '' && matrix.db_alias || matrix.db }} @@ -424,3 +425,34 @@ jobs: run: phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml --bootstrap ./tests/bootstrap.php working-directory: ./phpBB3 # END Other Tests Job +{% else %} +on: + push: + branches: # Run tests when commits are pushed to these branches in your repo + - main + - master + - develop + - dev/* + pull_request: # Run tests when pull requests are made on these branches in your repo + branches: + - main + - master + - develop + - dev/* + +jobs: + call-tests: + uses: phpbb-extensions/test-framework/.github/workflows/tests.yml@3.3.x + with: + EXTNAME: {{ EXTENSION.vendor_name }}/{{ EXTENSION.extension_name }} # Your extension vendor/package name + SNIFF: 1 # Run code sniffer on your code? 1 or 0 + IMAGE_ICC: 1 # Run icc profile sniffer on your images? 1 or 0 + EPV: 1 # Run EPV (Extension Pre Validator) on your code? 1 or 0 + EXECUTABLE_FILES: 1 # Run check for executable files? 1 or 0 + CODECOV: 0 # Run code coverage via codecov? 1 or 0 + PHPBB_BRANCH: 3.3.x # The phpBB branch to run tests on + secrets: + CODECOV_TOKEN: ${{ '{{' }} secrets.CODECOV_TOKEN }} # Do not change this + +# See the README for full details and setup instructions: https://github.com/phpbb-extensions/test-framework +{% endif %} diff --git a/skeleton/.travis.yml.twig b/skeleton/.travis.yml.twig deleted file mode 100644 index 305d8f5..0000000 --- a/skeleton/.travis.yml.twig +++ /dev/null @@ -1,179 +0,0 @@ -language: php -{% if skeleton_version_compare(REQUIREMENTS.phpbb_version_max, "3.2", "<") %} {# for phpBB 3.1.x #} -dist: trusty - -matrix: - include: - - php: 5.3.3 - env: DB=mysqli - - php: 5.3 - env: DB=mysqli # MyISAM - - php: 5.4 - env: DB=mysqli - - php: 5.4 - env: DB=mysql - - php: 5.4 - env: DB=mariadb - - php: 5.4 - env: DB=postgres - - php: 5.4 - env: DB=sqlite3 - - php: 5.5 - env: DB=mysqli - - php: 5.6 - env: DB=mysqli - - php: hhvm - env: DB=mysqli - allow_failures: - - php: hhvm - fast_finish: true - -env: - global: - - EXTNAME="{{ EXTENSION.vendor_name }}/{{ EXTENSION.extension_name }}" # CHANGE name of the extension HERE - - SNIFF="1" # Should we run code sniffer on your code? - - IMAGE_ICC="1" # Should we run icc profile sniffer on your images? - - EPV="1" # Should we run EPV (Extension Pre Validator) on your code? - - PHPBB_BRANCH="3.1.x" - -branches: - only: - - master - - /^\d+(\.\d+)?\.x$/ - -install: - - travis/prepare-phpbb.sh $PHPBB_BRANCH - - cd ../../phpBB3 - - travis/prepare-extension.sh $EXTNAME $PHPBB_BRANCH - - travis/setup-phpbb.sh $DB $TRAVIS_PHP_VERSION - - sh -c "if [ '$EPV' != '0' -a '$TRAVIS_PHP_VERSION' = '5.5' -a '$DB' = 'mysqli' ]; then cd phpBB; composer remove sami/sami --dev --no-interaction; composer require phpbb/epv:dev-master --dev --no-interaction --ignore-platform-reqs; cd ../; fi" - -before_script: - - travis/setup-database.sh $DB $TRAVIS_PHP_VERSION - -script: - - sh -c "if [ '$SNIFF' != '0' ]; then travis/ext-sniff.sh $DB $TRAVIS_PHP_VERSION $EXTNAME; fi" - - sh -c "if [ '$IMAGE_ICC' != '0' ]; then travis/check-image-icc-profiles.sh $DB $TRAVIS_PHP_VERSION; fi" - - phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/travis/phpunit-$DB-travis.xml --bootstrap ./tests/bootstrap.php - - sh -c "if [ '$EPV' != '0' -a '$TRAVIS_PHP_VERSION' = '5.5' -a '$DB' = 'mysqli' ]; then phpBB/vendor/bin/EPV.php run --dir='phpBB/ext/$EXTNAME/'; fi" -{% elseif skeleton_version_compare(REQUIREMENTS.phpbb_version_max, "3.3", "<") %}{# for phpBB > 3.2.x #} -dist: trusty - -matrix: - include: - - php: 5.5 - env: DB=none;NOTESTS=1 - - php: 5.4 - env: DB=mysqli # MyISAM - - php: 5.4 - env: DB=mysql - - php: 5.4 - env: DB=mariadb - - php: 5.4 - env: DB=postgres - - php: 5.4 - env: DB=sqlite3 - - php: 5.5 - env: DB=mysqli - - php: 5.6 - env: DB=mysqli - - php: 7.0 - env: DB=mysqli - - php: 7.1 - env: DB=mysqli - - php: 7.2 - env: DB=mysqli - - php: nightly - env: DB=mysqli - allow_failures: - - php: nightly - fast_finish: true - -env: - global: - - EXTNAME="{{ EXTENSION.vendor_name }}/{{ EXTENSION.extension_name }}" # CHANGE name of the extension HERE - - SNIFF="1" # Should we run code sniffer on your code? - - IMAGE_ICC="1" # Should we run icc profile sniffer on your images? - - EPV="1" # Should we run EPV (Extension Pre Validator) on your code? - - PHPBB_BRANCH="3.2.x" - -branches: - only: - - master - - /^\d+(\.\d+)?\.x$/ - -install: - - travis/prepare-phpbb.sh $PHPBB_BRANCH - - cd ../../phpBB3 - - travis/prepare-extension.sh $EXTNAME $PHPBB_BRANCH - - travis/setup-phpbb.sh $DB $TRAVIS_PHP_VERSION $NOTESTS - - sh -c "if [ '$EPV' = '1' -a '$NOTESTS' = '1' ]; then cd phpBB; composer remove sami/sami --dev --no-interaction; composer require phpbb/epv:dev-master --dev --no-interaction --ignore-platform-reqs; cd ../; fi" - -before_script: - - travis/setup-database.sh $DB $TRAVIS_PHP_VERSION $NOTESTS - -script: - - sh -c "if [ '$SNIFF' != '0' ]; then travis/ext-sniff.sh $DB $TRAVIS_PHP_VERSION $EXTNAME $NOTESTS; fi" - - sh -c "if [ '$IMAGE_ICC' != '0' ]; then travis/check-image-icc-profiles.sh $DB $TRAVIS_PHP_VERSION $NOTESTS; fi" - - sh -c "if [ '$EPV' != '0' -a '$NOTESTS' = '1' ]; then phpBB/vendor/bin/EPV.php run --dir='phpBB/ext/$EXTNAME/'; fi" - - sh -c "if [ '$NOTESTS' != '1' ]; then phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/travis/phpunit-$DB-travis.xml --bootstrap ./tests/bootstrap.php; fi" -{% else %} -dist: xenial - -matrix: - include: - - php: 7.1 - env: DB=none;NOTESTS=1 - - php: 7.1 - env: DB=mariadb - - php: 7.1 - env: DB=postgres - - php: 7.1 - env: DB=sqlite3 - - php: 7.1 - env: DB=mysqli # MyISAM - - php: 7.2 - env: DB=mysqli - - php: 7.3 - env: DB=mysqli - - php: 7.4 - env: DB=mysqli - - php: nightly - env: DB=mysqli - allow_failures: - - php: nightly - fast_finish: true - -env: - global: - - EXTNAME="{{ EXTENSION.vendor_name }}/{{ EXTENSION.extension_name }}" # CHANGE name of the extension HERE - - SNIFF="1" # Should we run code sniffer on your code? - - IMAGE_ICC="1" # Should we run icc profile sniffer on your images? - - EPV="1" # Should we run EPV (Extension Pre Validator) on your code? - - PHPBB_BRANCH="3.3.x" - -branches: - only: - - master - - /^\d+(\.\d+)?\.x$/ - -services: - - postgresql - - mysql - -install: - - travis/prepare-phpbb.sh $PHPBB_BRANCH - - cd ../../phpBB3 - - travis/prepare-extension.sh $EXTNAME $PHPBB_BRANCH - - travis/setup-phpbb.sh $DB $TRAVIS_PHP_VERSION $NOTESTS - - sh -c "if [ '$EPV' = '1' -a '$NOTESTS' = '1' ]; then cd phpBB; composer require phpbb/epv:dev-master --dev --no-interaction --ignore-platform-reqs; cd ../; fi" - -before_script: - - travis/setup-database.sh $DB $TRAVIS_PHP_VERSION $NOTESTS - -script: - - sh -c "if [ '$SNIFF' != '0' ]; then travis/ext-sniff.sh $DB $TRAVIS_PHP_VERSION $EXTNAME $NOTESTS; fi" - - sh -c "if [ '$IMAGE_ICC' != '0' ]; then travis/check-image-icc-profiles.sh $DB $TRAVIS_PHP_VERSION $NOTESTS; fi" - - sh -c "if [ '$EPV' != '0' -a '$NOTESTS' = '1' ]; then phpBB/vendor/bin/EPV.php run --dir='phpBB/ext/$EXTNAME/'; fi" - - sh -c "if [ '$NOTESTS' != '1' ]; then phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/travis/phpunit-$DB-travis.xml --bootstrap ./tests/bootstrap.php; fi" -{% endif %} diff --git a/skeleton/README.md.twig b/skeleton/README.md.twig index 90e5d5f..e14d56c 100644 --- a/skeleton/README.md.twig +++ b/skeleton/README.md.twig @@ -9,8 +9,8 @@ Go to "ACP" > "Customise" > "Extensions" and enable the "{{ EXTENSION.extension_ {% if COMPONENT.tests %} ## Tests and Continuous Integration -We use {% if COMPONENT.githubactions %}Github Actions {% endif %}{% if COMPONENT.githubactions and COMPONENT.travis %}and {% endif %}{% if COMPONENT.travis %}Travis-CI {% endif %}as a continuous integration server and phpunit for our unit testing. See more information on the [phpBB Developer Docs](https://area51.phpbb.com/docs/dev/master/testing/index.html). -To run the tests locally, you need to install phpBB from its Git repository. Afterwards run the following command from the phpBB Git repository's root: +{% if COMPONENT.githubactions %}We use GitHub Actions as a continuous integration server and phpunit for our unit testing..{% endif %} +To run the tests locally, you need to install phpBB from its Git repository. Afterward run the following command from the phpBB Git repository's root: Windows: @@ -20,6 +20,9 @@ others: phpBB/vendor/bin/phpunit -c phpBB/ext/{{ EXTENSION.vendor_name }}/{{ EXTENSION.extension_name }}/phpunit.xml.dist + +See more information on the [phpBB Developer Docs](https://area51.phpbb.com/docs/dev/master/testing/index.html) + {% endif %} ## License diff --git a/skeleton/build.xml.twig b/skeleton/build.xml.twig index 4eeb469..58aacc8 100644 --- a/skeleton/build.xml.twig +++ b/skeleton/build.xml.twig @@ -25,11 +25,9 @@ --> - - diff --git a/skeleton/travis/prepare-phpbb.sh.twig b/skeleton/travis/prepare-phpbb.sh.twig deleted file mode 100644 index a2cc81c..0000000 --- a/skeleton/travis/prepare-phpbb.sh.twig +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# -# This file is part of the phpBB Forum Software package. -# -# @copyright (c) phpBB Limited -# @license GNU General Public License, version 2 (GPL-2.0) -# -# For full copyright and license information, please see -# the docs/CREDITS.txt file. -# -set -e -set -x - -BRANCH=$1 - -# Copy extension to a temp folder -mkdir ../../tmp -cp -R . ../../tmp -cd ../../ - -# Clone phpBB -git clone --depth=1 "git://github.com/phpbb/phpbb.git" "phpBB3" --branch="$BRANCH" diff --git a/styles/prosilver/template/skeleton_body.html b/styles/prosilver/template/skeleton_body.html index 12a5cc5..cb85f62 100644 --- a/styles/prosilver/template/skeleton_body.html +++ b/styles/prosilver/template/skeleton_body.html @@ -7,6 +7,7 @@

{{ lang('PHPBB_CREATE_SKELETON_EXT') }}

+

{{ lang('PHPBB_CREATE_SKELETON_EXPLAIN', 'https://area51.phpbb.com/docs/dev/3.3.x/extensions/skeleton_extension.html', 'https://www.phpbb.com/extensions/rules-and-policies/validation-policy/', 'https://area51.phpbb.com/docs/dev/master/development/index.html') }}

{% if ERROR %} @@ -19,7 +20,11 @@

{{ lang('PHPBB_CREATE_SKELETON_EXT') }}

-

{{ lang('PHPBB_SKELETON_EXT_DOCS') }}

+

+ + {{ lang('PHPBB_SKELETON_EXT_HELP') }} + +

{{ lang('SKELETON_TITLE_EXTENSION_INFO') }}

{% for extension in loops.extension %}
@@ -36,6 +41,11 @@

{{ lang('SKELETON_TITLE_EXTENSION_INFO') }}

+

+ + {{ lang('PHPBB_SKELETON_EXT_HELP') }} + +

{{ lang('SKELETON_TITLE_AUTHOR_INFO') }}

{% for author in loops.author %} @@ -61,6 +71,11 @@

{{ lang('SKELETON_TITLE_AUTHOR_INFO') }}

+

+ + {{ lang('PHPBB_SKELETON_EXT_HELP') }} + +

{{ lang('SKELETON_TITLE_REQUIREMENT_INFO') }}

{% for requirement in loops.requirement %}
@@ -77,13 +92,25 @@

{{ lang('SKELETON_TITLE_REQUIREMENT_INFO') }}

+

+ + {{ lang('PHPBB_SKELETON_EXT_HELP') }} + +

{{ lang('SKELETON_TITLE_COMPONENT_INFO') }}

{% for group in ['DATABASE', 'FRONT_END', 'BACK_END', 'CONTROL_PANELS', 'OTHER', 'TEST_DEPLOY'] %}

{{ lang('SKELETON_COMPONENT_GROUP_' ~ group) }}

{% for component in loops['component_' ~ group] %}
-
+
+ + + +
{% endfor %}
diff --git a/tests/console/create_test.php b/tests/console/create_test.php index bdd09f9..637fd50 100644 --- a/tests/console/create_test.php +++ b/tests/console/create_test.php @@ -185,7 +185,6 @@ public function get_questions() // 'SKELETON_QUESTION_COMPONENT_PERMISSIONS' => 'y', 'SKELETON_QUESTION_COMPONENT_TESTS' => 'y', 'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS' => 'y', -// 'SKELETON_QUESTION_COMPONENT_TRAVIS' => 'n', // 'SKELETON_QUESTION_COMPONENT_BUILD' => 'y', ]; }