Skip to content

Commit 5eaee83

Browse files
committed
Add GA reusable test framework
1 parent 78ba4f6 commit 5eaee83

File tree

3 files changed

+49
-3
lines changed

3 files changed

+49
-3
lines changed

config/skeletons.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,17 @@ services:
171171
tags:
172172
- { name: phpbb.skeleton.ext.skeleton }
173173

174+
phpbb.skeleton.ext.skeleton.githubactions_custom:
175+
class: phpbb\skeleton\skeleton
176+
arguments:
177+
- 'githubactions_custom'
178+
- false
179+
- ['tests']
180+
- ['.github/workflows/tests.yml']
181+
- 'TEST_DEPLOY'
182+
tags:
183+
- { name: phpbb.skeleton.ext.skeleton }
184+
174185
phpbb.skeleton.ext.skeleton.build:
175186
class: phpbb\skeleton\skeleton
176187
arguments:

language/en/common.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,12 @@
119119
'SKELETON_QUESTION_COMPONENT_TESTS' => 'Create sample PHPUnit tests?',
120120
'SKELETON_QUESTION_COMPONENT_TESTS_UI' => 'Tests (PHPUnit)',
121121
'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.',
122-
'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS' => 'Create a workflow for test execution using Github Actions?',
123-
'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_UI' => 'Github Actions CI configuration',
124-
'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).',
122+
'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS' => 'Create a GitHub Actions workflow using phpBB’s test framework?',
123+
'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_UI' => 'Github Actions workflow',
124+
'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_EXPLAIN' => 'Creates a GitHub Actions workflow to run PHPUnit tests on your repository using phpBB’s official test framework. The workflow YML file will be placed in the .github/workflows folder and will run tests automatically on each commit and pull request.',
125+
'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_CUSTOM' => 'Create a custom GitHub Actions workflow for test execution?',
126+
'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_CUSTOM_UI' => 'Github Actions custom workflow',
127+
'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.',
125128
'SKELETON_QUESTION_COMPONENT_BUILD' => 'Create a sample build script for phing?',
126129
'SKELETON_QUESTION_COMPONENT_BUILD_UI' => 'Build script (phing)',
127130
'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.',

skeleton/.github/workflows/tests.yml.twig

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: Tests
22

3+
{% if COMPONENT.githubactions_custom %}
34
env:
45
EXTNAME: {{ EXTENSION.vendor_name }}/{{ EXTENSION.extension_name }} # Your extension vendor/package name
56
SNIFF: 1 # Run code sniffer on your code? 1 or 0
@@ -424,3 +425,34 @@ jobs:
424425
run: phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml --bootstrap ./tests/bootstrap.php
425426
working-directory: ./phpBB3
426427
# END Other Tests Job
428+
{% else %}
429+
on:
430+
push:
431+
branches: # Run tests when commits are pushed to these branches in your repo
432+
- main
433+
- master
434+
- develop
435+
- dev/*
436+
pull_request: # Run tests when pull requests are made on these branches in your repo
437+
branches:
438+
- main
439+
- master
440+
- develop
441+
- dev/*
442+
443+
jobs:
444+
call-tests:
445+
uses: phpbb-extensions/test-framework/.github/workflows/[email protected]
446+
with:
447+
EXTNAME: {{ EXTENSION.vendor_name }}/{{ EXTENSION.extension_name }} # Your extension vendor/package name
448+
SNIFF: 1 # Run code sniffer on your code? 1 or 0
449+
IMAGE_ICC: 1 # Run icc profile sniffer on your images? 1 or 0
450+
EPV: 1 # Run EPV (Extension Pre Validator) on your code? 1 or 0
451+
EXECUTABLE_FILES: 1 # Run check for executable files? 1 or 0
452+
CODECOV: 0 # Run code coverage via codecov? 1 or 0
453+
PHPBB_BRANCH: 3.3.x # The phpBB branch to run tests on
454+
secrets:
455+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} # Do not change this
456+
457+
# See the README for full details and setup instructions: https://github.com/phpbb-extensions/test-framework
458+
{% endif %}

0 commit comments

Comments
 (0)