-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
89 additions
and
74 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,93 @@ | ||
on: | ||
- pull_request | ||
- push | ||
- pull_request | ||
- push | ||
|
||
name: build | ||
|
||
jobs: | ||
tests: | ||
name: PHP ${{ matrix.php-version }} | ||
runs-on: ubuntu-latest | ||
env: | ||
extensions: curl, mbstring, dom | ||
key: cache-v1 | ||
|
||
strategy: | ||
matrix: | ||
php-version: | ||
- "7.4" | ||
- "8.0" | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup cache environment | ||
id: cache-env | ||
uses: shivammathur/cache-extensions@v1 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
extensions: ${{ env.extensions }} | ||
key: ${{ env.key }} | ||
|
||
- name: Cache extensions | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.cache-env.outputs.dir }} | ||
key: ${{ steps.cache-env.outputs.key }} | ||
restore-keys: ${{ steps.cache-env.outputs.key }} | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
extensions: ${{ env.extensions }} | ||
ini-values: date.timezone='UTC' | ||
coverage: pcov | ||
|
||
- name: Determine composer cache directory | ||
run: echo "::set-env name=COMPOSER_CACHE_DIR::$(composer config cache-dir)" | ||
|
||
- name: Cache dependencies installed with composer | ||
uses: actions/cache@v1 | ||
with: | ||
path: ${{ env.COMPOSER_CACHE_DIR }} | ||
key: php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }} | ||
restore-keys: php-${{ matrix.php-version }}-composer- | ||
|
||
- name: Install dependencies with composer php 7.4 | ||
if: matrix.php-version == '7.4' | ||
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader | ||
|
||
- name: Install dependencies with composer php 8.0 | ||
if: matrix.php-version == '8.0' | ||
run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader | ||
|
||
- name: PHPUnit run with coverage on PHP 7.4 | ||
if: matrix.php-version == '7.4' | ||
run: vendor/bin/phpunit --coverage-clover=coverage.clover | ||
|
||
- name: PHPUnit run without coverage on PHP 8.0 | ||
if: matrix.php-version == '8.0' | ||
run: vendor/bin/phpunit | ||
|
||
- name: Code coverage on PHP 7.4 | ||
if: matrix.php-version == '7.4' | ||
run: | | ||
wget https://scrutinizer-ci.com/ocular.phar | ||
php ocular.phar code-coverage:upload --format=php-clover coverage.clover | ||
tests: | ||
name: PHP ${{ matrix.php-version }}-${{ matrix.os }} | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
env: | ||
extensions: curl, mbstring, dom | ||
key: cache-v1 | ||
|
||
strategy: | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
- windows-latest | ||
|
||
php-version: | ||
- "7.4" | ||
- "8.0" | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup cache environment | ||
id: cache-env | ||
uses: shivammathur/cache-extensions@v1 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
extensions: ${{ env.extensions }} | ||
key: ${{ env.key }} | ||
|
||
- name: Cache extensions | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.cache-env.outputs.dir }} | ||
key: ${{ steps.cache-env.outputs.key }} | ||
restore-keys: ${{ steps.cache-env.outputs.key }} | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
extensions: ${{ env.extensions }} | ||
ini-values: date.timezone='UTC' | ||
coverage: pcov | ||
|
||
- name: Determine composer cache directory on Linux | ||
if: matrix.os == 'ubuntu-latest' | ||
run: echo "::set-env name=COMPOSER_CACHE_DIR::$(composer config cache-dir)" | ||
|
||
- name: Determine composer cache directory on Windows | ||
if: matrix.os == 'windows-latest' | ||
run: ECHO "::set-env name=COMPOSER_CACHE_DIR::~\AppData\Local\Composer" | ||
|
||
- name: Cache dependencies installed with composer | ||
uses: actions/cache@v1 | ||
with: | ||
path: ${{ env.COMPOSER_CACHE_DIR }} | ||
key: php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }} | ||
restore-keys: php-${{ matrix.php-version }}-composer- | ||
|
||
- name: Install dependencies with composer php 7.4 | ||
if: matrix.php-version == '7.4' | ||
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader | ||
|
||
- name: Install dependencies with composer php 8.0 | ||
if: matrix.php-version == '8.0' | ||
run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader | ||
|
||
- name: PHPUnit run with coverage on Linux PHP 7.4 | ||
if: matrix.os == 'ubuntu-latest' && matrix.php-version == '7.4' | ||
run: vendor/bin/phpunit --coverage-clover=coverage.clover | ||
|
||
- name: PHPUnit run without coverage on Linux PHP 8.0 | ||
if: matrix.os == 'ubuntu-latest' && matrix.php-version == '8.0' | ||
run: vendor/bin/phpunit | ||
|
||
- name: PHPUnit run without coverage on Windows | ||
if: matrix.os == 'windows-latest' | ||
run: vendor/bin/phpunit | ||
|
||
- name: Code coverage scrutinizer on Linux PHP 7.4 | ||
if: matrix.os == 'ubuntu-latest' && matrix.php-version == '7.4' | ||
run: | | ||
wget https://scrutinizer-ci.com/ocular.phar | ||
php ocular.phar code-coverage:upload --format=php-clover coverage.clover |
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