Skip to content

Instantly share code, notes, and snippets.

@rodion-arr
Last active November 26, 2022 19:43
Show Gist options
  • Save rodion-arr/f56f4a3020a16ec295c4af2e79ff468a to your computer and use it in GitHub Desktop.
Save rodion-arr/f56f4a3020a16ec295c4af2e79ff468a to your computer and use it in GitHub Desktop.
GitHub Actions for PHP
name: PHP Composer
on:
schedule:
- cron: '23 4 * * *' # Once, nightly
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
env:
PHP_EXTENSIONS: dom, json, libxml, mbstring, pdo_sqlite, soap, xml, xmlwriter
PHP_INI_VALUES: assert.exception=1, zend.assertions=1
strategy:
fail-fast: false
matrix:
php-version:
- "7.3"
- "7.4"
- "8.0"
compiler:
- default
include:
- os: ubuntu-latest
php-version: "8.0"
compiler: jit
dependencies: highest
steps:
- uses: actions/checkout@v2
- name: Override PHP ini values for JIT compiler
if: matrix.compiler == 'jit'
run: echo "PHP_INI_VALUES::assert.exception=1, zend.assertions=1, opcache.enable=1, opcache.enable_cli=1, opcache.optimization_level=-1, opcache.jit=1255, opcache.jit_buffer_size=32M" >> $GITHUB_ENV
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: xdebug
extensions: ${{ env.PHP_EXTENSIONS }}
ini-values: ${{ env.PHP_INI_VALUES }}
- name: Validate composer.json and composer.lock
run: composer validate
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Run test suite
run: composer run-script test-ci
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
fail_ci_if_error: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment