name: PHP Composer
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
name: PHPUnit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Run test suite
env:
XDEBUG_MODE: coverage
run: composer run-script test
- name: Cat junit.xml
run: cat build/junit.xml
- name: cat clover.xml
run: cat build/clover.xml
- name: Prepare for SonarCloud Scan - sed on clover.xml
run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace@g' build/clover.xml
- name: Prepare for SonarCloud Scan - sed on junit.xml
run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace@g' build/junit.xml
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|