Skip to content

Commit 3435a88

Browse files
authored
Merge pull request #43 from iMattPro/updates
Try yaml linting
2 parents b31ffe4 + 9dc5b7e commit 3435a88

3 files changed

Lines changed: 80 additions & 35 deletions

File tree

.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
@@ -138,7 +138,7 @@ jobs:
138138
if: ${{ env.SNIFF != '0' }}
139139
env:
140140
NOTESTS: '1'
141-
run: .github/ext-sniff.sh $EXTNAME $NOTESTS
141+
run: .github/ext-sniff.sh "$EXTNAME" "$NOTESTS"
142142
working-directory: ./phpBB3
143143

144144
- name: Check image ICC profiles
@@ -148,7 +148,7 @@ jobs:
148148

149149
- name: Check executable files
150150
if: ${{ env.EXECUTABLE_FILES != '0' }}
151-
run: .github/ext-check-executable-files.sh ./ $EXTNAME
151+
run: .github/ext-check-executable-files.sh ./ "$EXTNAME"
152152
working-directory: ./phpBB3
153153

154154
- name: Run EPV
@@ -230,8 +230,8 @@ jobs:
230230
env:
231231
MATRIX_DB: ${{ matrix.db }}
232232
run: |
233-
db=$(echo "${MATRIX_DB%%:*}")
234-
echo "db=$db" >> $GITHUB_OUTPUT
233+
db="${MATRIX_DB%%:*}"
234+
echo "db=$db" >> "$GITHUB_OUTPUT"
235235
236236
- name: Setup PHP
237237
uses: shivammathur/setup-php@v2
@@ -245,14 +245,14 @@ jobs:
245245
DB: ${{steps.database-type.outputs.db}}
246246
PHP_VERSION: ${{ matrix.php }}
247247
NOTESTS: '0'
248-
run: .github/setup-phpbb.sh $DB $PHP_VERSION ${NOTESTS:-0}
248+
run: .github/setup-phpbb.sh "$DB" "$PHP_VERSION" "${NOTESTS:-0}"
249249
working-directory: ./phpBB3
250250

251251
- name: Setup database
252252
env:
253253
DB: ${{steps.database-type.outputs.db}}
254254
MYISAM: ${{ matrix.MYISAM != 1 && '0' || '1' }}
255-
run: .github/setup-database.sh $DB $MYISAM
255+
run: .github/setup-database.sh "$DB" "$MYISAM"
256256
working-directory: ./phpBB3
257257

258258
- name: Set up Node.js
@@ -295,11 +295,10 @@ jobs:
295295
DB: ${{steps.database-type.outputs.db}}
296296
COVERAGE: ${{ matrix.COVERAGE == '1' && '1' || '0' }}
297297
run: |
298-
if [ $COVERAGE == '1' ]
299-
then
300-
sed -n '1h;1!H;${;g;s/<\/php>/<\/php>\n\t<filter>\n\t\t<whitelist>\n\t\t\t<directory>..\/<\/directory>\n\t\t\t<exclude>\n\t\t\t\t<directory>..\/tests\/<\/directory>\n\t\t\t\t<directory>..\/language\/<\/directory>\n\t\t\t\t<directory>..\/migrations\/<\/directory>\n\t\t\t<\/exclude>\n\t\t<\/whitelist>\n\t<\/filter>/g;p;}' .github/phpunit-$DB-github.xml &> phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml
298+
if [ "$COVERAGE" == '1' ]; then
299+
sed -n '1h;1!H;${;g;s/<\/php>/<\/php>\n\t<filter>\n\t\t<whitelist>\n\t\t\t<directory>..\/<\/directory>\n\t\t\t<exclude>\n\t\t\t\t<directory>..\/tests\/<\/directory>\n\t\t\t\t<directory>..\/language\/<\/directory>\n\t\t\t\t<directory>..\/migrations\/<\/directory>\n\t\t\t<\/exclude>\n\t\t<\/whitelist>\n\t<\/filter>/g;p;}' ".github/phpunit-$DB-github.xml" &> "phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml"
301300
else
302-
mkdir -p phpBB/ext/$EXTNAME/.github && cp .github/phpunit* $_
301+
mkdir -p "phpBB/ext/$EXTNAME/.github" && cp .github/phpunit* "$_"
303302
fi
304303
working-directory: ./phpBB3
305304

@@ -318,10 +317,10 @@ jobs:
318317
COVERAGE: ${{ matrix.COVERAGE == '1' && '1' || '0' }}
319318
run: |
320319
phpBB/vendor/bin/phpunit \
321-
--configuration phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml \
320+
--configuration "phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml" \
322321
--bootstrap ./tests/bootstrap.php \
323-
$([[ "$COVERAGE" == "1" ]] && echo "--coverage-clover build/logs/clover.xml") \
324-
$([[ "$FUNCTIONAL_TESTS" == "0" ]] && echo "--exclude-group functional")
322+
"$( [[ "$COVERAGE" == "1" ]] && echo "--coverage-clover build/logs/clover.xml" )" \
323+
"$( [[ "$FUNCTIONAL_TESTS" == "0" ]] && echo "--exclude-group functional" )"
325324
working-directory: ./phpBB3
326325

327326
- name: Send code coverage
@@ -398,8 +397,8 @@ jobs:
398397
env:
399398
MATRIX_DB: ${{ matrix.db }}
400399
run: |
401-
db=$(echo "${MATRIX_DB%%:*}")
402-
echo "db=$db" >> $GITHUB_OUTPUT
400+
db="${MATRIX_DB%%:*}"
401+
echo "db=$db" >> "$GITHUB_OUTPUT"
403402
404403
- name: Setup PHP
405404
uses: shivammathur/setup-php@v2
@@ -413,14 +412,14 @@ jobs:
413412
DB: ${{steps.database-type.outputs.db}}
414413
PHP_VERSION: ${{ matrix.php }}
415414
NOTESTS: '0'
416-
run: .github/setup-phpbb.sh $DB $PHP_VERSION ${NOTESTS:-0}
415+
run: .github/setup-phpbb.sh "$DB" "$PHP_VERSION" "${NOTESTS:-0}"
417416
working-directory: ./phpBB3
418417

419418
- name: Setup database
420419
env:
421420
DB: ${{steps.database-type.outputs.db}}
422421
MYISAM: '0'
423-
run: .github/setup-database.sh $DB $MYISAM
422+
run: .github/setup-database.sh "$DB" "$MYISAM"
424423
working-directory: ./phpBB3
425424

426425
- name: Set up Node.js
@@ -459,17 +458,17 @@ jobs:
459458
working-directory: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}
460459

461460
- name: Setup PHPUnit files
462-
run: mkdir -p phpBB/ext/$EXTNAME/.github && cp .github/phpunit* $_
461+
run: mkdir -p "phpBB/ext/$EXTNAME/.github" && cp .github/phpunit* "$_"
463462
working-directory: ./phpBB3
464463

465464
- name: Run unit tests
466465
env:
467466
DB: ${{steps.database-type.outputs.db}}
468467
run: |
469468
phpBB/vendor/bin/phpunit \
470-
--configuration phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml \
469+
--configuration "phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml" \
471470
--bootstrap ./tests/bootstrap.php \
472-
$([[ "$FUNCTIONAL_TESTS" == "0" ]] && echo "--exclude-group functional")
471+
"$( [[ "$FUNCTIONAL_TESTS" == "0" ]] && echo "--exclude-group functional" )"
473472
working-directory: ./phpBB3
474473
# END PostgreSQL Job
475474

@@ -533,13 +532,13 @@ jobs:
533532
env:
534533
MATRIX_DB: ${{ matrix.db }}
535534
run: |
536-
if [ $MATRIX_DB == 'mcr.microsoft.com/mssql/server:2022-CU13-ubuntu-22.04' ] || [ $MATRIX_DB == 'mcr.microsoft.com/mssql/server:2019-CU27-ubuntu-20.04' ]
535+
if [ "$MATRIX_DB" == 'mcr.microsoft.com/mssql/server:2022-CU13-ubuntu-22.04' ] || [ "$MATRIX_DB" == 'mcr.microsoft.com/mssql/server:2019-CU27-ubuntu-20.04' ]
537536
then
538537
db='mssql'
539538
else
540-
db=$(echo "${MATRIX_DB%%:*}")
539+
db="${MATRIX_DB%%:*}"
541540
fi
542-
echo "db=$db" >> $GITHUB_OUTPUT
541+
echo "db=$db" >> "$GITHUB_OUTPUT"
543542
544543
- name: Setup PHP
545544
uses: shivammathur/setup-php@v2
@@ -553,14 +552,14 @@ jobs:
553552
DB: ${{steps.database-type.outputs.db}}
554553
PHP_VERSION: ${{ matrix.php }}
555554
NOTESTS: '0'
556-
run: .github/setup-phpbb.sh $DB $PHP_VERSION ${NOTESTS:-0}
555+
run: .github/setup-phpbb.sh "$DB" "$PHP_VERSION" "${NOTESTS:-0}"
557556
working-directory: ./phpBB3
558557

559558
- name: Setup database
560559
env:
561560
DB: ${{steps.database-type.outputs.db}}
562561
MYISAM: '0'
563-
run: .github/setup-database.sh $DB $MYISAM
562+
run: .github/setup-database.sh "$DB" "$MYISAM"
564563
working-directory: ./phpBB3
565564

566565
- name: Set up Node.js
@@ -599,17 +598,17 @@ jobs:
599598
working-directory: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}
600599

601600
- name: Setup PHPUnit files
602-
run: mkdir -p phpBB/ext/$EXTNAME/.github && cp .github/phpunit* $_
601+
run: mkdir -p "phpBB/ext/$EXTNAME/.github" && cp .github/phpunit* "$_"
603602
working-directory: ./phpBB3
604603

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

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 & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
# phpBB Extension Test Framework
22

3-
<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">
3+
<img align="left" src="https://raw.githubusercontent.com/phpbb/website-assets/master/images/images/extensions/detective-bertie.png" alt="Detective Bertie running diagnostics" height="250" width="250">
44

55
This repository provides a reusable GitHub Actions workflow for phpBB extension developers.
66

77
It supports testing phpBB extensions across multiple PHP versions and database engines including MySQL, PostgreSQL, SQLite, and Microsoft SQL Server.
88

99
Additional checks include PHP CodeSniffer, Extension Pre Validator (EPV), executable file detection, image ICC profile removal, and code coverage reporting via Codecov.
10+
11+
[![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)
12+
[![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)
1013
<br clear="both"/>
1114

1215
# How to Use
@@ -37,10 +40,10 @@ jobs:
3740
name: Extension tests
3841
uses: phpbb-extensions/test-framework/.github/workflows/tests.yml@3.3.x
3942
with:
40-
EXTNAME: acme/demo # Your extension vendor/package name
43+
EXTNAME: acme/demo # Your extension vendor/package name (required)
4144
```
4245
43-
## Branches
46+
## phpBB Branches
4447
4548
Use the test-framework branch that matches the phpBB version you're developing for:
4649
@@ -62,15 +65,15 @@ call-tests:
6265
name: Extension tests
6366
uses: phpbb-extensions/test-framework/.github/workflows/tests.yml@3.3.x
6467
with:
65-
EXTNAME: acme/demo # Your extension vendor/package name
68+
EXTNAME: acme/demo # Your extension vendor/package name (required)
6669
6770
# OPTIONAL CONFIGURATIONS BELOW
6871
# The following arguments are optional and can be omitted if not needed.
6972
70-
# The phpBB branch to use when running tests.
73+
# The phpBB repository's branch to use when running tests.
7174
# Default is '3.3.x', which this framework is designed for.
7275
# If using a different branch, ensure it's compatible with 3.3.x.
73-
# To test with phpBB's master branch, refer to the Branches section of this README.
76+
# To test with phpBB's master branch, refer to the phpBB Branches section of this README.
7477
# Default: '3.3.x'
7578
PHPBB_BRANCH: '3.3.x'
7679

0 commit comments

Comments
 (0)