From dcd87bf8de87eb4ac2c2cc0ac652b164eea5f242 Mon Sep 17 00:00:00 2001 From: PedroTroller Date: Mon, 26 Feb 2024 15:26:16 +0100 Subject: [PATCH] ci: deduplicate workflows runs --- .github/workflows/{bc.yml => bc.yaml} | 5 ++++- .github/workflows/{static.yml => linter.yaml} | 13 ++++++++++--- .github/workflows/pull-request.yaml | 18 ++++++++++++++++++ .github/workflows/push.yaml | 19 +++++++++++++++++++ .github/workflows/{ci.yml => test.yaml} | 11 +++++++++-- 5 files changed, 60 insertions(+), 6 deletions(-) rename .github/workflows/{bc.yml => bc.yaml} (93%) rename .github/workflows/{static.yml => linter.yaml} (87%) create mode 100644 .github/workflows/pull-request.yaml create mode 100644 .github/workflows/push.yaml rename .github/workflows/{ci.yml => test.yaml} (94%) diff --git a/.github/workflows/bc.yml b/.github/workflows/bc.yaml similarity index 93% rename from .github/workflows/bc.yml rename to .github/workflows/bc.yaml index 26296d5b..d07fc8b7 100644 --- a/.github/workflows/bc.yml +++ b/.github/workflows/bc.yaml @@ -1,5 +1,8 @@ -on: [push, pull_request] +--- name: Roave + +on: workflow_call + jobs: roave_bc_check: name: BC Check diff --git a/.github/workflows/static.yml b/.github/workflows/linter.yaml similarity index 87% rename from .github/workflows/static.yml rename to .github/workflows/linter.yaml index 83c47ba3..4f0d61ee 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/linter.yaml @@ -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: @@ -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 diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml new file mode 100644 index 00000000..4881eaa9 --- /dev/null +++ b/.github/workflows/pull-request.yaml @@ -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"]' diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml new file mode 100644 index 00000000..2f3c5faf --- /dev/null +++ b/.github/workflows/push.yaml @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/test.yaml similarity index 94% rename from .github/workflows/ci.yml rename to .github/workflows/test.yaml index 525ddc52..b1151b91 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/test.yaml @@ -1,5 +1,12 @@ +--- name: Tests -on: [push, pull_request] + +on: + workflow_call: + inputs: + PHP_VERSIONS: + type: string + required: true jobs: @@ -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