Skip to content

Commit

Permalink
[TransactionalMessenger] Added SonarCloud checks, refactor GitHub act…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
fractalzombie committed Mar 6, 2023
1 parent b793534 commit 27164b5
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 94 deletions.
112 changes: 112 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Build

on:
push:
branches:
- main
- develop
- 'releases/**'
paths-ignore:
- '**/*.md'
- '**/*.gitignore'
- '**/*.gitattributes'

pull_request:
types:
- published
- created
- edited
- opened
- synchronize
- reopened
paths-ignore:
- '**/*.md'
- '**/*.gitignore'
- '**/*.gitattributes'

jobs:
build:
name: PHP
runs-on: ubuntu-latest

strategy:
matrix:
php:
- "8.1"
- "8.2"
include:
- php-versions: ["8.1", "8.2"]
- composer-options: "--ignore-platform-reqs"

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
extensions: mbstring, intl
coverage: xdebug
tools: pecl, phpunit, composer
ini-values: post_max_size=256M

- name: Setup composer
uses: ramsey/composer-install@v1
with:
composer-options: "${{ matrix.composer-options }}"

- name: Validate composer files
run: composer validate

- name: Cache composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer update --prefer-dist --no-progress

- name: Setup tests directories
run: mkdir -p build/logs

- name: Execute unit tests
run: ./vendor/bin/phpunit --colors=always --configuration phpunit.xml.dist --coverage-cobertura tests-cobertura.xml --coverage-clover tests-coverage.xml --log-junit tests-execution.xml

- name: Prepare coverages and logs
run: cp tests-coverage.xml build/logs/clover.xml && cp tests-cobertura.xml build/logs/cobertura.xml && cp tests-execution.xml build/logs/junit.xml

- name: Push to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: php-${{ matrix.php-versions }}
run: |
composer global require php-coveralls/php-coveralls
php-coveralls -v
- name: SonarCloud scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
projectBaseDir: ${{ github.workspace }}

finish:
needs: [ build ]
runs-on: ubuntu-latest

steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
84 changes: 0 additions & 84 deletions .github/workflows/ci.yml

This file was deleted.

13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
Transactional Messenger Component
=============================

![Workflow Build Status](https://github.com/fractalzombie/frzb-transactional-messenger/actions/workflows/ci.yml/badge.svg?event=push)
![Workflow Build Status](https://github.com/fractalzombie/frzb-transactional-messenger/actions/workflows/build.yml/badge.svg?event=push)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/fractalzombie/frzb-transactional-messenger/badges/quality-score.png?b=main)](https://scrutinizer-ci.com/g/fractalzombie/frzb-transactional-messenger/?branch=main)
[![Code Intelligence Status](https://scrutinizer-ci.com/g/fractalzombie/frzb-transactional-messenger/badges/code-intelligence.svg?b=main)](https://scrutinizer-ci.com/code-intelligence)
[![Build Status](https://scrutinizer-ci.com/g/fractalzombie/frzb-transactional-messenger/badges/build.png?b=main)](https://scrutinizer-ci.com/g/fractalzombie/frzb-transactional-messenger/build-status/main)
[![Coverage Status](https://coveralls.io/repos/github/fractalzombie/frzb-transactional-messenger/badge.svg?branch=main)](https://coveralls.io/github/fractalzombie/frzb-transactional-messenger?branch=main)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=fractalzombie_frzb-transactional-messenger&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=fractalzombie_frzb-transactional-messenger)
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=fractalzombie_frzb-transactional-messenger&metric=bugs)](https://sonarcloud.io/summary/new_code?id=fractalzombie_frzb-transactional-messenger)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=fractalzombie_frzb-transactional-messenger&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=fractalzombie_frzb-transactional-messenger)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=fractalzombie_frzb-transactional-messenger&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=fractalzombie_frzb-transactional-messenger)
[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=fractalzombie_frzb-transactional-messenger&metric=code_smells)](https://sonarcloud.io/summary/new_code?id=fractalzombie_frzb-transactional-messenger)
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=fractalzombie_frzb-transactional-messenger&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=fractalzombie_frzb-transactional-messenger)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=fractalzombie_frzb-transactional-messenger&metric=coverage)](https://sonarcloud.io/summary/new_code?id=fractalzombie_frzb-transactional-messenger)
[![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=fractalzombie_frzb-transactional-messenger&metric=sqale_index)](https://sonarcloud.io/summary/new_code?id=fractalzombie_frzb-transactional-messenger)
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=fractalzombie_frzb-transactional-messenger&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=fractalzombie_frzb-transactional-messenger)
[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=fractalzombie_frzb-transactional-messenger&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=fractalzombie_frzb-transactional-messenger)
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=fractalzombie_frzb-transactional-messenger&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=fractalzombie_frzb-transactional-messenger)

The `Transactional Messenger` component allows make messenger transactional

Expand Down
9 changes: 0 additions & 9 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,5 @@
<file>./TransactionalMessengerBundle.php</file>
<file>./TransactionalMessengerExtension.php</file>
</exclude>
<report>
<clover outputFile="build/logs/clover.xml" />
<cobertura outputFile="build/logs/cobertura.xml"/>
<html outputDirectory="build/logs/html" />
<xml outputDirectory="build/logs/xml"/>
</report>
</coverage>
<logging>
<junit outputFile="build/logs/junit.xml"/>
</logging>
</phpunit>
10 changes: 10 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
sonar.projectKey=fractalzombie_frzb-transactional-messenger
sonar.organization=fractalzombie
sonar.projectName=frzb-transactional-messenger
sonar.sources=Attribute,Enum,Event,EventListener,Exception,Helper,MessageBus,Storage,ValueObject
sonar.sourceEncoding=UTF-8
sonar.tests=Tests
sonar.exclusions=Resources/**,.docker/**,.github/**,vendor/**
sonar.php.coverage.reportPaths=tests-coverage.xml
sonar.php.tests.reportPath=tests-execution.xml
verbose=true

0 comments on commit 27164b5

Please sign in to comment.