Skip to content

Commit

Permalink
ci: deduplicate workflows runs
Browse files Browse the repository at this point in the history
  • Loading branch information
PedroTroller committed Feb 26, 2024
1 parent 4301776 commit 83f9749
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 81 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/bc.yml → .github/workflows/bc.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
on: [push, pull_request]
---
name: Roave

on: workflow_call

jobs:
roave_bc_check:
name: BC Check
Expand Down
76 changes: 0 additions & 76 deletions .github/workflows/ci.yml

This file was deleted.

19 changes: 15 additions & 4 deletions .github/workflows/static.yml → .github/workflows/linter.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
on: [push, pull_request]
name: Static analysis
---
name: Linters

on:
workflow_call:
inputs:
PHP_VERSIONS:
type: string
required: true

jobs:

phpstan:
name: PHPStan
runs-on: ubuntu-latest
strategy:
matrix:
php: ${{ fromJson(inputs.PHP_VERSIONS) }}

steps:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: ${{ matrix.php }}
extensions: mongo, mbstring, fileinfo
tools: composer:v2

Expand All @@ -37,7 +48,7 @@ jobs:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
php-version: ${{ fromJson(inputs.PHP_VERSIONS)[0] }}
extensions: mongo, mbstring, fileinfo
tools: composer:v2

Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Pull-Request

on: pull_request

jobs:
bc:
uses: ./.github/workflows/bc.yaml

test:
uses: ./.github/workflows/test.yaml
with:
PHP_VERSIONS: '["8.0", "8.1", "8.2"]'
LAST_VERSION: '8.2'

linter:
uses: ./.github/workflows/linter.yaml
with:
PHP_VERSIONS: '["8.0", "8.1", "8.2"]'
19 changes: 19 additions & 0 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Push

on:
push:
branches:
- master

jobs:
bc:
uses: ./.github/workflows/bc.yaml

test:
uses: ./.github/workflows/test.yaml
with:
PHP_VERSIONS: ${{ toJson(["8.0", "8.1", "8.2"]) }}

linter:
uses: ./.github/workflows/linter.yaml
84 changes: 84 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
name: Tests

on:
workflow_call:
inputs:
PHP_VERSIONS:
type: string
required: true
LAST_VERSION:
type: string
required: true

jobs:

build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
php: ${{ fromJson(inputs.PHP_VERSIONS) }}

steps:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
tools: flex

- name: Checkout code
uses: actions/checkout@v2

- name: Download dependencies
run: |
composer update --no-interaction --prefer-dist --optimize-autoloader --prefer-stable
- name: Remove PHPSpec adapter tests
run: make remove-phpspec

- name: PHPSpec
run: php vendor/bin/phpspec run -fpretty --verbose

- name: PHPUnit
run: php vendor/bin/phpunit

adapter:
name: Adapter
runs-on: ubuntu-latest
strategy:
matrix:
include:
- { php: '${{ inputs.LAST_VERSION }}', package: 'async-aws/simple-s3:^1.0', phpspec: 'spec/Gaufrette/Adapter/AsyncAwsS3Spec.php' }
- { php: '${{ inputs.LAST_VERSION }}', package: 'aws/aws-sdk-php:^3.158', phpspec: 'spec/Gaufrette/Adapter/AwsS3Spec.php' }
- { php: '${{ inputs.LAST_VERSION }}', package: 'google/apiclient:^2.12', phpspec: 'spec/Gaufrette/Adapter/GoogleCloudStorageSpec.php' }
- { php: '${{ inputs.LAST_VERSION }}', package: 'doctrine/dbal:^2.3', phpspec: 'spec/Gaufrette/Adapter/DoctrineDbalSpec.php' }
- { php: '${{ inputs.LAST_VERSION }}', package: 'doctrine/dbal:^3.4', phpspec: 'spec/Gaufrette/Adapter/DoctrineDbalSpec.php' }
- { php: '${{ inputs.LAST_VERSION }}', package: 'league/flysystem:^1.0', phpspec: 'spec/Gaufrette/Adapter/FlysystemSpec.php' }
- { php: '${{ inputs.LAST_VERSION }}', package: 'microsoft/azure-storage-blob:^1.0', phpspec: 'spec/Gaufrette/Adapter/AzureBlobStore' }
- { php: '${{ inputs.LAST_VERSION }}', package: 'mongodb/mongodb:^1.1', phpspec: 'spec/Gaufrette/Adapter/GridFSSpec.php' }
- { php: '${{ inputs.LAST_VERSION }}', package: 'phpseclib/phpseclib:^2.0', phpspec: 'spec/Gaufrette/Adapter/PhpseclibSftpSpec.php' }

steps:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
tools: flex

- name: Checkout code
uses: actions/checkout@v2

- name: Download dependencies
run: |
composer req ${{ matrix.package }} --no-update
composer update --no-interaction --prefer-dist --optimize-autoloader --prefer-stable
- name: PHPSpec
if: ${{ matrix.phpspec }}
run: php vendor/bin/phpspec run -fpretty --verbose ${{ matrix.phpspec }}

- name: PHPUnit
run: php vendor/bin/phpunit

0 comments on commit 83f9749

Please sign in to comment.