Fix Actions workflow, add SonarCloud

This commit is contained in:
Stéphane Goetz 2020-04-22 23:17:36 +02:00
parent ab3aa4e391
commit 765fc8963e
2 changed files with 22 additions and 11 deletions

View File

@ -18,7 +18,7 @@ jobs:
runs-on: ${{ matrix.operating-system }}
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@master
@ -32,23 +32,24 @@ jobs:
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: Install tools
- name: Install tools
run: ./scripts/install_tools.sh
- name: Run test suite
run: composer run-script test
scrutinizer-ci:
sonarcloud:
name: "SonarCloud"
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@master
with:
php-version: 7.4
extension-csv: mbstring, xdebug, dom, intl
coverage: xdebug
extension-csv: mbstring, dom, intl
coverage: pcov
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
@ -57,17 +58,17 @@ jobs:
run: ./scripts/install_tools.sh
- name: Run test suite
run: composer run-script test -- --coverage-clover=coverage.clover
run: composer run-script test -- --coverage-clover=coverage.clover --log-junit=test-report.xml
- run: wget https://scrutinizer-ci.com/ocular.phar
- name: Upload code coverage
run: php ocular.phar code-coverage:upload --format=php-clover coverage.clover
# https://community.sonarsource.com/t/code-coverage-doesnt-work-with-github-action/16747/5
- name: fix code coverage paths
run: sed -i 's/\/home\/runner\/work\/daux.io\/daux.io\//\/github\/workspace\//g' coverage.clover
documentation:
runs-on: ubuntu-latest
if: github.repository == 'dauxio/daux.io' && github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: Generate documentation

10
sonar-project.properties Normal file
View File

@ -0,0 +1,10 @@
sonar.projectKey=dauxio_daux.io
sonar.organization=daux
sonar.projectName=Daux.io
sonar.sources=.
sonar.exclusions=vendor/**,tests/**
sonar.test.inclusions=tests/**
sonar.php.coverage.reportPaths=coverage.clover
sonar.php.tests.reportPath=test-report.xml