Skip to content

Commit

Permalink
Merge pull request #51 from meltir/feature/worflow-version-matrix
Browse files Browse the repository at this point in the history
Update PHP workflow to use matrix strategy
  • Loading branch information
meltir committed Jan 20, 2024
2 parents 2efb4fe + 93b3d4f commit a09a06e
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 13 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/infection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,24 @@ jobs:
name: Infection
permissions:
checks: write
strategy:
matrix:
version: [ 8.1, 8.2, 8.3 ]
steps:
- uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
php-version: ${{ matrix.version }}

- name: Cache hash
id: get-cache-hash
run: |
COMPOSER_HASH=`cat composer.json | sha256sum | head -c 40`
DATE=`date -u "+%Y%m%d"`
echo "hash=$COMPOSER_HASH$DATE" >> "$GITHUB_OUTPUT"
VERSION="${{ matrix.version }}"
echo "hash=$COMPOSER_HASH$DATE$VERSION" >> "$GITHUB_OUTPUT"
shell: bash

- name: Cache Composer dependencies
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ jobs:
# runs-on: self-hosted
permissions:
checks: write
strategy:
matrix:
version: [ 8.1, 8.2, 8.3 ]
steps:
- uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
php-version: ${{ matrix.version }}

- name: Validate composer.json and composer.lock
run: composer validate --strict --no-check-lock
Expand All @@ -32,7 +35,8 @@ jobs:
run: |
COMPOSER_HASH=`cat composer.json | sha256sum | head -c 40`
DATE=`date -u "+%Y%m%d"`
echo "hash=$COMPOSER_HASH$DATE" >> "$GITHUB_OUTPUT"
VERSION="${{ matrix.version }}"
echo "hash=$COMPOSER_HASH$DATE$VERSION" >> "$GITHUB_OUTPUT"
shell: bash

- name: Cache Composer dependencies
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/phpcsfixer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,24 @@ jobs:
name: Check coding style
permissions:
checks: write
strategy:
matrix:
version: [ 8.1, 8.2, 8.3 ]
steps:
- uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
php-version: ${{ matrix.version }}

- name: Cache hash
id: get-cache-hash
run: |
COMPOSER_HASH=`cat composer.json | sha256sum | head -c 40`
DATE=`date -u "+%Y%m%d"`
echo "hash=$COMPOSER_HASH$DATE" >> "$GITHUB_OUTPUT"
VERSION="${{ matrix.version }}"
echo "hash=$COMPOSER_HASH$DATE$VERSION" >> "$GITHUB_OUTPUT"
shell: bash

- name: Cache Composer dependencies
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/phpinsights.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,24 @@ jobs:
insights:
runs-on: ubuntu-latest
name: Check insights
strategy:
matrix:
version: [ 8.1, 8.2, 8.3 ]
steps:
- uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
php-version: ${{ matrix.version }}

- name: Cache hash
id: get-cache-hash
run: |
COMPOSER_HASH=`cat composer.json | sha256sum | head -c 40`
DATE=`date -u "+%Y%m%d"`
echo "hash=$COMPOSER_HASH$DATE" >> "$GITHUB_OUTPUT"
VERSION="${{ matrix.version }}"
echo "hash=$COMPOSER_HASH$DATE$VERSION" >> "$GITHUB_OUTPUT"
shell: bash

- name: Cache Composer dependencies
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,24 @@ jobs:
standards:
runs-on: ubuntu-latest
name: Check standards
strategy:
matrix:
version: [ 8.1, 8.2, 8.3 ]
steps:
- uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
php-version: ${{ matrix.version }}

- name: Cache hash
id: get-cache-hash
run: |
COMPOSER_HASH=`cat composer.json | sha256sum | head -c 40`
DATE=`date -u "+%Y%m%d"`
echo "hash=$COMPOSER_HASH$DATE" >> "$GITHUB_OUTPUT"
VERSION="${{ matrix.version }}"
echo "hash=$COMPOSER_HASH$DATE$VERSION" >> "$GITHUB_OUTPUT"
shell: bash

- name: Cache Composer dependencies
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,24 @@ jobs:
runs-on: ubuntu-latest
permissions:
checks: write
strategy:
matrix:
version: [ 8.1, 8.2, 8.3 ]
steps:
- uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
php-version: ${{ matrix.version }}

- name: Cache hash
id: get-cache-hash
run: |
COMPOSER_HASH=`cat composer.json | sha256sum | head -c 40`
DATE=`date -u "+%Y%m%d"`
echo "hash=$COMPOSER_HASH$DATE" >> "$GITHUB_OUTPUT"
VERSION="${{ matrix.version }}"
echo "hash=$COMPOSER_HASH$DATE$VERSION" >> "$GITHUB_OUTPUT"
shell: bash

- name: Cache Composer dependencies
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
},
"minimum-stability": "stable",
"require": {
"php": ">=8.0 >=8.1 >=8.2 >=8.3",
"php": ">=8.1",
"symfony/dom-crawler": "5.4.* | 6.3.* | 7.0.*",
"symfony/css-selector": "5.4.* | 6.4.* | 7.0.*",
"psr/http-client": "^1.0",
Expand Down

0 comments on commit a09a06e

Please sign in to comment.