Merge pull request #21 from markstory/45-fixes #52
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run tests | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
run-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-versions: ['7.4', '8.1'] | |
composer-type: [lowest, stable, dev] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Validate composer.json and composer.lock | |
run: composer validate | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Get date part for cache key | |
id: key-date | |
run: echo "::set-output name=date::$(date +'%Y-%m')" | |
- name: Cache composer dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-${{ github.ref }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.composer-type }} | |
restore-keys: | | |
${{ runner.os }}-${{ github.ref }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.composer-type }} | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: mbstring, intl | |
- name: Install dependencies | |
if: steps.composer-cache.outputs.cache-hit != 'true' | |
run: | | |
if [[ ${{ matrix.composer-type }} == 'lowest' ]]; then | |
composer update --prefer-dist --no-progress --no-interaction --prefer-stable --prefer-lowest | |
elif [[ ${{ matrix.composer-type }} == 'stable' ]]; then | |
composer update --prefer-dist --no-progress --no-interaction --prefer-stable | |
else | |
composer update --prefer-dist --no-progress --no-interaction | |
fi | |
- name: Run tests | |
run: composer test |