Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 26 additions & 134 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,40 +256,13 @@ jobs:
run: .github/setup-database.sh "$DB" "$MYISAM"
working-directory: ./phpBB3

- name: Set up Node.js
if: ${{ inputs.RUN_NPM_INSTALL == '1' }}
uses: actions/setup-node@v4
- name: Install Dependencies
uses: phpbb-extensions/test-framework/actions/install-dependencies@3.3.x-experimental
with:
node-version: 20

- name: Cache NPM dependencies
if: ${{ inputs.RUN_NPM_INSTALL == '1' }}
uses: actions/cache@v4
with:
path: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('phpBB3/phpBB/ext/${{ env.EXTNAME }}/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Run npm ci
if: ${{ inputs.RUN_NPM_INSTALL == '1' }}
run: npm ci
working-directory: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}

- name: Cache Composer dependencies
if: ${{ inputs.RUN_COMPOSER_INSTALL == '1' }}
uses: actions/cache@v4
with:
path: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}/vendor
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('phpBB3/phpBB/ext/${{ env.EXTNAME }}/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ matrix.php }}-
${{ runner.os }}-composer-

- name: Install Composer dependencies
if: ${{ inputs.RUN_COMPOSER_INSTALL == '1' }}
run: composer install
working-directory: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}
RUN_NPM_INSTALL: ${{ inputs.RUN_NPM_INSTALL }}
RUN_COMPOSER_INSTALL: ${{ inputs.RUN_COMPOSER_INSTALL }}
EXTNAME: ${{ env.EXTNAME }}
PHP_VERSION: ${{ matrix.php }}

- name: Setup PHPUnit files
env:
Expand Down Expand Up @@ -431,40 +404,13 @@ jobs:
run: .github/setup-database.sh "$DB" "$MYISAM"
working-directory: ./phpBB3

- name: Set up Node.js
if: ${{ inputs.RUN_NPM_INSTALL == '1' }}
uses: actions/setup-node@v4
- name: Install Dependencies
uses: phpbb-extensions/test-framework/actions/install-dependencies@3.3.x-experimental
with:
node-version: 20

- name: Cache NPM dependencies
if: ${{ inputs.RUN_NPM_INSTALL == '1' }}
uses: actions/cache@v4
with:
path: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('phpBB3/phpBB/ext/${{ env.EXTNAME }}/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Run npm ci
if: ${{ inputs.RUN_NPM_INSTALL == '1' }}
run: npm ci
working-directory: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}

- name: Cache Composer dependencies
if: ${{ inputs.RUN_COMPOSER_INSTALL == '1' }}
uses: actions/cache@v4
with:
path: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}/vendor
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('phpBB3/phpBB/ext/${{ env.EXTNAME }}/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ matrix.php }}-
${{ runner.os }}-composer-

- name: Install Composer dependencies
if: ${{ inputs.RUN_COMPOSER_INSTALL == '1' }}
run: composer install
working-directory: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}
RUN_NPM_INSTALL: ${{ inputs.RUN_NPM_INSTALL }}
RUN_COMPOSER_INSTALL: ${{ inputs.RUN_COMPOSER_INSTALL }}
EXTNAME: ${{ env.EXTNAME }}
PHP_VERSION: ${{ matrix.php }}

- name: Setup PHPUnit files
run: mkdir -p "phpBB/ext/$EXTNAME/.github" && cp .github/phpunit* "$_"
Expand Down Expand Up @@ -577,40 +523,13 @@ jobs:
run: .github/setup-database.sh "$DB" "$MYISAM"
working-directory: ./phpBB3

- name: Set up Node.js
if: ${{ inputs.RUN_NPM_INSTALL == '1' }}
uses: actions/setup-node@v4
with:
node-version: 20

- name: Cache NPM dependencies
if: ${{ inputs.RUN_NPM_INSTALL == '1' }}
uses: actions/cache@v4
with:
path: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('phpBB3/phpBB/ext/${{ env.EXTNAME }}/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Run npm ci
if: ${{ inputs.RUN_NPM_INSTALL == '1' }}
run: npm ci
working-directory: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}

- name: Cache Composer dependencies
if: ${{ inputs.RUN_COMPOSER_INSTALL == '1' }}
uses: actions/cache@v4
- name: Install Dependencies
uses: phpbb-extensions/test-framework/actions/install-dependencies@3.3.x-experimental
with:
path: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}/vendor
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('phpBB3/phpBB/ext/${{ env.EXTNAME }}/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ matrix.php }}-
${{ runner.os }}-composer-

- name: Install Composer dependencies
if: ${{ inputs.RUN_COMPOSER_INSTALL == '1' }}
run: composer install
working-directory: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}
RUN_NPM_INSTALL: ${{ inputs.RUN_NPM_INSTALL }}
RUN_COMPOSER_INSTALL: ${{ inputs.RUN_COMPOSER_INSTALL }}
EXTNAME: ${{ env.EXTNAME }}
PHP_VERSION: ${{ matrix.php }}

- name: Setup PHPUnit files
run: mkdir -p "phpBB/ext/$EXTNAME/.github" && cp .github/phpunit* "$_"
Expand Down Expand Up @@ -733,48 +652,21 @@ jobs:
Set-MpPreference -ExclusionPath "${env:PGDATA}" # Exclude PGDATA directory from Windows Defender
Set-MpPreference -DisableRealtimeMonitoring $true

- name: Set up Node.js
if: ${{ inputs.RUN_NPM_INSTALL == '1' }}
uses: actions/setup-node@v4
with:
node-version: 20

- name: Cache NPM dependencies
if: ${{ inputs.RUN_NPM_INSTALL == '1' }}
uses: actions/cache@v4
- name: Install Dependencies
uses: phpbb-extensions/test-framework/actions/install-dependencies@3.3.x-experimental
with:
path: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('phpBB3/phpBB/ext/${{ env.EXTNAME }}/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Run npm ci
if: ${{ inputs.RUN_NPM_INSTALL == '1' }}
run: npm ci
working-directory: .\phpBB3\phpBB\ext\${{ env.EXTNAME }}

- name: Cache Composer dependencies
if: ${{ inputs.RUN_COMPOSER_INSTALL == '1' }}
uses: actions/cache@v4
with:
path: ./phpBB3/phpBB/ext/${{ env.EXTNAME }}/vendor
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('phpBB3/phpBB/ext/${{ env.EXTNAME }}/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ matrix.php }}-
${{ runner.os }}-composer-

- name: Install Composer dependencies
if: ${{ inputs.RUN_COMPOSER_INSTALL == '1' }}
run: composer install
working-directory: .\phpBB3\phpBB\ext\${{ env.EXTNAME }}
RUN_NPM_INSTALL: ${{ inputs.RUN_NPM_INSTALL }}
RUN_COMPOSER_INSTALL: ${{ inputs.RUN_COMPOSER_INSTALL }}
EXTNAME: ${{ env.EXTNAME }}
PHP_VERSION: ${{ matrix.php }}

- name: Setup PHPUnit files
run: |
if (-not (Test-Path "phpBB\ext\$env:EXTNAME\.github")) {
mkdir "phpBB\ext\$env:EXTNAME\.github"
}
Copy-Item ".github\phpunit*" -Destination "phpBB\ext\$env:EXTNAME\.github" -Force
working-directory: .\phpBB3
working-directory: ./phpBB3

- name: Run unit tests
run: |
Expand All @@ -791,5 +683,5 @@ jobs:
}

phpBB/vendor/bin/phpunit @args
working-directory: .\phpBB3
working-directory: ./phpBB3
# END IIS & PostgreSQL on Windows Tests Job
52 changes: 52 additions & 0 deletions actions/install-dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Install Dependencies
description: Sets up Node.js, npm, and Composer for the extension

inputs:
RUN_NPM_INSTALL:
required: true
RUN_COMPOSER_INSTALL:
required: true
EXTNAME:
required: true
PHP_VERSION:
required: false

runs:
using: "composite"
steps:
- name: Set up Node.js
if: ${{ inputs.RUN_NPM_INSTALL == '1' }}
uses: actions/setup-node@v4
with:
node-version: 20

- name: Cache NPM dependencies
if: ${{ inputs.RUN_NPM_INSTALL == '1' }}
uses: actions/cache@v4
with:
path: ./phpBB3/phpBB/ext/${{ inputs.EXTNAME }}/node_modules
key: ${{ runner.os }}-node-${{ hashFiles(format('phpBB3/phpBB/ext/{0}/package-lock.json', inputs.EXTNAME)) }}
restore-keys: |
${{ runner.os }}-node-

- name: Run npm ci
if: ${{ inputs.RUN_NPM_INSTALL == '1' }}
run: npm ci
shell: bash
working-directory: ./phpBB3/phpBB/ext/${{ inputs.EXTNAME }}

- name: Cache Composer dependencies
if: ${{ inputs.RUN_COMPOSER_INSTALL == '1' }}
uses: actions/cache@v4
with:
path: ./phpBB3/phpBB/ext/${{ inputs.EXTNAME }}/vendor
key: ${{ runner.os }}-composer-${{ inputs.PHP_VERSION || 'default' }}-${{ hashFiles(format('phpBB3/phpBB/ext/{0}/composer.lock', inputs.EXTNAME)) }}
restore-keys: |
${{ runner.os }}-composer-${{ inputs.PHP_VERSION || 'default' }}-
${{ runner.os }}-composer-

- name: Install Composer dependencies
if: ${{ inputs.RUN_COMPOSER_INSTALL == '1' }}
run: composer install
shell: bash
working-directory: ./phpBB3/phpBB/ext/${{ inputs.EXTNAME }}