build #4969
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: build | |
on: | |
push: | |
branches: | |
- master | |
- '*.*' | |
pull_request: null | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
security: | |
name: Security | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
php: ['8.3'] # Note: This workflow requires only the LATEST version of PHP | |
os: [ubuntu-latest] | |
steps: | |
# General Steps | |
- name: Set Git To Use LF | |
run: | | |
git config --global core.autocrlf false | |
git config --global core.eol lf | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Configure environment | |
run: | | |
export COMPOSER_ROOT_VERSION=$(/usr/bin/jq --null-input --raw-output 'first(inputs["extra"]["branch-alias"])[]' composer.json) | |
echo COMPOSER_ROOT_VERSION=$COMPOSER_ROOT_VERSION >> $GITHUB_ENV | |
# Install PHP Dependencies | |
- name: Setup PHP ${{ matrix.php }} | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
- name: Validate Composer | |
run: composer validate | |
- name: Get Composer Cache Directory | |
# Docs: <https://github.com/actions/cache/blob/master/examples.md#php---composer> | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Restore Composer Cache | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer- | |
- name: Install Dependencies | |
uses: nick-invision/retry@v1 | |
with: | |
timeout_minutes: 5 | |
max_attempts: 5 | |
command: composer update --prefer-dist --no-interaction --no-progress | |
# Execution | |
- name: Security Advisories | |
run: composer require --dev roave/security-advisories:dev-latest | |
static-analysis: | |
name: Psalm and Rector | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
php: ['8.3'] # Note: This workflow requires only the LATEST version of PHP | |
os: [ubuntu-latest] | |
steps: | |
# General Steps | |
- name: Set Git To Use LF | |
run: | | |
git config --global core.autocrlf false | |
git config --global core.eol lf | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Configure environment | |
run: | | |
export COMPOSER_ROOT_VERSION=$(/usr/bin/jq --null-input --raw-output 'first(inputs["extra"]["branch-alias"])[]' composer.json) | |
echo COMPOSER_ROOT_VERSION=$COMPOSER_ROOT_VERSION >> $GITHUB_ENV | |
# Install PHP Dependencies | |
- name: Setup PHP ${{ matrix.php }} | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
- name: Validate Composer | |
run: composer validate | |
- name: Get Composer Cache Directory | |
# Docs: <https://github.com/actions/cache/blob/master/examples.md#php---composer> | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Restore Composer Cache | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer- | |
- name: Install Dependencies | |
uses: nick-invision/retry@v2 | |
with: | |
timeout_minutes: 5 | |
max_attempts: 5 | |
command: composer update --prefer-dist --no-interaction --no-progress | |
# Execution | |
- name: Static Analysis | |
run: | | |
vendor/bin/psalm --no-cache --shepherd --stats --output-format=checkstyle --php-version=${{ matrix.php }} | |
vendor/bin/rector --dry-run --clear-cache | |
coding-standards: | |
name: Coding Standards | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
php: ['8.3'] # Note: This workflow requires only the LATEST version of PHP | |
os: [ubuntu-latest] | |
steps: | |
# General Steps | |
- name: Set Git To Use LF | |
run: | | |
git config --global core.autocrlf false | |
git config --global core.eol lf | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Configure environment | |
run: | | |
export COMPOSER_ROOT_VERSION=$(/usr/bin/jq --null-input --raw-output 'first(inputs["extra"]["branch-alias"])[]' composer.json) | |
echo COMPOSER_ROOT_VERSION=$COMPOSER_ROOT_VERSION >> $GITHUB_ENV | |
# Install PHP Dependencies | |
- name: Setup PHP ${{ matrix.php }} | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
- name: Validate Composer | |
run: composer validate | |
- name: Get Composer Cache Directory | |
# Docs: <https://github.com/actions/cache/blob/master/examples.md#php---composer> | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Restore Composer Cache | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer- | |
- name: Install Dependencies | |
uses: nick-invision/retry@v2 | |
with: | |
timeout_minutes: 5 | |
max_attempts: 5 | |
command: composer update --prefer-dist --no-interaction --no-progress | |
# Execution | |
- name: Check Coding Standards | |
run: vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -vvv --dry-run --using-cache=no | |
# | |
# Execute unit tests on all valid PHP versions. | |
# | |
test: | |
name: Build (${{matrix.php}}, ${{ matrix.os }}, ${{ matrix.stability }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
php: ['8.1', '8.2', '8.3'] | |
os: [ubuntu-latest] | |
stability: [prefer-lowest, prefer-stable] | |
steps: | |
# General Steps | |
- name: Set Git To Use LF | |
run: | | |
git config --global core.autocrlf false | |
git config --global core.eol lf | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Configure environment | |
run: | | |
export COMPOSER_ROOT_VERSION=$(/usr/bin/jq --null-input --raw-output 'first(inputs["extra"]["branch-alias"])[]' composer.json) | |
echo COMPOSER_ROOT_VERSION=$COMPOSER_ROOT_VERSION >> $GITHUB_ENV | |
# Install PHP Dependencies | |
- name: Setup PHP ${{ matrix.php }} | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
# PHP Extras | |
extensions: pdo, pdo_mysql, pdo_sqlite, sockets | |
coverage: pcov | |
tools: pecl | |
ini-values: "memory_limit=-1" | |
- name: Validate Composer | |
run: composer validate | |
- name: Get Composer Cache Directory | |
# Docs: <https://github.com/actions/cache/blob/master/examples.md#php---composer> | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Restore Composer Cache | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer- | |
- name: Install Dependencies | |
uses: nick-invision/retry@v2 | |
with: | |
timeout_minutes: 5 | |
max_attempts: 5 | |
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress | |
# Execution | |
- name: Execute Tests | |
run: vendor/bin/phpunit --coverage-clover=coverage.clover | |
- name: Upload Coverage To Codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.clover | |
fail_ci_if_error: false | |
- name: Upload coverage to Scrutinizer | |
continue-on-error: true # if is fork | |
uses: sudo-bot/action-scrutinizer@latest | |
with: | |
cli-args: "--format=php-clover coverage.clover" |