forked from ngnpope/twitter-text-php
-
Notifications
You must be signed in to change notification settings - Fork 21
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
1 changed file
with
91 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,91 @@ | ||
name: Setup PHP Action | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- develop | ||
pull_request: | ||
branches: | ||
- '*' | ||
schedule: | ||
- cron: "0 7 1 * *" | ||
branches: | ||
- master | ||
|
||
jobs: | ||
testsuite: | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php-version: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.4'] | ||
coverage: ['no'] | ||
test-tld: ['no'] | ||
include: | ||
- php-version: '7.4' | ||
coverage: 'coverage' | ||
test-tld: 'no' | ||
- php-version: '7.4' | ||
coverage: 'no' | ||
test-tld: 'test-tld' | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
extensions: mbstring, intl | ||
coverage: xdebug | ||
|
||
- 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: Install dependencies | ||
run: composer install --prefer-dist | ||
|
||
- name: Setup problem matchers for PHPUnit | ||
if: matrix.php-version == '7.4' | ||
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | ||
|
||
- name: Run PHPUnit | ||
run: | | ||
if [[ ${{ matrix.coverage }} == 'coverage' ]]; then | ||
vendor/bin/phpunit --exclude-group deprecated,tld --stderr --verbose --coverage-clover=coverage.xml | ||
elif [[ ${{ matrix.test-tld }} == 'test-tld' ]]; then | ||
vendor/bin/phpunit --group tld --stderr | ||
else | ||
vendor/bin/phpunit --exclude-group deprecated,tld --stderr | ||
fi | ||
- name: Submit code coverage | ||
if: matrix.coverage == 'coverage' | ||
uses: codecov/codecov-action@v1 | ||
|
||
cscheck: | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '7.4' | ||
extensions: mbstring, intl, apcu | ||
coverage: none | ||
tools: cs2pr, phpcs | ||
|
||
- name: Run PHP CodeSniffer | ||
run: phpcs -qn --report=checkstyle --extensions=php --standard=PSR12 ./lib ./tests | cs2pr |