Skip to content

Commit 1f66dd9

Browse files
authored
Merge pull request #28 from iMattPro/experimental-3.3.x
More simplification for usage
2 parents 4c9b9af + 0b5ac5c commit 1f66dd9

File tree

2 files changed

+103
-25
lines changed

2 files changed

+103
-25
lines changed

.github/workflows/tests.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,15 @@ jobs:
277277
fi
278278
working-directory: ./phpBB3
279279

280+
- name: Setup Codecove.io Path Fix
281+
if: ${{ matrix.COVERAGE == '1' }}
282+
run: |
283+
if [ ! -f .github/codecov.yml ]; then
284+
mkdir -p .github
285+
echo "fixes:" > .github/codecov.yml
286+
echo " - \"/phpBB3/phpBB/ext/${EXTNAME}::\"" >> .github/codecov.yml
287+
fi
288+
280289
- name: Run unit tests
281290
env:
282291
DB: ${{steps.database-type.outputs.db}}

README.md

Lines changed: 94 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ This repository contains a pre-configured test workflow designed for phpBB exten
66

77
## Table of Contents
88

9-
- [Features](#-features)
10-
- 🚀 [How to Use](#-how-to-use)
11-
- 🛠 [Configuration Options](#-configuration-options)
12-
- 📊 [Code Coverage with Codecov](#-code-coverage-with-codecov)
9+
- [Features](#features)
10+
- [How to Use](#how-to-use)
11+
- [Configuration Options](#configuration-options)
12+
- [Configuration Examples](#configuration-examples)
1313

14-
## Features
14+
## Features
1515

1616
- Supports **PHP 7.2+** through **8.x**
1717
- Tests against multiple database engines
@@ -22,7 +22,7 @@ This repository contains a pre-configured test workflow designed for phpBB exten
2222
- Files with executable permissions
2323
- Code coverage reports via Codecov
2424

25-
## 🚀 How to Use
25+
## How to Use
2626

2727
On GitHub.com, go to your extension's repository, click **Add file → Create new file**, name it `.github/workflows/tests.yml`, add the workflow content shown below, and commit the file. Make sure to replace `acme/demo` with your actual extension vendor/package name, and optionally you may adjust any of the branch names and other checks.
2828

@@ -49,8 +49,6 @@ jobs:
4949
uses: phpbb-extensions/test-framework/.github/workflows/[email protected] # The phpBB branch to run tests with
5050
with:
5151
EXTNAME: acme/demo # Your extension vendor/package name
52-
secrets:
53-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} # Do not edit or remove this
5452
```
5553
5654
### Branches
@@ -71,7 +69,7 @@ Use the test-framework branch that matches the phpBB version you're developing f
7169
- Your extension's package contents must be located at the root level of the repository. That is, the repository **must directly represent the package**, with all relevant files such as `composer.json`, `README`, `LICENSE`, etc. placed directly in the **root of the repository**, **not inside a subdirectory within the repository**.
7270
- Tests must be defined in your repository using PHPUnit.
7371

74-
## 🛠 Configuration Options
72+
## Configuration Options
7573

7674
You can fine-tune this workflow with several optional arguments in the `with` section:
7775

@@ -153,32 +151,105 @@ call-tests:
153151
CODECOV: 0
154152
```
155153

156-
## 📊 Code Coverage with Codecov
154+
## Configuration Examples
157155

158-
This test framework supports code coverage reporting through [Codecov.io](https://codecov.io). To enable it, follow these steps:
156+
### Test an extension with phpBB 3.3.x
159157

160-
### 1. Add a `codecov.yml` Path Fix
158+
```yaml
159+
call-tests:
160+
name: Extension tests
161+
uses: phpbb-extensions/test-framework/.github/workflows/[email protected]
162+
with:
163+
EXTNAME: acme/demo
164+
```
165+
166+
### Test an extension with phpBB's master-dev version
167+
168+
```yaml
169+
call-tests:
170+
name: Extension tests
171+
uses: phpbb-extensions/test-framework/.github/workflows/tests.yml@master
172+
with:
173+
EXTNAME: acme/demo
174+
```
175+
176+
### Test an extension but skip the PostgreSQL on Linux and Windows tests
177+
178+
```yaml
179+
call-tests:
180+
name: Extension tests
181+
uses: phpbb-extensions/test-framework/.github/workflows/[email protected]
182+
with:
183+
EXTNAME: acme/demo
184+
RUN_PGSQL_JOBS: 0
185+
RUN_WINDOWS_JOBS: 0
186+
```
187+
188+
### Test an extension that has no PHPUnit tests (basic checks only)
189+
190+
```yaml
191+
call-tests:
192+
name: Extension tests
193+
uses: phpbb-extensions/test-framework/.github/workflows/[email protected]
194+
with:
195+
EXTNAME: acme/demo
196+
RUN_MYSQL_JOBS: 0
197+
RUN_PGSQL_JOBS: 0
198+
RUN_MSSQL_JOBS: 0
199+
RUN_WINDOWS_JOBS: 0
200+
```
161201

162-
Codecov may report incorrect file paths if phpBB is cloned into a subdirectory. To fix this, add a `codecov.yml` file to the `.github/` directory of your extension’s repository with the following content:
202+
### Test an extension that has no Functional tests
163203

164204
```yaml
165-
fixes:
166-
- "/phpBB3/phpBB/ext/acme/demo/::"
205+
call-tests:
206+
name: Extension tests
207+
uses: phpbb-extensions/test-framework/.github/workflows/[email protected]
208+
with:
209+
EXTNAME: acme/demo
210+
RUN_FUNCTIONAL_TESTS: 0
211+
```
212+
213+
### Test an extension that only supports PHP 8+
214+
215+
```yaml
216+
call-tests:
217+
name: Extension tests
218+
uses: phpbb-extensions/test-framework/.github/workflows/[email protected]
219+
with:
220+
EXTNAME: acme/demo
221+
PRIMARY_PHP_VERSION: '8.0'
222+
PHP_VERSION_MATRIX: '["8.0", "8.1", "8.2", "8.3", "8.4"]'
167223
```
168224

169-
Make sure to replace `acme/demo` with your actual extension vendor/package name.
225+
### Test an extension that has composer and NPM dependencies
170226

171-
### 2. Enable Codecov in the Workflow
227+
```yaml
228+
call-tests:
229+
name: Extension tests
230+
uses: phpbb-extensions/test-framework/.github/workflows/tests.yml@master
231+
with:
232+
EXTNAME: acme/demo
233+
RUN_NPM_INSTALL: 1
234+
RUN_COMPOSER_INSTALL: 1
235+
```
172236

173-
Ensure `CODECOV: 1` is set in your workflow call:
237+
### Test an extension + generate a code coverage report
238+
239+
This test framework supports code coverage reporting through [Codecov.io](https://codecov.io).
174240

175241
```yaml
176-
with:
177-
...
178-
CODECOV: 1
242+
call-tests:
243+
name: Extension tests
244+
uses: phpbb-extensions/test-framework/.github/workflows/[email protected]
245+
with:
246+
EXTNAME: acme/demo
247+
CODECOV: 1
248+
secrets: # This must be included
249+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} # This must be included
179250
```
180251

181-
### 3. Get Your Codecov Token (if required)
252+
#### Get Your Codecov Token (if required)
182253

183254
Most public repositories do **not** require a token.
184255
For private repositories or certain CI setups, you may need a global **Codecov token**:
@@ -194,10 +265,8 @@ Then, in your GitHub repository:
194265
- Click **"New repository secret"**
195266
- Name it `CODECOV_TOKEN` and paste your token value
196267

197-
Once set up, Codecov will automatically collect and display coverage reports for your extension after each test run.
198-
199268
> 💡 You can view your coverage reports and badges by visiting your extension's page on [Codecov.io](https://codecov.io).
200269

201-
## 📄 License
270+
## License
202271

203272
[GNU General Public License v2](license.txt)

0 commit comments

Comments
 (0)