Skip to content

Commit

Permalink
Add validation for pull requests (phpstan + php-cs) (#107)
Browse files Browse the repository at this point in the history
* Extended validation to include linter and phpstan
* Add updated php version to .pubnub.yaml
  • Loading branch information
seba-aln authored Jul 22, 2024
1 parent 392d5a3 commit 6acaa88
Show file tree
Hide file tree
Showing 9 changed files with 9,410 additions and 1,021 deletions.
52 changes: 51 additions & 1 deletion .github/workflows/run-validations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,56 @@ defaults:
shell: bash

jobs:
lint-project:
name: "Lint project"
runs-on:
group: Default
strategy:
max-parallel: 1
fail-fast: true
steps:
- name: Checkout project
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout actions
uses: actions/checkout@v4
with:
repository: pubnub/client-engineering-deployment-tools
ref: v1
token: ${{ secrets.GH_TOKEN }}
path: .github/.release/actions
- name: Determine composer cache directory
id: composer-cache-dir
run: echo "dir=$(composer config cache-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer
uses: actions/cache@v4
with:
path: |
"${{ steps.composer-cache-dir.outputs.dir }}"
${{ github.workspace }}/vendor
key: ${{ runner.os }}-composer-8.3-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Setup PHP 8.3
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
tools: composer
coverage: none
- name: Setup dependencies
run: |
composer self-update && composer --version
composer install --prefer-dist --dev
- name: Run PHPStan
run: vendor/bin/phpstan analyze --memory-limit 256M
- name: Run phpcs on changed files
run: git diff --name-only origin/master HEAD | grep -E '\.php$' | xargs vendor/bin/phpcs --standard=PSR12
- name: Cancel workflow runs for commit on error
if: failure()
uses: ./.github/.release/actions/actions/utils/fast-jobs-failure


pubnub-yml:
name: "Validate .pubnub.yml"
runs-on:
Expand All @@ -34,7 +84,7 @@ jobs:
uses: ./.github/.release/actions/actions/utils/fast-jobs-failure
all-validations:
name: Validations
needs: [pubnub-yml]
needs: [pubnub-yml, lint-project]
runs-on:
group: Default
steps:
Expand Down
8 changes: 3 additions & 5 deletions .pubnub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,9 @@ supported-platforms:
- Mac OS X 10.8 or later, amd64
- Windows 7 or later, amd64, 386
editors:
- PHP 5.6
- PHP 7.0
- PHP 7.1
- PHP 7.2
- PHP 7.3
- PHP 8.1
- PHP 8.2
- PHP 8.3
sdks:
- full-name: PHP SDK
short-name: PHP
Expand Down
2 changes: 1 addition & 1 deletion acceptance.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"test": "./vendor/bin/phpunit tests/ --verbose --coverage-clover=coverage.clover"
},
"require": {
"php": ">=5.6.0",
"php": ">=8.1.0",
"rmccue/requests": "^1.0",
"monolog/monolog": "^1.26"
},
Expand Down
Loading

0 comments on commit 6acaa88

Please sign in to comment.