Skip to content

Commit ff3ca1d

Browse files
authored
Merge pull request #45 from iMattPro/update-master
Merge 3.3.x into master
2 parents bb61aca + 97e8b20 commit ff3ca1d

File tree

3 files changed

+80
-37
lines changed

3 files changed

+80
-37
lines changed

.github/workflows/tests.yml

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ jobs:
119119
DB: ${{ matrix.db }}
120120
PHP_VERSION: ${{ matrix.php }}
121121
NOTESTS: '1'
122-
run: .github/setup-phpbb.sh $DB $PHP_VERSION $NOTESTS
122+
run: .github/setup-phpbb.sh "$DB" "$PHP_VERSION" "$NOTESTS"
123123
working-directory: ./phpBB3
124124

125125
- name: Setup EPV
@@ -131,7 +131,7 @@ jobs:
131131
if: ${{ env.SNIFF != '0' }}
132132
env:
133133
NOTESTS: '1'
134-
run: .github/ext-sniff.sh $EXTNAME $NOTESTS
134+
run: .github/ext-sniff.sh "$EXTNAME" "$NOTESTS"
135135
working-directory: ./phpBB3
136136

137137
- name: Check image ICC profiles
@@ -141,7 +141,7 @@ jobs:
141141

142142
- name: Check executable files
143143
if: ${{ env.EXECUTABLE_FILES != '0' }}
144-
run: .github/ext-check-executable-files.sh ./ $EXTNAME
144+
run: .github/ext-check-executable-files.sh ./ "$EXTNAME"
145145
working-directory: ./phpBB3
146146

147147
- name: Run EPV
@@ -225,8 +225,8 @@ jobs:
225225
env:
226226
MATRIX_DB: ${{ matrix.db }}
227227
run: |
228-
db=$(echo "${MATRIX_DB%%:*}")
229-
echo "db=$db" >> $GITHUB_OUTPUT
228+
db="${MATRIX_DB%%:*}"
229+
echo "db=$db" >> "$GITHUB_OUTPUT"
230230
231231
- name: Setup PHP
232232
uses: shivammathur/setup-php@v2
@@ -240,14 +240,14 @@ jobs:
240240
DB: ${{steps.database-type.outputs.db}}
241241
PHP_VERSION: ${{ matrix.php }}
242242
NOTESTS: '0'
243-
run: .github/setup-phpbb.sh $DB $PHP_VERSION ${NOTESTS:-0}
243+
run: .github/setup-phpbb.sh "$DB" "$PHP_VERSION" "${NOTESTS:-0}"
244244
working-directory: ./phpBB3
245245

246246
- name: Setup database
247247
env:
248248
DB: ${{steps.database-type.outputs.db}}
249249
MYISAM: ${{ matrix.MYISAM != 1 && '0' || '1' }}
250-
run: .github/setup-database.sh $DB $MYISAM
250+
run: .github/setup-database.sh "$DB" "$MYISAM"
251251
working-directory: ./phpBB3
252252

253253
- name: Set up Node.js
@@ -290,11 +290,10 @@ jobs:
290290
DB: ${{steps.database-type.outputs.db}}
291291
COVERAGE: ${{ matrix.COVERAGE == '1' && '1' || '0' }}
292292
run: |
293-
if [ $COVERAGE == '1' ]
294-
then
295-
sed -n '1h;1!H;${;g;s/<\/php>/<\/php>\n\t<coverage>\n\t\t<include>\n\t\t\t<directory>..\/<\/directory>\n\t\t<\/include>\n\t\t<exclude>\n\t\t\t<directory>..\/tests\/<\/directory>\n\t\t\t<directory>..\/language\/<\/directory>\n\t\t\t<directory>..\/migrations\/<\/directory>\n\t\t<\/exclude>\n\t<\/coverage>/g;p;}' .github/phpunit-$DB-github.xml &> phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml
293+
if [ "$COVERAGE" == '1' ]; then
294+
sed -n '1h;1!H;${;g;s/<\/php>/<\/php>\n\t<coverage>\n\t\t<include>\n\t\t\t<directory>..\/<\/directory>\n\t\t<\/include>\n\t\t<exclude>\n\t\t\t<directory>..\/tests\/<\/directory>\n\t\t\t<directory>..\/language\/<\/directory>\n\t\t\t<directory>..\/migrations\/<\/directory>\n\t\t<\/exclude>\n\t<\/coverage>/g;p;}' ".github/phpunit-$DB-github.xml" &> "phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml"
296295
else
297-
mkdir -p phpBB/ext/$EXTNAME/.github && cp .github/phpunit* $_
296+
mkdir -p "phpBB/ext/$EXTNAME/.github" && cp .github/phpunit* "$_"
298297
fi
299298
working-directory: ./phpBB3
300299

@@ -313,10 +312,10 @@ jobs:
313312
COVERAGE: ${{ matrix.COVERAGE == '1' && '1' || '0' }}
314313
run: |
315314
phpBB/vendor/bin/phpunit \
316-
--configuration phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml \
315+
--configuration "phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml" \
317316
--bootstrap ./tests/bootstrap.php \
318-
$([[ "$COVERAGE" == "1" ]] && echo "--coverage-clover build/logs/clover.xml") \
319-
$([[ "$FUNCTIONAL_TESTS" == "0" ]] && echo "--exclude-group functional")
317+
"$( [[ "$COVERAGE" == "1" ]] && echo "--coverage-clover build/logs/clover.xml" )" \
318+
"$( [[ "$FUNCTIONAL_TESTS" == "0" ]] && echo "--exclude-group functional" )"
320319
working-directory: ./phpBB3
321320

322321
- name: Send code coverage
@@ -395,8 +394,8 @@ jobs:
395394
env:
396395
MATRIX_DB: ${{ matrix.db }}
397396
run: |
398-
db=$(echo "${MATRIX_DB%%:*}")
399-
echo "db=$db" >> $GITHUB_OUTPUT
397+
db="${MATRIX_DB%%:*}"
398+
echo "db=$db" >> "$GITHUB_OUTPUT"
400399
401400
- name: Setup PHP
402401
uses: shivammathur/setup-php@v2
@@ -410,14 +409,14 @@ jobs:
410409
DB: ${{steps.database-type.outputs.db}}
411410
PHP_VERSION: ${{ matrix.php }}
412411
NOTESTS: '0'
413-
run: .github/setup-phpbb.sh $DB $PHP_VERSION ${NOTESTS:-0}
412+
run: .github/setup-phpbb.sh "$DB" "$PHP_VERSION" "${NOTESTS:-0}"
414413
working-directory: ./phpBB3
415414

416415
- name: Setup database
417416
env:
418417
DB: ${{steps.database-type.outputs.db}}
419418
MYISAM: '0'
420-
run: .github/setup-database.sh $DB $MYISAM
419+
run: .github/setup-database.sh "$DB" "$MYISAM"
421420
working-directory: ./phpBB3
422421

423422
- name: Set up Node.js
@@ -456,17 +455,17 @@ jobs:
456455
working-directory: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}
457456

458457
- name: Setup PHPUnit files
459-
run: mkdir -p phpBB/ext/$EXTNAME/.github && cp .github/phpunit* $_
458+
run: mkdir -p "phpBB/ext/$EXTNAME/.github" && cp .github/phpunit* "$_"
460459
working-directory: ./phpBB3
461460

462461
- name: Run unit tests
463462
env:
464463
DB: ${{steps.database-type.outputs.db}}
465464
run: |
466465
phpBB/vendor/bin/phpunit \
467-
--configuration phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml \
466+
--configuration "phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml" \
468467
--bootstrap ./tests/bootstrap.php \
469-
$([[ "$FUNCTIONAL_TESTS" == "0" ]] && echo "--exclude-group functional")
468+
"$( [[ "$FUNCTIONAL_TESTS" == "0" ]] && echo "--exclude-group functional" )"
470469
working-directory: ./phpBB3
471470
# END PostgreSQL Job
472471

@@ -531,13 +530,13 @@ jobs:
531530
env:
532531
MATRIX_DB: ${{ matrix.db }}
533532
run: |
534-
if [ $MATRIX_DB == 'mcr.microsoft.com/mssql/server:2019-CU27-ubuntu-20.04' ] || [ $MATRIX_DB == 'mcr.microsoft.com/mssql/server:2022-CU13-ubuntu-22.04' ]
533+
if [ "$MATRIX_DB" == 'mcr.microsoft.com/mssql/server:2019-CU27-ubuntu-20.04' ] || [ "$MATRIX_DB" == 'mcr.microsoft.com/mssql/server:2022-CU13-ubuntu-22.04' ]
535534
then
536535
db='mssql'
537536
else
538-
db=$(echo "${MATRIX_DB%%:*}")
537+
db="${MATRIX_DB%%:*}"
539538
fi
540-
echo "db=$db" >> $GITHUB_OUTPUT
539+
echo "db=$db" >> "$GITHUB_OUTPUT"
541540
542541
- name: Setup PHP
543542
uses: shivammathur/setup-php@v2
@@ -551,14 +550,14 @@ jobs:
551550
DB: ${{steps.database-type.outputs.db}}
552551
PHP_VERSION: ${{ matrix.php }}
553552
NOTESTS: '0'
554-
run: .github/setup-phpbb.sh $DB $PHP_VERSION ${NOTESTS:-0}
553+
run: .github/setup-phpbb.sh "$DB" "$PHP_VERSION" "${NOTESTS:-0}"
555554
working-directory: ./phpBB3
556555

557556
- name: Setup database
558557
env:
559558
DB: ${{steps.database-type.outputs.db}}
560559
MYISAM: '0'
561-
run: .github/setup-database.sh $DB $MYISAM
560+
run: .github/setup-database.sh "$DB" "$MYISAM"
562561
working-directory: ./phpBB3
563562

564563
- name: Set up Node.js
@@ -597,17 +596,17 @@ jobs:
597596
working-directory: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}
598597

599598
- name: Setup PHPUnit files
600-
run: mkdir -p phpBB/ext/$EXTNAME/.github && cp .github/phpunit* $_
599+
run: mkdir -p "phpBB/ext/$EXTNAME/.github" && cp .github/phpunit* "$_"
601600
working-directory: ./phpBB3
602601

603602
- name: Run unit tests
604603
env:
605604
DB: ${{steps.database-type.outputs.db}}
606605
run: |
607606
phpBB/vendor/bin/phpunit \
608-
--configuration phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml \
607+
--configuration "phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml" \
609608
--bootstrap ./tests/bootstrap.php \
610-
$([[ "$FUNCTIONAL_TESTS" == "0" ]] && echo "--exclude-group functional")
609+
"$( [[ "$FUNCTIONAL_TESTS" == "0" ]] && echo "--exclude-group functional" )"
611610
working-directory: ./phpBB3
612611
# END Other Tests Job
613612

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Validate Workflows
2+
3+
on:
4+
push:
5+
paths:
6+
- ".github/workflows/**/*.yml"
7+
- ".github/workflows/**/*.yaml"
8+
pull_request:
9+
paths:
10+
- ".github/workflows/**/*.yml"
11+
- ".github/workflows/**/*.yaml"
12+
13+
jobs:
14+
validate:
15+
name: Lint & Schema Validate Workflows
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
# Step 1: Run actionlint for logic/deprecation checks
23+
- name: Run actionlint
24+
uses: raven-actions/actionlint@v1
25+
26+
# Step 2: Set up Python for schema validation
27+
- name: Set up Python
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: "3.x"
31+
32+
- name: Install check-jsonschema
33+
run: pip install check-jsonschema
34+
35+
# Step 3: Validate each workflow YAML file against schema
36+
- name: Validate against GitHub workflow schema
37+
run: |
38+
find .github/workflows -name "*.y*ml" -print0 | while IFS= read -r -d '' file; do
39+
echo "Validating $file..."
40+
check-jsonschema \
41+
--schemafile https://json.schemastore.org/github-workflow.json \
42+
"$file"
43+
done

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
<img align="left" src="https://raw.githubusercontent.com/phpbb/website-assets/master/images/images/extensions/detective-bertie.png" alt="Detective Bertie running diagnostics" height="200" width="200">
44

5-
This repository provides a reusable GitHub Actions workflow for phpBB extension developers.
6-
7-
It supports testing phpBB extensions across multiple PHP versions and database engines including MySQL, PostgreSQL, SQLite, and Microsoft SQL Server.
5+
This repository provides a reusable GitHub Actions workflow for phpBB extension developers. It supports testing phpBB extensions across multiple PHP versions and database engines including MySQL, PostgreSQL, SQLite, and Microsoft SQL Server.
86

97
Additional checks include PHP CodeSniffer, Extension Pre Validator (EPV), executable file detection, image ICC profile removal, and code coverage reporting via Codecov.
8+
9+
[![Build](https://github.com/phpbb-extensions/test-framework/actions/workflows/validate_workflows.yml/badge.svg)](https://github.com/phpbb-extensions/test-framework/actions/workflows/validate_workflows.yml)
10+
[![Tests](https://github.com/phpbb/phpbb-ext-acme-demo/actions/workflows/tests.yml/badge.svg)](https://github.com/phpbb/phpbb-ext-acme-demo/actions/workflows/tests.yml)
1011
<br clear="both"/>
1112

1213
# How to Use
@@ -37,10 +38,10 @@ jobs:
3738
name: Extension tests
3839
uses: phpbb-extensions/test-framework/.github/workflows/tests.yml@master
3940
with:
40-
EXTNAME: acme/demo # Your extension vendor/package name
41+
EXTNAME: acme/demo # Your extension vendor/package name (required)
4142
```
4243
43-
## Branches
44+
## phpBB Branches
4445
4546
Use the test-framework branch that matches the phpBB version you're developing for:
4647
@@ -62,15 +63,15 @@ call-tests:
6263
name: Extension tests
6364
uses: phpbb-extensions/test-framework/.github/workflows/tests.yml@master
6465
with:
65-
EXTNAME: acme/demo # Your extension vendor/package name
66+
EXTNAME: acme/demo # Your extension vendor/package name (required)
6667
6768
# OPTIONAL CONFIGURATIONS BELOW
6869
# The following arguments are optional and can be omitted if not needed.
6970
70-
# The phpBB branch to use when running tests.
71+
# The phpBB repository's branch to use when running tests.
7172
# Default is 'master', which this framework is designed for.
7273
# If using a different branch, ensure it's compatible with master.
73-
# To test with phpBB's 3.3.x branch, refer to the Branches section of this README.
74+
# To test with phpBB's 3.3.x branch, refer to the phpBB Branches section of this README.
7475
# Default: 'master'
7576
PHPBB_BRANCH: 'master'
7677

0 commit comments

Comments
 (0)