CI: Enforce passing phpcs and phpstan #191
Workflow file for this run
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, pull_request] | |
jobs: | |
phpunit: | |
runs-on: ubuntu-latest | |
continue-on-error: ${{ matrix.experimental }} | |
name: "PHP-${{ matrix.php-versions }}: PHPUnit" | |
strategy: | |
matrix: | |
php-versions: ['7.4', '8.0', '8.1'] | |
experimental: [false] | |
include: | |
- php-versions: 8.2 | |
experimental: true | |
- php-versions: 8.3 | |
experimental: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- 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 | |
sample_push: | |
runs-on: ubuntu-latest | |
continue-on-error: ${{ matrix.experimental }} | |
name: "PHP-${{ matrix.php-versions }}: Sample" | |
strategy: | |
matrix: | |
php-versions: ['7.4', '8.0', '8.1'] | |
experimental: [false] | |
include: | |
- php-versions: 8.2 | |
experimental: true | |
- php-versions: 8.3 | |
experimental: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
coverage: none | |
extensions: uopz | |
- name: Setup problem matchers for PHP | |
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" | |
- name: Install dependencies | |
run: composer update | |
- name: Setup fake certificates | |
run: | | |
touch entrust_root_certification_authority.pem | |
touch server_certificates_bundle_sandbox.pem | |
- name: Run sample | |
run: php sample_push.php | grep "Trying to initialize HTTP/2 backend" | |
phpcs: | |
runs-on: ubuntu-latest | |
continue-on-error: false | |
name: "PHPCS" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- 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@v3 | |
- 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 |