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 dcd87bf
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 6 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
13 changes: 10 additions & 3 deletions .github/workflows/static.yml → .github/workflows/linter.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
on: [push, pull_request]
name: Static analysis
---
name: Linters

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

jobs:
phpstan:
Expand Down Expand Up @@ -37,7 +44,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
18 changes: 18 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
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"]'

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
11 changes: 9 additions & 2 deletions .github/workflows/ci.yml → .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
---
name: Tests
on: [push, pull_request]

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

jobs:

Expand All @@ -9,7 +16,7 @@ jobs:
strategy:
max-parallel: 10
matrix:
php: ['8.0', '8.1', '8.2']
php: ${{ fromJson(inputs.PHP_VERSIONS) }}

steps:
- name: Set up PHP
Expand Down

0 comments on commit dcd87bf

Please sign in to comment.