Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7aead9a

Browse files
committedJan 20, 2023
ci(workflows): Add tests workflow
This workflow will - Run tests on push - Run SonarCloud analysis on push
1 parent 4417a31 commit 7aead9a

File tree

3 files changed

+62
-1
lines changed

3 files changed

+62
-1
lines changed
 

‎.github/workflows/release-please.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
name: release-please
2+
13
on:
24
push:
35
branches:
46
- main
5-
name: release-please
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
10+
cancel-in-progress: true
11+
612
jobs:
713
release-please:
814
runs-on: ubuntu-latest

‎.github/workflows/tests.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: tests
2+
3+
on:
4+
pull_request:
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
8+
cancel-in-progress: true
9+
10+
jobs:
11+
phpunit:
12+
name: PHPUnit
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 10
15+
steps:
16+
# Checkout the code
17+
- name: Checkout Code
18+
uses: actions/checkout@v3.3.0
19+
20+
# Setup PHP
21+
- name: Get PHP Version
22+
run: |
23+
echo "PHP_VERSION=$(cat composer.lock | jq -r '."platform-overrides".php')" >> $GITHUB_ENV
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@2.23.0
26+
with:
27+
php-version: ${{ env.PHP_VERSION }}
28+
29+
# Install dependencies
30+
- name: Cache Composer dependencies
31+
uses: actions/cache@v3.2.3
32+
with:
33+
path: vendor
34+
key: ${{ runner.os }}-vendor-${{ hashFiles('**/composer.lock') }}
35+
- name: Install dependencies
36+
run: composer install --prefer-dist --no-scripts --ignore-platform-reqs
37+
38+
# Run tests
39+
- name: Run Unit Tests
40+
run: |
41+
vendor/bin/phpunit --coverage-text --coverage-clover reports/coverage.xml
42+
43+
# SonarCloud
44+
- name: SonarCloud Scan
45+
uses: SonarSource/sonarcloud-github-action@master
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

‎sonar-project.properties

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
sonar.projectKey=geekcell_php-ddd
2+
sonar.organization=geekcell
3+
4+
sonar.sources=src
5+
sonar.exclusions=tests/**
6+
sonar.tests=tests
7+
sonar.php.coverage.reportPaths=reports/coverage.xml

0 commit comments

Comments
 (0)
Please sign in to comment.