Skip to content

Commit 0ca34fe

Browse files
committed
Detect supported PHP versions in range during CI instead of hardcoding them
The proposed changes use a GitHub Actions I created to detect supported PHP version in range of composer.json.
1 parent 130c9d4 commit 0ca34fe

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,23 @@ on:
55
pull_request:
66

77
jobs:
8+
supported-versions-matrix:
9+
name: Supported Versions Matrix
10+
runs-on: ubuntu-latest
11+
outputs:
12+
version: ${{ steps.supported-versions-matrix.outputs.version }}
13+
steps:
14+
- uses: actions/checkout@v3
15+
- id: supported-versions-matrix
16+
uses: WyriHaximus/github-action-composer-php-versions-in-range@v1
817
latest:
918
name: PHP ${{ matrix.php }} Latest
1019
runs-on: ubuntu-latest
20+
needs:
21+
- supported-versions-matrix
1122
strategy:
1223
matrix:
13-
php: ['7.1', '7.2', '7.3', '7.4', '8.0']
24+
php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }}
1425

1526
steps:
1627
- name: Checkout code
@@ -35,9 +46,11 @@ jobs:
3546
lowest:
3647
name: PHP ${{ matrix.php }} Lowest
3748
runs-on: ubuntu-latest
49+
needs:
50+
- supported-versions-matrix
3851
strategy:
3952
matrix:
40-
php: ['7.1', '7.2', '7.3', '7.4']
53+
php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }}
4154

4255
steps:
4356
- name: Checkout code

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
## [Unreleased]
1010

11+
- Detect supported PHP versions in range during CI instead of hardcoding them
12+
1113
### Changed
1214

1315
## [3.0.1] - 2021-10-20

0 commit comments

Comments
 (0)