.github/workflows/test.yml
name: Build
on:
push:
pull_request:
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php:
- '7.4'
- '8.0'
- '8.1'
llvm:
- '9'
- '10'
- '11'
- '12'
- '13'
continue-on-error: ${{ matrix.php == '8.1' }}
env:
PHP_VERSION: ${{ matrix.php }}
LLVM_VERSION: ${{ matrix.llvm }}
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install llvm ${{ matrix.llvm }}
run: |
wget -q https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh $LLVM_VERSION
sudo apt-get install libclang-$LLVM_VERSION-dev
clang-$LLVM_VERSION --version
- name: Install PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: pcov
extensions: ffi
- name: Get composer cache directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer cache directory
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
run: |
composer config extra.clang-ffi --json "{\"Linux\":{\"clangBin\":\"/usr/clang-$LLVM_VERSION\"}}"
composer update --prefer-dist --prefer-stable --no-interaction -vvv
- name: Run tests
run: |
composer test-coverage
- name: Publish code coverage to codeclimate
if: matrix.php == '7.4' && matrix.llvm == '9' && github.event_name == 'push'
uses: paambaati/codeclimate-action@v2.7.4
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}