From 765fc8963efb34715c3b6d04f07c7bfb6ff780ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Goetz?= Date: Wed, 22 Apr 2020 23:17:36 +0200 Subject: [PATCH] Fix Actions workflow, add SonarCloud --- .github/workflows/php.yml | 23 ++++++++++++----------- sonar-project.properties | 10 ++++++++++ 2 files changed, 22 insertions(+), 11 deletions(-) create mode 100644 sonar-project.properties diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 334bb7d..9eb2831 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -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 diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..f818211 --- /dev/null +++ b/sonar-project.properties @@ -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