From 1fe784dba017f800ce6212443c6cda91fb6bb839 Mon Sep 17 00:00:00 2001 From: Piotr Synowiec Date: Sat, 13 Aug 2022 20:33:23 +0200 Subject: [PATCH] New CI self hosted SonarQube & self hosted action runners (#33) * new_ci: init new CI * new_ci: added sonarqube file --- .github/workflows/{tests.yml => ci.yml} | 41 +++++++++++++++---------- README.md | 22 +++++++++---- sonar-project.properties | 5 +++ 3 files changed, 45 insertions(+), 23 deletions(-) rename .github/workflows/{tests.yml => ci.yml} (50%) create mode 100644 sonar-project.properties diff --git a/.github/workflows/tests.yml b/.github/workflows/ci.yml similarity index 50% rename from .github/workflows/tests.yml rename to .github/workflows/ci.yml index d1a0dd9..8469e9e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/ci.yml @@ -1,19 +1,19 @@ -name: CI +name: CI+ on: push: branches: - - master - - dev + - '**' # matches every branch pull_request: branches: - master - dev + jobs: - tests: - runs-on: mysiar + build: + runs-on: self-hosted strategy: matrix: - php: ['7.2', '7.3', '7.4', '8.0', '8.1'] + php: [ '7.2', '7.3', '7.4', '8.0', '8.1' ] steps: - name: Setup PHP (PHP ${{ matrix.php }}) uses: shivammathur/setup-php@v2 @@ -21,21 +21,28 @@ jobs: php-version: ${{ matrix.php }} coverage: xdebug tools: composer - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 + with: + fetch-depth: 0 - name: Install Composer dependencies run: composer install + - name: PHPUnit tests (PHP ${{ matrix.php }}) + run: php${{ matrix.php }} ./vendor/bin/phpunit --testdox --verbose --stop-on-failure - uses: symfonycorp/security-checker-action@v3 - name: Coding standard (PHP ${{ matrix.php }}) run: php${{ matrix.php }} ./vendor/bin/ecs check src tests - - name: PHPUnit tests (PHP ${{ matrix.php }}) - run: php${{ matrix.php }} ./vendor/bin/phpunit --testdox --verbose --stop-on-failure - name: Code coverage run: php${{ matrix.php }} -d xdebug.mode=coverage ./vendor/bin/phpunit --coverage-clover=var/coverage.xml - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: ./var/coverage.xml - fail_ci_if_error: true - - name: Display the vulnerabilities as JSON - run: echo ${{ steps.security-check.outputs.vulns }} + - name: Fix code coverage paths + run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' var/coverage.xml + - name: Analyze with SonarQube + uses: sonarsource/sonarqube-scan-action@master + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + # If you wish to fail your job when the Quality Gate is red, uncomment the + # following lines. This would typically be used to fail a deployment. + # - uses: sonarsource/sonarqube-quality-gate-action@master + # timeout-minutes: 5 + # env: + # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/README.md b/README.md index d77ffed..afee879 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,24 @@ **Przelewy24 API V1 gateway for the Omnipay PHP payment processing library** -[![CI](https://github.com/mysiar/omnipay-przelewy24v1/actions/workflows/tests.yml/badge.svg)](https://github.com/mysiar/omnipay-przelewy24v1/actions) -[![codecov](https://codecov.io/gh/mysiar/omnipay-przelewy24v1/branch/main/graph/badge.svg?token=gW4QFlc4lw)](https://codecov.io/gh/mysiar/omnipay-przelewy24v1) -[![Latest Version](https://img.shields.io/github/release/mysiar/omnipay-przelewy24v1.svg)](https://github.com/mysiar/omnipay-przelewy24v1/releases) +[![CI](https://github.com/mysiar-org/omnipay-przelewy24v1/actions/workflows/tests.yml/badge.svg)](https://github.com/mysiar-org/omnipay-przelewy24v1/actions) +[![Latest Version](https://img.shields.io/github/release/mysiar-org/omnipay-przelewy24v1.svg)](https://github.com/mysiar/omnipay-przelewy24v1/releases) [![Total downloads](https://img.shields.io/packagist/dt/mysiar/omnipay-przelewy24v1.svg)](https://packagist.org/packages/mysiar/omnipay-przelewy24v1) -[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style)](LICENSE) -[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fmysiar%2Fomnipay-przelewy24v1.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fmysiar%2Fomnipay-przelewy24v1?ref=badge_shield) +[![GitHub license](https://img.shields.io/github/license/mysiar-org/omnipay-przelewy24v1)](https://github.com/mysiar-org/omnipay-przelewy24v1/blob/main/LICENSE) [![PHP Version Require](http://poser.pugx.org/mysiar/omnipay-przelewy24v1/require/php)](https://packagist.org/packages/mysiar/omnipay-przelewy24v1) -[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/mysiar/omnipay-przelewy24v1/badges/quality-score.png?b=main)](https://scrutinizer-ci.com/g/mysiar/omnipay-przelewy24v1/?branch=main) +[![GitHub stars](https://img.shields.io/github/stars/mysiar-org/omnipay-przelewy24v1)](https://github.com/mysiar-org/omnipay-przelewy24v1/stargazers) + +[![Coverage](https://sq.mysiar.dev/api/project_badges/measure?project=mysiar-org_omnipay-przelewy24v1_AYKYVbX_XdtDi-mnE6gc&metric=coverage&token=e3ee022dee8869d296c924b840b66e0aefb86f62)](https://sq.mysiar.dev/dashboard?id=mysiar-org_omnipay-przelewy24v1_AYKYVbX_XdtDi-mnE6gc) +[![Maintainability Rating](https://sq.mysiar.dev/api/project_badges/measure?project=mysiar-org_omnipay-przelewy24v1_AYKYVbX_XdtDi-mnE6gc&metric=sqale_rating&token=e3ee022dee8869d296c924b840b66e0aefb86f62)](https://sq.mysiar.dev/dashboard?id=mysiar-org_omnipay-przelewy24v1_AYKYVbX_XdtDi-mnE6gc) +[![Quality Gate Status](https://sq.mysiar.dev/api/project_badges/measure?project=mysiar-org_omnipay-przelewy24v1_AYKYVbX_XdtDi-mnE6gc&metric=alert_status&token=e3ee022dee8869d296c924b840b66e0aefb86f62)](https://sq.mysiar.dev/dashboard?id=mysiar-org_omnipay-przelewy24v1_AYKYVbX_XdtDi-mnE6gc) +[![Reliability Rating](https://sq.mysiar.dev/api/project_badges/measure?project=mysiar-org_omnipay-przelewy24v1_AYKYVbX_XdtDi-mnE6gc&metric=reliability_rating&token=e3ee022dee8869d296c924b840b66e0aefb86f62)](https://sq.mysiar.dev/dashboard?id=mysiar-org_omnipay-przelewy24v1_AYKYVbX_XdtDi-mnE6gc) +[![Security Rating](https://sq.mysiar.dev/api/project_badges/measure?project=mysiar-org_omnipay-przelewy24v1_AYKYVbX_XdtDi-mnE6gc&metric=security_rating&token=e3ee022dee8869d296c924b840b66e0aefb86f62)](https://sq.mysiar.dev/dashboard?id=mysiar-org_omnipay-przelewy24v1_AYKYVbX_XdtDi-mnE6gc) +[![Bugs](https://sq.mysiar.dev/api/project_badges/measure?project=mysiar-org_omnipay-przelewy24v1_AYKYVbX_XdtDi-mnE6gc&metric=bugs&token=e3ee022dee8869d296c924b840b66e0aefb86f62)](https://sq.mysiar.dev/dashboard?id=mysiar-org_omnipay-przelewy24v1_AYKYVbX_XdtDi-mnE6gc) +[![Code Smells](https://sq.mysiar.dev/api/project_badges/measure?project=mysiar-org_omnipay-przelewy24v1_AYKYVbX_XdtDi-mnE6gc&metric=code_smells&token=e3ee022dee8869d296c924b840b66e0aefb86f62)](https://sq.mysiar.dev/dashboard?id=mysiar-org_omnipay-przelewy24v1_AYKYVbX_XdtDi-mnE6gc) +[![Duplicated Lines (%)](https://sq.mysiar.dev/api/project_badges/measure?project=mysiar-org_omnipay-przelewy24v1_AYKYVbX_XdtDi-mnE6gc&metric=duplicated_lines_density&token=e3ee022dee8869d296c924b840b66e0aefb86f62)](https://sq.mysiar.dev/dashboard?id=mysiar-org_omnipay-przelewy24v1_AYKYVbX_XdtDi-mnE6gc) +[![Lines of Code](https://sq.mysiar.dev/api/project_badges/measure?project=mysiar-org_omnipay-przelewy24v1_AYKYVbX_XdtDi-mnE6gc&metric=ncloc&token=e3ee022dee8869d296c924b840b66e0aefb86f62)](https://sq.mysiar.dev/dashboard?id=mysiar-org_omnipay-przelewy24v1_AYKYVbX_XdtDi-mnE6gc) +[![Technical Debt](https://sq.mysiar.dev/api/project_badges/measure?project=mysiar-org_omnipay-przelewy24v1_AYKYVbX_XdtDi-mnE6gc&metric=sqale_index&token=e3ee022dee8869d296c924b840b66e0aefb86f62)](https://sq.mysiar.dev/dashboard?id=mysiar-org_omnipay-przelewy24v1_AYKYVbX_XdtDi-mnE6gc) +[![Vulnerabilities](https://sq.mysiar.dev/api/project_badges/measure?project=mysiar-org_omnipay-przelewy24v1_AYKYVbX_XdtDi-mnE6gc&metric=vulnerabilities&token=e3ee022dee8869d296c924b840b66e0aefb86f62)](https://sq.mysiar.dev/dashboard?id=mysiar-org_omnipay-przelewy24v1_AYKYVbX_XdtDi-mnE6gc) ## API endpoints implemented diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..acbbcc7 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,5 @@ +sonar.projectKey=mysiar-org_omnipay-przelewy24v1_AYKYVbX_XdtDi-mnE6gc +sonar.sources=src/ +sonar.tests=tests/ +sonar.verbose=true +sonar.php.coverage.reportPaths=var/coverage.xml