Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 38 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,44 @@ name: CI
on:
pull_request:

concurrency:
group: pr-${{ github.event.pull_request.number }}
cancel-in-progress: true

permissions:
contents: read

env:
PHP_VERSION: '8.5'

jobs:
load-config:
name: Load config
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
php-version: ${{ steps.config.outputs.php-version }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Resolve PHP version from composer.json
id: config
run: |
version=$(jq -r '.require.php' composer.json | grep -oP '\d+\.\d+' | head -1)
echo "php-version=$version" >> "$GITHUB_OUTPUT"

build:
name: Build
needs: load-config
runs-on: ubuntu-latest

timeout-minutes: 15
steps:
Comment thread
gustavofreze marked this conversation as resolved.
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@v4

- name: Configure PHP
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
tools: composer:2
php-version: ${{ needs.load-config.outputs.php-version }}
Comment thread
gustavofreze marked this conversation as resolved.

- name: Validate composer.json
run: composer validate --no-interaction
Expand All @@ -31,7 +49,7 @@ jobs:
run: composer install --no-progress --optimize-autoloader --prefer-dist --no-interaction

- name: Upload vendor and composer.lock as artifact
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@v4
with:
name: vendor-artifact
path: |
Expand All @@ -40,21 +58,21 @@ jobs:

auto-review:
name: Auto review
needs: [load-config, build]
runs-on: ubuntu-latest
needs: build

timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@v4

- name: Configure PHP
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
tools: composer:2
php-version: ${{ needs.load-config.outputs.php-version }}
Comment thread
gustavofreze marked this conversation as resolved.

- name: Download vendor artifact from build
uses: actions/download-artifact@v8
uses: actions/download-artifact@v4
with:
name: vendor-artifact
path: .
Expand All @@ -64,21 +82,21 @@ jobs:

tests:
name: Tests
needs: [load-config, auto-review]
runs-on: ubuntu-latest
needs: auto-review

timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@v4

- name: Configure PHP
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
tools: composer:2
php-version: ${{ needs.load-config.outputs.php-version }}
Comment thread
gustavofreze marked this conversation as resolved.

- name: Download vendor artifact from build
uses: actions/download-artifact@v8
uses: actions/download-artifact@v4
with:
name: vendor-artifact
path: .
Expand Down
Loading
Loading