Skip to content

Setup global postdata for OpenPub item #67

Setup global postdata for OpenPub item

Setup global postdata for OpenPub item #67

Workflow file for this run

name: Run tests
on:
pull_request:
workflow_dispatch:
jobs:
tests:
name: P${{ matrix.php }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: what-has-changed
# Run only if PHP files have changed
if: ${{ needs.what-has-changed.outputs.php == 'true' }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
php: [7.4]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Setup PHP with composer v2
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: none
- name: Install dependencies
run: composer update --no-interaction --no-progress --prefer-dist --no-scripts
- name: Execute tests
run: vendor/bin/phpunit --testsuite "Unit Test Suite"
# Job to check if certain files have changed
what-has-changed:
name: Detect file changes
runs-on: ubuntu-latest
outputs:
php: ${{ steps.filter.outputs.php }}
steps:
- name: Checkout
uses: actions/checkout@v2
# For pull requests it's not necessary to checkout the code
if: ${{ github.event_name != 'pull_request' }}
- uses: dorny/paths-filter@v2
id: filter
with:
base: ${{ github.ref }}
filters: |
php:
- added|modified: 'config/**/*.php'
- added|modified: 'src/**/*.php'
- added|modified: 'tests/**/*.php'