Skip to content

Commit d442188

Browse files
authored
Merge pull request #56 from iMattPro/checktests
Check tests exist before running
2 parents 3ad1c8e + af3897e commit d442188

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

.github/workflows/tests.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ jobs:
9494

9595
name: PHP ${{ matrix.php }} - ${{ matrix.db }}
9696

97+
outputs:
98+
has-tests: ${{ steps.check-unit-tests.outputs.exists }}
99+
97100
steps:
98101
- name: Checkout phpBB
99102
uses: actions/checkout@v4
@@ -107,6 +110,16 @@ jobs:
107110
with:
108111
path: phpBB3/phpBB/ext/${{ env.EXTNAME }}
109112

113+
- name: Check for unit tests
114+
id: check-unit-tests
115+
run: |
116+
if [ -d "tests" ]; then
117+
echo "exists=true" >> "$GITHUB_OUTPUT"
118+
else
119+
echo "exists=false" >> "$GITHUB_OUTPUT"
120+
fi
121+
working-directory: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}
122+
110123
- name: Setup PHP
111124
uses: shivammathur/setup-php@v2
112125
with:
@@ -159,7 +172,8 @@ jobs:
159172

160173
# START MySQL and MariaDB Job
161174
mysql-tests:
162-
if: ${{ inputs.RUN_MYSQL_JOBS == '1' }}
175+
needs: basic-checks
176+
if: ${{ inputs.RUN_MYSQL_JOBS == '1' && needs.basic-checks.outputs.has-tests == 'true' }}
163177
runs-on: ubuntu-22.04
164178
strategy:
165179
matrix:
@@ -340,7 +354,8 @@ jobs:
340354

341355
# START PostgreSQL Job
342356
postgres-tests:
343-
if: ${{ inputs.RUN_PGSQL_JOBS == '1' }}
357+
needs: basic-checks
358+
if: ${{ inputs.RUN_PGSQL_JOBS == '1' && needs.basic-checks.outputs.has-tests == 'true' }}
344359
runs-on: ubuntu-22.04
345360
strategy:
346361
matrix:
@@ -488,7 +503,8 @@ jobs:
488503

489504
# START Other Tests Job (SQLite 3 and mssql)
490505
other-tests:
491-
if: ${{ inputs.RUN_MSSQL_JOBS == '1' }}
506+
needs: basic-checks
507+
if: ${{ inputs.RUN_MSSQL_JOBS == '1' && needs.basic-checks.outputs.has-tests == 'true' }}
492508
runs-on: ubuntu-22.04
493509
strategy:
494510
matrix:
@@ -634,7 +650,8 @@ jobs:
634650

635651
# Test with IIS & PostgreSQL on Windows
636652
windows-tests:
637-
if: ${{ inputs.RUN_WINDOWS_JOBS == '1' }}
653+
needs: basic-checks
654+
if: ${{ inputs.RUN_WINDOWS_JOBS == '1' && needs.basic-checks.outputs.has-tests == 'true' }}
638655
runs-on: windows-latest
639656
strategy:
640657
matrix:

0 commit comments

Comments
 (0)