Skip to content

Commit

Permalink
ci: change ci workflow to tests, configure sonar cloud
Browse files Browse the repository at this point in the history
  • Loading branch information
nulxrd committed Mar 3, 2024
1 parent 986d48a commit cf39e11
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 63 deletions.
61 changes: 0 additions & 61 deletions .github/workflows/continuous-integration.yml

This file was deleted.

64 changes: 64 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: "Tests"

on:
pull_request:
branches:
- "*.x"
paths:
- .github/workflows/tests.yml
- composer.*
- src/**
- tests/**
- phpunit.xml.dist
push:
branches:
- "*.x"
paths:
- .github/workflows/tests.yml
- composer.*
- src/**
- tests/**
- phpunit.xml.dist

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
fail-fast: true

permissions:
contents: read

jobs:
build:
runs-on: "ubuntu-latest"
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: xdebug
php-version: '8.2'

- name: Install dependencies
uses: ramsey/composer-install@v3

- name: Run tests
run: vendor/bin/phpunit --colors=always --coverage-clover=coverage.xml || true

- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
with:
args: >
-Dsonar.organization=charonlab
-Dsonar.projectKey=charonlab_charon-container
-Dsonar.php.coverage.reportPaths=coverage.xml
-Dsonar.sources=src/
-Dsonar.test.exclusions=tests/**
-Dsonar.tests=tests/
-Dsonar.verbose=true
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ composer.lock
.phpunit.cache/
phpunit.xml
.phpcs-cache
phpcs.xml
phpcs.xml
coverage.xml
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

[![PHP Version Require](https://poser.pugx.org/charonlab/charon-container/require/php)](https://packagist.org/packages/charonlab/charon-container)
[![Latest Stable Version](https://poser.pugx.org/charonlab/charon-container/v/stable)](https://packagist.org/packages/charonlab/charon-container)
[![Continuous Integration](https://github.com/charonlab/charon-container/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/charonlab/charon-container/actions)
[![tests](https://github.com/charonlab/charon-container/actions/workflows/tests.yml/badge.svg)](https://github.com/charonlab/charon-container/actions)
[![static analysis](https://github.com/charonlab/charon-container/actions/workflows/static-analysis.yml/badge.svg)](https://github.com/charonlab/charon-container/actions)
[![Total Downloads](https://poser.pugx.org/charonlab/charon-container/downloads)](https://packagist.org/charonlab/charon-container)
[![License](https://poser.pugx.org/charonlab/charon-container/license.svg)](https://packagist.org/packages/charonlab/charon-container)

Expand Down

0 comments on commit cf39e11

Please sign in to comment.