Merge pull request #1626 from microsoftgraph/kiota/v1.0/pipelinebuild… #1987
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) Microsoft Corporation. All rights reserved. | |
# Licensed under the MIT License. | |
name: "Build" | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
validate-pull-request: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-versions: ['7.4', '8.0', '8.1', '8.2'] | |
steps: | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
- uses: actions/checkout@v4 | |
- name: Validate composer file | |
run: | | |
composer validate | |
- name: Install dependencies | |
run: | | |
composer install -a | |
- name: run tests | |
run : | | |
vendor/bin/phpunit --coverage-text | |
- name: Run static analysis | |
run: | | |
vendor/bin/phpstan analyse --memory-limit=8G --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 | |
if: always() | |
steps: | |
- name: All build matrix options are successful | |
if: ${{ !(contains(needs.*.result, 'failure')) }} | |
run: exit 0 | |
- name: One or more build matrix options failed | |
if: ${{ contains(needs.*.result, 'failure') }} | |
run: exit 1 |