Skip to content

Commit

Permalink
Merge pull request #6 from inpsyde/workflows
Browse files Browse the repository at this point in the history
GitHub Actions Workflows
  • Loading branch information
tfrommen authored Jan 6, 2025
2 parents 2db0915 + 724fc9c commit cf2cb4a
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 83 deletions.
44 changes: 22 additions & 22 deletions .github/workflows/_phpstan.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
name: PHPStan

on:
workflow_call:
inputs:
PHP_VERSION:
description: PHP version which PHPStan will be executed on.
default: '8.1'
required: false
type: string
workflow_call:
inputs:
PHP_VERSION:
description: PHP version which PHPStan will be executed on.
default: '8.1'
required: false
type: string

jobs:
phpstan:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.PHP_VERSION }}
tools: composer, cs2pr
coverage: none
- run: composer validate
- uses: ramsey/composer-install@v3
with:
composer-options: '--prefer-dist'
- run: ./vendor/bin/phpstan analyse --no-progress --memory-limit=1G
phpstan:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.PHP_VERSION }}
tools: composer, cs2pr
coverage: none
- run: composer validate
- uses: ramsey/composer-install@v3
with:
composer-options: '--prefer-dist'
- run: ./vendor/bin/phpstan analyse --no-progress --memory-limit=1G
9 changes: 9 additions & 0 deletions .github/workflows/lint-workflows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Lint GitHub Actions Workflows

on:
pull_request:
workflow_dispatch:

jobs:
lint-workflows:
uses: inpsyde/reusable-workflows/.github/workflows/lint-workflows.yml@main
122 changes: 61 additions & 61 deletions .github/workflows/quality-assurance-php.yml
Original file line number Diff line number Diff line change
@@ -1,71 +1,71 @@
name: PHP Quality Assurance

on:
pull_request:
paths:
- 'Syde/**'
- 'tests/**'
- '**ruleset.xml'
- '.github/workflows/quality-assurance-php.yml'
- 'composer.json'
- 'phpcs.xml'
- 'phpstan.neon.dist'
- 'phpunit.xml.dist'
workflow_dispatch:
inputs:
jobs:
required: true
type: choice
default: 'Run all'
description: 'Choose jobs to run'
options:
- 'Run all'
- 'Run lint only'
- 'Run PHPCS only'
- 'Run PHPStan only'
- 'Run static analysis'
- 'Run unit tests only'
pull_request:
paths:
- 'Syde/**'
- 'tests/**'
- '**ruleset.xml'
- '.github/workflows/quality-assurance-php.yml'
- 'composer.json'
- 'phpcs.xml'
- 'phpstan.neon.dist'
- 'phpunit.xml.dist'
workflow_dispatch:
inputs:
jobs:
required: true
type: choice
default: 'Run all'
description: 'Choose jobs to run'
options:
- 'Run all'
- 'Run lint only'
- 'Run PHPCS only'
- 'Run PHPStan only'
- 'Run static analysis'
- 'Run unit tests only'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint-php:
if: ${{ (github.event_name != 'workflow_dispatch') || ((github.event.inputs.jobs == 'Run all') || (github.event.inputs.jobs == 'Run lint only') || (github.event.inputs.jobs == 'Run static analysis')) }}
uses: inpsyde/reusable-workflows/.github/workflows/lint-php.yml@main
strategy:
matrix:
php-version: [ '8.1', '8.2', '8.3', '8.4' ]
with:
PHP_VERSION: ${{ matrix.php-version }}
LINT_ARGS: '-e php --colors --show-deprecated ./Syde ./tests --exclude ./tests/fixtures/return-type-declaration.php'
lint-php:
if: ${{ (github.event_name != 'workflow_dispatch') || ((github.event.inputs.jobs == 'Run all') || (github.event.inputs.jobs == 'Run lint only') || (github.event.inputs.jobs == 'Run static analysis')) }}
uses: inpsyde/reusable-workflows/.github/workflows/lint-php.yml@main
strategy:
matrix:
php-version: [ '8.1', '8.2', '8.3', '8.4' ]
with:
PHP_VERSION: ${{ matrix.php-version }}
LINT_ARGS: '-e php --colors --show-deprecated ./Syde ./tests --exclude ./tests/fixtures/return-type-declaration.php'

coding-standards-analysis-php:
if: ${{ (github.event_name != 'workflow_dispatch') || ((github.event.inputs.jobs == 'Run all') || (github.event.inputs.jobs == 'Run PHPCS only') || (github.event.inputs.jobs == 'Run static analysis')) }}
uses: inpsyde/reusable-workflows/.github/workflows/coding-standards-php.yml@main
strategy:
matrix:
php-version: [ '8.1', '8.2', '8.3', '8.4' ]
with:
PHP_VERSION: ${{ matrix.php-version }}
coding-standards-analysis-php:
if: ${{ (github.event_name != 'workflow_dispatch') || ((github.event.inputs.jobs == 'Run all') || (github.event.inputs.jobs == 'Run PHPCS only') || (github.event.inputs.jobs == 'Run static analysis')) }}
uses: inpsyde/reusable-workflows/.github/workflows/coding-standards-php.yml@main
strategy:
matrix:
php-version: [ '8.1', '8.2', '8.3', '8.4' ]
with:
PHP_VERSION: ${{ matrix.php-version }}

static-code-analysis-php:
if: ${{ (github.event_name != 'workflow_dispatch') || ((github.event.inputs.jobs == 'Run all') || (github.event.inputs.jobs == 'Run PHPStan only') || (github.event.inputs.jobs == 'Run static analysis')) }}
# TODO: Replace with public Syde static-analysis-php reusable workflow as soon as PHPStan support is added.
uses: ./.github/workflows/_phpstan.yml
strategy:
matrix:
php-version: [ '8.1', '8.2', '8.3', '8.4' ]
with:
PHP_VERSION: ${{ matrix.php-version }}
static-code-analysis-php:
if: ${{ (github.event_name != 'workflow_dispatch') || ((github.event.inputs.jobs == 'Run all') || (github.event.inputs.jobs == 'Run PHPStan only') || (github.event.inputs.jobs == 'Run static analysis')) }}
# TODO: Replace with public Syde static-analysis-php reusable workflow as soon as PHPStan support is added.
uses: ./.github/workflows/_phpstan.yml
strategy:
matrix:
php-version: [ '8.1', '8.2', '8.3', '8.4' ]
with:
PHP_VERSION: ${{ matrix.php-version }}

tests-unit-php:
if: ${{ (github.event_name != 'workflow_dispatch') || ((github.event.inputs.jobs == 'Run all') || (github.event.inputs.jobs == 'Run unit tests only')) }}
uses: inpsyde/reusable-workflows/.github/workflows/tests-unit-php.yml@main
strategy:
matrix:
php-version: [ '8.1', '8.2', '8.3', '8.4' ]
with:
PHP_VERSION: ${{ matrix.php-version }}
PHPUNIT_ARGS: '--no-coverage'
tests-unit-php:
if: ${{ (github.event_name != 'workflow_dispatch') || ((github.event.inputs.jobs == 'Run all') || (github.event.inputs.jobs == 'Run unit tests only')) }}
uses: inpsyde/reusable-workflows/.github/workflows/tests-unit-php.yml@main
strategy:
matrix:
php-version: [ '8.1', '8.2', '8.3', '8.4' ]
with:
PHP_VERSION: ${{ matrix.php-version }}
PHPUNIT_ARGS: '--no-coverage'

0 comments on commit cf2cb4a

Please sign in to comment.