node 20 #175
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: SonarCloud | |
on: [push] | |
jobs: | |
sonarcloud: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
php: ["8.3"] | |
env: | |
tools: composer | |
ini-values: default_charset='UTF-8' | |
name: PHP ${{ matrix.php }} test on ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
ini-values: ${{ env.ini-values }} | |
coverage: pcov | |
tools: ${{ env.tools }} | |
env: | |
fail-fast: true | |
- name: Setup problem matchers for PHPUnit | |
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | |
- name: Validate composer | |
run: composer validate | |
- name: Get composer cache directory | |
if: ${{ !env.ACT }} | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
if: ${{ !env.ACT }} | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install dependencies | |
run: composer install --no-progress | |
- name: Tests (PHPUnit) | |
run: vendor/bin/phpunit --coverage-clover=build/logs/clover.xml --log-junit=build/logs/junit.xml | |
- name: Fix paths for sonar-scanner | |
working-directory: ./build/logs | |
run: | | |
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace@g' clover.xml | |
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace@g' junit.xml | |
- name: SonarCloud scan | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |