Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @kununu/rosa-mota-backend
* @kununu/backend-libraries
32 changes: 0 additions & 32 deletions .github/workflows/code_quality.yml

This file was deleted.

123 changes: 123 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: Continuous Integration

on:
push:
branches:
- main
pull_request:
types: [ opened, synchronize, reopened ]

env:
fail-fast: true

jobs:
checks:
name: Code Checks
runs-on: ubuntu-latest

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
coverage: none
tools: composer-dependency-analyser, composer-normalize, composer-require-checker

- name: Install Composer Dependencies
uses: ramsey/composer-install@v3
with:
dependency-versions: "highest"
composer-options: "--prefer-stable --optimize-autoloader --no-progress --no-interaction"

- name: Run Composer Dependency Analyser
run: composer-dependency-analyser

- name: Run Composer Require Checker
run: composer-require-checker

- name: Run Composer Normalize
run: composer-normalize --dry-run --indent-size 2 --indent-style space --no-check-lock --no-update-lock

- name: Run code style sniffer
run: vendor/bin/phpcs --standard=phpcs.xml Kununu/ tests/

- name: Run PHP CS Fixer
run: vendor/bin/php-cs-fixer check --using-cache=no --config php-cs-fixer.php

- name: Run PHPStan
run: vendor/bin/phpstan analyse

- name: Run Rector
run: vendor/bin/rector process --ansi --dry-run --config rector.php Kununu/ tests/

build:
needs: checks
name: PHPUnit
runs-on: ubuntu-latest
strategy:
matrix:
dependencies:
- lowest
- highest

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
coverage: pcov

- name: Install Composer Dependencies
uses: ramsey/composer-install@v3
with:
dependency-versions: ${{ matrix.dependencies }}
composer-options: "--prefer-stable --optimize-autoloader --no-progress --no-interaction"

- name: Run PHPUnit
run: |
vendor/bin/phpunit --colors=always --testdox \
--log-junit tests/.results/tests-junit.xml \
--coverage-clover tests/.results/tests-clover.xml

- name: Upload coverage files
uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}-8.4-${{ matrix.dependencies }}-coverage
include-hidden-files: true
path: tests/.results/

sonarcloud:
needs: build
name: SonarCloud Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/download-artifact@v4
with:
name: build-8.4-highest-coverage
path: tests/.results/

- name: Fix Code Coverage Paths
working-directory: tests/.results/
run: |
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' tests-clover.xml
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' tests-junit.xml

- name: SonarCloud Scan
uses: SonarSource/sonarqube-scan-action@v7.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
44 changes: 0 additions & 44 deletions .github/workflows/cs_sniff.yml

This file was deleted.

35 changes: 0 additions & 35 deletions .github/workflows/testing.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![Qodana](https://github.com/kununu/code-tools/actions/workflows/code_quality.yml/badge.svg)](https://github.com/kununu/code-tools/actions/workflows/code_quality.yml)

![Continuous Integration](https://github.com/kununu/code-tools/actions/workflows/continuous-integration.yml/badge.svg)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=kununu_code-tools&metric=alert_status)](https://sonarcloud.io/dashboard?id=kununu_code-tools)
<p align="center">
<img src="/docs/code-tools-logo.png" alt="Brancher"/>
</p>
Expand Down
27 changes: 27 additions & 0 deletions composer-dependency-analyser.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
declare(strict_types=1);

use ShipMonk\ComposerDependencyAnalyser\Config\Configuration;
use ShipMonk\ComposerDependencyAnalyser\Config\ErrorType;

$config = new Configuration();

return $config
->addPathToExclude(__DIR__ . '/tests')
->ignoreErrorsOnPath(__DIR__ . '/Kununu/Sniffs/', [ErrorType::UNKNOWN_CLASS])
->ignoreErrorsOnExtensions(
[
'ext-mbstring',
'ext-tokenizer',
],
[ErrorType::SHADOW_DEPENDENCY]
)
->ignoreErrorsOnPackages(
[
'friendsofphp/php-cs-fixer',
'phpstan/phpstan',
'rector/rector',
'squizlabs/php_codesniffer',
],
[ErrorType::UNUSED_DEPENDENCY]
);
27 changes: 27 additions & 0 deletions composer-require-checker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"symbol-whitelist": [
"mb_strlen",
"PHP_CodeSniffer\\Exceptions\\DeepExitException",
"PHP_CodeSniffer\\Files\\File",
"PHP_CodeSniffer\\Sniffs\\Sniff",
"PHP_CodeSniffer\\Standards\\Generic\\Sniffs\\Files\\LineLengthSniff",
"T_CLASS",
"T_FUNCTION",
"T_CLOSE_CURLY_BRACKET",
"T_COMMA",
"T_NULLABLE",
"T_OPEN_TAG",
"T_PRIVATE",
"T_PROTECTED",
"T_PUBLIC",
"T_READONLY",
"T_SEMICOLON",
"T_STRING",
"T_USE",
"T_VAR",
"T_VARIABLE",
"T_WHITESPACE",
"T_CONST",
"T_DECLARE"
]
}
Loading