Skip to content

Commit c8d0d7f

Browse files
authored
Debugging/sonarcloud required check (#164)
* Run code coverage only for php 8 * Rename sonarcloud status check job name
1 parent 11cbe70 commit c8d0d7f

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

.github/policies/msgraph-sdk-php-core-branch-protection.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ configuration:
3636
# Required status checks to pass before merging. Values can be any string, but if the value does not correspond to any existing status check, the status check will be stuck on pending for status since nothing exists to push an actual status
3737
requiredStatusChecks:
3838
- check-php-version-matrix
39-
- SonarCloud
39+
- SonarCloud Code Analysis
4040
# Require branches to be up to date before merging. Requires requiredStatusChecks. boolean
4141
requiresStrictStatusChecks: true
4242
# Indicates whether there are restrictions on who can push. boolean. Should be set with whoCanPush.
@@ -71,7 +71,7 @@ configuration:
7171
# Required status checks to pass before merging. Values can be any string, but if the value does not correspond to any existing status check, the status check will be stuck on pending for status since nothing exists to push an actual status
7272
requiredStatusChecks:
7373
- check-php-version-matrix
74-
- SonarCloud
74+
- SonarCloud Code Analysis
7575
# Require branches to be up to date before merging. Requires requiredStatusChecks. boolean
7676
requiresStrictStatusChecks: true
7777
# Indicates whether there are restrictions on who can push. boolean. Should be set with whoCanPush.

.github/workflows/pr-validation.yml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,34 @@ jobs:
1818
runs-on: ubuntu-latest
1919
strategy:
2020
matrix:
21-
php-versions: ['7.4', '8.0', '8.1', '8.2']
21+
php-versions: ['7.4', '8.1', '8.2', '8.3']
2222
steps:
2323
- uses: actions/checkout@v4.1.1
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
2426
with:
25-
submodules: 'true'
27+
php-version: ${{ matrix.php-versions }}
28+
coverage: none
29+
- name: Validate composer file
30+
run: |
31+
composer validate
32+
- name: Install dependencies
33+
run: |
34+
composer install
35+
- name: Run tests
36+
run: ./vendor/bin/phpunit
37+
- name: Run static analysis
38+
run: |
39+
vendor/bin/phpstan analyse --memory-limit=500M --error-format=github
40+
41+
code-coverage:
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v4.1.1
2645
- name: Setup PHP and Xdebug for Code Coverage report
2746
uses: shivammathur/setup-php@v2
2847
with:
29-
php-version: ${{ matrix.php-versions }}
48+
php-version: '8.0'
3049
coverage: xdebug
3150
- name: Validate composer file
3251
run: |
@@ -39,20 +58,17 @@ jobs:
3958
- name: Fix code coverage paths
4059
run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml
4160
- name: SonarCloud Scan
42-
if: ${{ matrix.php-versions == '8.0' && !github.event.pull_request.head.repo.fork }}
61+
if: ${{ !github.event.pull_request.head.repo.fork }}
4362
uses: SonarSource/sonarcloud-github-action@master
4463
env:
4564
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4665
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
47-
- name: Run static analysis
48-
run: |
49-
vendor/bin/phpstan analyse --memory-limit=500M --error-format=github
5066

5167
# The check-php-version-matrix returns success if all matrix jobs in build are successful; otherwise, it returns a failure.
5268
# Use this as a PR status check for GitHub Policy Service instead of individual matrix entry checks.
5369
check-php-version-matrix:
5470
runs-on: ubuntu-latest
55-
needs: validate-pull-request
71+
needs: [validate-pull-request, code-coverage]
5672
if: always()
5773
steps:
5874
- name: All build matrix options are successful

0 commit comments

Comments
 (0)