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
4 changes: 2 additions & 2 deletions .github/policies/msgraph-sdk-php-core-branch-protection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ configuration:
# 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
requiredStatusChecks:
- check-php-version-matrix
- SonarCloud
- SonarCloud Code Analysis
# Require branches to be up to date before merging. Requires requiredStatusChecks. boolean
requiresStrictStatusChecks: true
# Indicates whether there are restrictions on who can push. boolean. Should be set with whoCanPush.
Expand Down Expand Up @@ -71,7 +71,7 @@ configuration:
# 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
requiredStatusChecks:
- check-php-version-matrix
- SonarCloud
- SonarCloud Code Analysis
# Require branches to be up to date before merging. Requires requiredStatusChecks. boolean
requiresStrictStatusChecks: true
# Indicates whether there are restrictions on who can push. boolean. Should be set with whoCanPush.
Expand Down
32 changes: 24 additions & 8 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,34 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.4', '8.0', '8.1', '8.2']
php-versions: ['7.4', '8.1', '8.2', '8.3']
steps:
- uses: actions/checkout@v4.1.1
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
submodules: 'true'
php-version: ${{ matrix.php-versions }}
coverage: none
- name: Validate composer file
run: |
composer validate
- name: Install dependencies
run: |
composer install
- name: Run tests
run: ./vendor/bin/phpunit
- name: Run static analysis
run: |
vendor/bin/phpstan analyse --memory-limit=500M --error-format=github

code-coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
- name: Setup PHP and Xdebug for Code Coverage report
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
php-version: '8.0'
coverage: xdebug
- name: Validate composer file
run: |
Expand All @@ -39,20 +58,17 @@ jobs:
- name: Fix code coverage paths
run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml
- name: SonarCloud Scan
if: ${{ matrix.php-versions == '8.0' && !github.event.pull_request.head.repo.fork }}
if: ${{ !github.event.pull_request.head.repo.fork }}
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Run static analysis
run: |
vendor/bin/phpstan analyse --memory-limit=500M --error-format=github

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