Skip to content

Update CI to use new sonarcube action (#57) #186

Update CI to use new sonarcube action (#57)

Update CI to use new sonarcube action (#57) #186

Workflow file for this run

name: Continuous Integration
on:
workflow_dispatch:
push:
branches: [ main ]
tags: [ v* ]
pull_request:
env:
LATEST_SUPPORTED_PHP_VERSION: 8.4
LATEST_SUPPORTED_LARAVEL_VERSION: 12.*
jobs:
run-tests:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
php: [ 8.1, 8.2, 8.3, 8.4 ]
laravel: [ 10.*, 11.*, 12.* ]
stability: [ prefer-stable ]
experimental: [ false ]
include:
- laravel: 10.*
testbench: 8.*
- laravel: 11.*
testbench: 9.*
- laravel: 12.*
testbench: 10.*
exclude:
- php: 8.1
laravel: 11.*
- php: 8.1
laravel: 12.*
name: PHP ${{ matrix.php }} - L${{ matrix.laravel }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Install dependencies
if: "${{ matrix.experimental == false }}"
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update --dev
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: Install dependencies (experimental)
if: "${{ matrix.experimental == true }}"
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update --dev --ignore-platform-reqs
composer update --${{ matrix.stability }} --prefer-dist --no-interaction --ignore-platform-reqs
- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Execute tests (Unit and Feature)
run: vendor/bin/phpunit --log-junit=reports/report-phpunit.xml --coverage-clover=reports/coverage-phpunit.xml
- name: Static analysis with PHPStan
run: |
vendor/bin/phpstan analyse --error-format=github
vendor/bin/phpstan analyse --error-format=json > reports/phpstan.json
- name: Static analysis with Psalm
if: "${{ matrix.experimental == false }}"
run: vendor/bin/psalm
- name: Coding style PSR12 Check
run: vendor/bin/phpcs
- name: 'Run SonarQube cloud scanner'
if: ${{ matrix.php == env.LATEST_SUPPORTED_PHP_VERSION && matrix.laravel == env.LATEST_SUPPORTED_LARAVEL_VERSION }}
uses: minvws/action-sonarqube@v1
with:
sonar-token: ${{ secrets.SONAR_TOKEN }}