Skip to content

Commit

Permalink
split workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
kafkiansky committed Jan 22, 2025
1 parent 07b75b0 commit 88e4d56
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 130 deletions.
136 changes: 6 additions & 130 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,135 +1,11 @@
on:
push:
branches: [ 'main', '*.*.x' ]
branches: ['main', '*.*.x']
pull_request: ~
workflow_call:
inputs:
php_versions:
description: PHP versions in JSON array format
type: string
default: '["8.3"]'
dependencies:
description: Dependency versions (locked, lowest, highest) in JSON array format
type: string
default: '["locked", "lowest", "highest"]'
test:
type: boolean
default: true
infection:
type: boolean
default: true
secrets:
COMPOSER_AUTH:
required: false
CODECOV_TOKEN:
description: Codecov.io token
required: false
STRYKER_DASHBOARD_API_KEY:
required: false

jobs:
composer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ fromJSON(inputs.php_versions)[0] }}
tools: composer:v2
coverage: none
- run: composer validate
- uses: ramsey/composer-install@v3
with:
composer-options: --optimize-autoloader
env:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH || '{}' }}
- run: composer normalize --dry-run
- run: composer check-require
- run: composer check-unused

php-cs-fixer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ fromJSON(inputs.php_versions)[0] }}
tools: composer:v2, cs2pr
coverage: none
- uses: ramsey/composer-install@v3
with:
composer-options: --optimize-autoloader
env:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH || '{}' }}
- run: composer fixcs -- --dry-run --format=checkstyle | cs2pr

phpstan:
runs-on: ubuntu-latest
strategy:
matrix:
php: ${{ fromJson(inputs.php_versions) }}
dependencies: ${{ fromJson(inputs.dependencies) }}
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: none
- uses: ramsey/composer-install@v3
with:
composer-options: --optimize-autoloader
dependency-versions: ${{ matrix.dependencies }}
env:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH || '{}' }}
- run: composer phpstan -- --error-format=github

test:
if: inputs.test
runs-on: ubuntu-latest
strategy:
matrix:
php: ${{ fromJson(inputs.php_versions) }}
dependencies: ${{ fromJson(inputs.dependencies) }}
steps:
- id: coverage
run: |
echo "coverage=${{ secrets.codecov-token && (matrix.php == fromJson(inputs.php_versions)[0]) && (matrix.dependencies == fromJson(inputs.dependencies)[0]) && '1' || '' }}" >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
ini-file: development
tools: composer:v2
coverage: ${{ steps.coverage.outputs.coverage && 'pcov' || '' }}
- uses: ramsey/composer-install@v3
with:
composer-options: --optimize-autoloader
dependency-versions: ${{ matrix.dependencies }}
env:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH || '{}' }}
- uses: namoshek/rabbitmq-github-action@v1
- run: THESIS_AMQP_DSN="amqp://guest:guest@127.0.0.1:5673/?tcp_nodelay=true" composer test -- --colors=always ${{ steps.coverage.outputs.coverage && '--coverage-clover coverage.xml' || '' }}
- if: ${{ steps.coverage.outputs.coverage }}
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.codecov-token }}

infection:
if: inputs.test && inputs.infection
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ fromJSON(inputs.php_versions)[0] }}
ini-file: development
tools: composer:v2
- uses: ramsey/composer-install@v3
with:
composer-options: --optimize-autoloader
env:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH || '{}' }}
- run: composer infection
env:
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
check:
uses: thesisphp/.github/.github/workflows/check.yml@main
with:
test: false
secrets: inherit
29 changes: 29 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
on:
push:
branches: ['main', '*.*.x']
pull_request: ~

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
php: "8.3"
dependencies: ["locked", "lowest", "highest"]
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
ini-file: development
tools: composer:v2
extensions: pcntl
ini-values: disable_functions=pcntl_fork
- uses: ramsey/composer-install@v3
with:
composer-options: --optimize-autoloader
dependency-versions: ${{ matrix.dependencies }}
env:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH || '{}' }}
- uses: namoshek/rabbitmq-github-action@v1
- run: THESIS_AMQP_DSN="amqp://guest:guest@127.0.0.1:5673/?tcp_nodelay=true" composer test -- --colors=always

0 comments on commit 88e4d56

Please sign in to comment.