Skip to content
Draft
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
88 changes: 88 additions & 0 deletions .github/actions/setup-php-composer/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Setup PHP and Composer
description: Setup PHP with authentication and install Composer dependencies

inputs:
php-version:
description: The PHP version used to run the workflow.
required: false
default: '8.2'
extensions:
description: Comma-separated PHP extensions.
required: false
default: ''
coverage:
description: Code coverage driver.
required: false
default: none
tools:
description: Comma-separated tools for setup-php.
required: false
default: composer:v2
use-composer-cache:
description: Whether to restore and save Composer cache.
required: false
default: 'true'
composer-command:
description: Composer install/update command to run.
required: false
default: composer install --prefer-dist --no-interaction
yard-bot-pat:
description: Token used for GitHub API operations in setup-php.
required: true
ypackagist-api-key:
description: Username for packagist.yard.nl.
required: true
ypackagist-password:
description: Password for packagist.yard.nl.
required: true
satis-username:
description: Username for satis.yard.nl.
required: true
satis-password:
description: Password for satis.yard.nl.
required: true

runs:
using: composite
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php-version }}
extensions: ${{ inputs.extensions }}
tools: ${{ inputs.tools }}
coverage: ${{ inputs.coverage }}
github-token: ${{ inputs.yard-bot-pat }}
env:
COMPOSER_AUTH_JSON: |
{
"http-basic": {
"packagist.yard.nl": {
"username": "${{ inputs.ypackagist-api-key }}",
"password": "${{ inputs.ypackagist-password }}"
},
"satis.yard.nl": {
"username": "${{ inputs.satis-username }}",
"password": "${{ inputs.satis-password }}"
}
}
}

- name: Get Composer cache directory
id: composer-cache
if: ${{ inputs.use-composer-cache == 'true' }}
shell: bash
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"

- name: Restore Composer cache
if: ${{ inputs.use-composer-cache == 'true' }}
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-

- name: Install composer dependencies
shell: bash
run: ${{ inputs.composer-command }}
30 changes: 8 additions & 22 deletions .github/workflows/format-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,16 @@ jobs:
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
- name: Setup PHP and install Composer dependencies
uses: yardinternet/workflows/.github/actions/setup-php-composer@feat/optimize-composer
with:
php-version: ${{ inputs.php-version }}
tools: composer:v2
coverage: none
github-token: ${{ secrets.YARD_BOT_PAT }}
env:
COMPOSER_AUTH_JSON: |
{
"http-basic": {
"packagist.yard.nl": {
"username": "${{ secrets.YPACKAGIST_API_KEY }}",
"password": "${{ secrets.YPACKAGIST_PASSWORD }}"
},
"satis.yard.nl": {
"username": "${{ secrets.SATIS_USERNAME }}",
"password": "${{ secrets.SATIS_PASSWORD }}"
}
}
}

- name: Install composer dependencies
run: composer install --prefer-dist --no-interaction
composer-command: composer install --prefer-dist --no-interaction
yard-bot-pat: ${{ secrets.YARD_BOT_PAT }}
ypackagist-api-key: ${{ secrets.YPACKAGIST_API_KEY }}
ypackagist-password: ${{ secrets.YPACKAGIST_PASSWORD }}
satis-username: ${{ secrets.SATIS_USERNAME }}
satis-password: ${{ secrets.SATIS_PASSWORD }}

- name: Run PHP CS Fixer
run: ./vendor/bin/php-cs-fixer fix
Expand Down
85 changes: 36 additions & 49 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,52 +14,39 @@ concurrency:
cancel-in-progress: true

jobs:
phpstan:
name: phpstan
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php-version }}
tools: composer:v2
coverage: none
github-token: ${{ secrets.YARD_BOT_PAT }}
env:
COMPOSER_AUTH_JSON: |
{
"http-basic": {
"packagist.yard.nl": {
"username": "${{ secrets.YPACKAGIST_API_KEY }}",
"password": "${{ secrets.YPACKAGIST_PASSWORD }}"
},
"satis.yard.nl": {
"username": "${{ secrets.SATIS_USERNAME }}",
"password": "${{ secrets.SATIS_PASSWORD }}"
}
}
}

- name: Install composer dependencies
run: composer install --prefer-dist --no-interaction

- name: Dirty fix for previously defined function in packages php stubs
run: |
if [ -f ./vendor/laravel/framework/src/Illuminate/Foundation/helpers.php ]; then
sed -i -e 's#function __(#function a__(#' ./vendor/laravel/framework/src/Illuminate/Foundation/helpers.php
fi

if [ -f ./vendor/roots/acorn/src/Illuminate/Foundation/helpers.php ]; then
sed -i -e 's#function __(#function b__(#' ./vendor/roots/acorn/src/Illuminate/Foundation/helpers.php
fi

if [ -f ./vendor/larastan/larastan/stubs/common/Helpers.stub ]; then
sed -i -e 's#function __(#function c__(#' ./vendor/larastan/larastan/stubs/common/Helpers.stub
fi
- name: Run PHPStan
run: ./vendor/bin/phpstan --error-format=github
phpstan:
name: phpstan
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup PHP and install Composer dependencies
uses: yardinternet/workflows/.github/actions/setup-php-composer@feat/optimize-composer
with:
php-version: ${{ inputs.php-version }}
composer-command: composer install --prefer-dist --no-interaction
yard-bot-pat: ${{ secrets.YARD_BOT_PAT }}
ypackagist-api-key: ${{ secrets.YPACKAGIST_API_KEY }}
ypackagist-password: ${{ secrets.YPACKAGIST_PASSWORD }}
satis-username: ${{ secrets.SATIS_USERNAME }}
satis-password: ${{ secrets.SATIS_PASSWORD }}

- name: Dirty fix for previously defined function in packages php stubs
run: |
if [ -f ./vendor/laravel/framework/src/Illuminate/Foundation/helpers.php ]; then
sed -i -e 's#function __(#function a__(#' ./vendor/laravel/framework/src/Illuminate/Foundation/helpers.php
fi

if [ -f ./vendor/roots/acorn/src/Illuminate/Foundation/helpers.php ]; then
sed -i -e 's#function __(#function b__(#' ./vendor/roots/acorn/src/Illuminate/Foundation/helpers.php
fi

if [ -f ./vendor/larastan/larastan/stubs/common/Helpers.stub ]; then
sed -i -e 's#function __(#function c__(#' ./vendor/larastan/larastan/stubs/common/Helpers.stub
fi

- name: Run PHPStan
run: ./vendor/bin/phpstan --error-format=github
42 changes: 8 additions & 34 deletions .github/workflows/run-laravel-testbench-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,50 +44,24 @@ jobs:
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
- name: Setup PHP and install dependencies
uses: yardinternet/workflows/.github/actions/setup-php-composer@feat/optimize-composer
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo, xdebug
coverage: xdebug
tools: composer:v2
github-token: ${{ secrets.YARD_BOT_PAT }}
env:
COMPOSER_AUTH_JSON: |
{
"http-basic": {
"packagist.yard.nl": {
"username": "${{ secrets.YPACKAGIST_API_KEY }}",
"password": "${{ secrets.YPACKAGIST_PASSWORD }}"
},
"satis.yard.nl": {
"username": "${{ secrets.SATIS_USERNAME }}",
"password": "${{ secrets.SATIS_PASSWORD }}"
}
}
}
composer-command: composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update && composer update --prefer-dist --no-interaction
yard-bot-pat: ${{ secrets.YARD_BOT_PAT }}
ypackagist-api-key: ${{ secrets.YPACKAGIST_API_KEY }}
ypackagist-password: ${{ secrets.YPACKAGIST_PASSWORD }}
satis-username: ${{ secrets.SATIS_USERNAME }}
satis-password: ${{ secrets.SATIS_PASSWORD }}

- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --prefer-dist --no-interaction

- name: List Installed Dependencies
run: composer show -D

Expand Down
41 changes: 8 additions & 33 deletions .github/workflows/run-pest-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,49 +34,24 @@ jobs:
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
- name: Setup PHP and install dependencies
uses: yardinternet/workflows/.github/actions/setup-php-composer@feat/optimize-composer
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo, xdebug
coverage: xdebug
tools: composer:v2
github-token: ${{ secrets.YARD_BOT_PAT }}
env:
COMPOSER_AUTH_JSON: |
{
"http-basic": {
"packagist.yard.nl": {
"username": "${{ secrets.YPACKAGIST_API_KEY }}",
"password": "${{ secrets.YPACKAGIST_PASSWORD }}"
},
"satis.yard.nl": {
"username": "${{ secrets.SATIS_USERNAME }}",
"password": "${{ secrets.SATIS_PASSWORD }}"
}
}
}
composer-command: composer update --prefer-dist --no-interaction
yard-bot-pat: ${{ secrets.YARD_BOT_PAT }}
ypackagist-api-key: ${{ secrets.YPACKAGIST_API_KEY }}
ypackagist-password: ${{ secrets.YPACKAGIST_PASSWORD }}
satis-username: ${{ secrets.SATIS_USERNAME }}
satis-password: ${{ secrets.SATIS_PASSWORD }}

- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-

- name: Install dependencies
run: |
composer update --prefer-dist --no-interaction

- name: List Installed Dependencies
run: composer show -D

Expand Down
36 changes: 36 additions & 0 deletions composer-lock-diff/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Composer Lock Diff
description: Compares two composer.lock files and outputs the differences in a human-readable format.
author: Yard Digital Agency
branding:
icon: "lock"
color: "gray-dark"

runs:
using: composite
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Required to make it possible to compare with PR base branch

- name: Generate composer diff
id: composer_diff # To reference the output in comment
uses: IonBazan/composer-diff-action@v1
with:
with-platform: true
with-links: true
with-licenses: true

- uses: marocchino/sticky-pull-request-comment@v2
# An empty diff result will break this action.
if: ${{ steps.composer_diff.outputs.composer_diff_exit_code != 0 }}
with:
header: composer-diff # Creates a collapsed comment with the report
message: |
<details>
<summary>Composer package changes</summary>

${{ steps.composer_diff.outputs.composer_diff }}

</details>