PHP Tests #313
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
# SPDX-FileCopyrightText: Copyright 2021 M2mobi B.V., Amsterdam, The Netherlands | |
# SPDX-FileCopyrightText: Copyright 2022 Move Agency Group B.V., Zwolle, The Netherlands | |
# SPDX-License-Identifier: CC0-1.0 | |
name: PHP Tests | |
on: | |
push: | |
branches: | |
- master | |
- main | |
- release/* | |
schedule: | |
- cron: '30 5 * * 1-5' | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
phpunit: | |
runs-on: ubuntu-latest | |
continue-on-error: ${{ matrix.experimental }} | |
name: "PHP-${{ matrix.php-versions }}: PHPUnit" | |
strategy: | |
matrix: | |
php-versions: ['8.1', '8.2', '8.3'] | |
experimental: [false] | |
include: | |
- php-versions: 8.4 | |
experimental: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: uopz | |
tools: phpunit:9.5.x | |
- name: Setup problem matchers for PHP | |
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" | |
- name: Setup problem matchers for PHPUnit | |
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | |
- name: Install dependencies | |
run: composer update | |
- name: Setup fake certificates | |
run: | | |
touch entrust_root_certification_authority.pem | |
touch server_certificates_bundle_sandbox.pem | |
touch server_certificates_bundle_unreadable.pem | |
chmod 000 server_certificates_bundle_unreadable.pem | |
- name: Run PHPUnit | |
run: phpunit -c phpunit.xml | |
phpcs: | |
runs-on: ubuntu-latest | |
continue-on-error: false | |
name: "PHPCS" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup PHPCS | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
coverage: none | |
tools: cs2pr, phpcs | |
- name: Run PHPCS | |
run: phpcs -q --report=checkstyle ApnsPHP | cs2pr | |
phpstan: | |
runs-on: ubuntu-latest | |
continue-on-error: false | |
name: "PHPStan" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup PHPStan | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
coverage: none | |
tools: phpstan | |
extensions: uopz | |
- name: Install dependencies | |
run: composer update | |
- name: Run PHPStan | |
run: phpstan analyse ApnsPHP -l5 | |
conclusion: | |
needs: [phpunit, phpcs, phpstan] | |
continue-on-error: true | |
runs-on: ubuntu-latest | |
if: ${{ github.repository_owner == 'move-backend' && github.ref_name == 'master' }} | |
name: "Report status" | |
steps: | |
- name: Post build message | |
uses: slackapi/[email protected] | |
if: github.event_name != 'schedule' | |
with: | |
webhook: ${{ secrets.SLACK_WEBHOOK_URL }} | |
webhook-type: incoming-webhook | |
payload: | | |
text: "*GitHub Action build result*: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}" | |
blocks: | |
- type: "section" | |
text: | |
type: "mrkdwn" | |
text: "GitHub Action build result: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}" | |
- name: Post failure message | |
uses: slackapi/[email protected] | |
if: failure() | |
with: | |
webhook: ${{ secrets.SLACK_FAILURE_WEBHOOK_URL }} | |
webhook-type: incoming-webhook | |
payload: | | |
text: "*GitHub Action build result*: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}" | |
blocks: | |
- type: "section" | |
text: | |
type: "mrkdwn" | |
text: "GitHub Action build result: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}" |