Skip to content

Commit 7496e5b

Browse files
authored
Use PHP Matrix v1; Switch to composite action (#41)
1 parent 1c9a1de commit 7496e5b

15 files changed

+170
-1617
lines changed

.env

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,3 @@ updates:
55
directory: /
66
schedule:
77
interval: weekly
8-
9-
- package-ecosystem: docker
10-
directory: /
11-
schedule:
12-
interval: weekly
13-
14-
- package-ecosystem: composer
15-
directory: /
16-
schedule:
17-
interval: weekly

.github/workflows/composer-audit.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/composer-normalize.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,35 +19,71 @@ permissions: {}
1919

2020
jobs:
2121
positive:
22-
runs-on: ubuntu-latest
22+
runs-on: ${{ matrix.runs-on }}
2323
strategy:
2424
matrix:
25-
mode:
25+
runs-on:
26+
- ubuntu-latest
27+
composer-json:
28+
- composer.json
29+
- not-named-composer.json
30+
- sub/dir/composer.json
31+
- ../not/under/workdpace/composer.json
32+
mode:
2633
- minor-only
2734
- full
2835
source:
2936
- auto
3037
- php.net
3138
- offline
32-
case:
33-
# Use PHP v7 to ensure deterministic outcomes.
39+
case:
3440
- caret-7-3
3541
- exactly-7-3-5
3642
- complex
37-
43+
verify-attestation:
44+
- false
45+
include:
46+
- runs-on: ubuntu-24.04-arm
47+
composer-json: sub/dir/composer.json
48+
mode: full
49+
source: offline
50+
case: complex
51+
verify-attestation: true
52+
- runs-on: ubuntu-latest
53+
composer-json: sub/dir/composer.json
54+
mode: full
55+
source: offline
56+
case: complex
57+
verify-attestation: true
58+
- runs-on: macos-latest
59+
composer-json: sub/dir/composer.json
60+
mode: full
61+
source: offline
62+
case: complex
63+
verify-attestation: true
64+
- runs-on: macos-15-intel
65+
composer-json: sub/dir/composer.json
66+
mode: full
67+
source: offline
68+
case: complex
69+
verify-attestation: true
3870
steps:
3971
- uses: actions/checkout@v5
4072
with:
4173
path: local-action
4274

4375
- name: Create fake composer.json
44-
run: cp local-action/testdata/${{ matrix.case }}.composer.json composer.json
76+
run: |
77+
mkdir -p $(dirname ${{ matrix.composer-json }})
78+
cp local-action/testdata/${{ matrix.case }}.composer.json ${{ matrix.composer-json }}
4579
4680
- uses: ./local-action
4781
id: subject
4882
with:
83+
composer-json: ${{ matrix.composer-json }}
4984
mode: ${{ matrix.mode }}
5085
source: ${{ matrix.source }}
86+
verify-attestation: ${{ matrix.verify-attestation }}
5187

5288
- run: echo '${{ steps.subject.outputs.matrix }}' > actual.json
5389

@@ -57,21 +93,20 @@ jobs:
5793
runs-on: ubuntu-latest
5894
strategy:
5995
matrix:
60-
mode:
96+
mode:
6197
- minor-only
6298
- full
6399
source:
64100
- auto
65101
- php.net
66102
- offline
67-
case:
103+
case:
68104
- empty-json
69105
- invalid-constraint
70106
- invalid-json
71107
- match-none
72108
- missing-php
73109
- missing-require
74-
75110
steps:
76111
- uses: actions/checkout@v5
77112
with:
@@ -102,7 +137,6 @@ jobs:
102137
- auto
103138
- php.net
104139
- offline
105-
106140
steps:
107141
- uses: actions/checkout@v5
108142
with:

.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

Dockerfile

Lines changed: 0 additions & 17 deletions
This file was deleted.

action.yml

Lines changed: 110 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ branding:
77
color: black
88

99
inputs:
10+
composer-json:
11+
description: Path to composer.json
12+
default: composer.json
13+
1014
mode:
1115
description: Version format
1216
default: minor-only
@@ -15,10 +19,114 @@ inputs:
1519
description: Source of releases information
1620
default: auto
1721

22+
version:
23+
description: |
24+
The version of php-matrix to use. Leave blank for latest. For example: v1.0.2
25+
default: ''
26+
27+
verify-attestation:
28+
description: Whether to verify PHP matrix tarball attestation
29+
default: true
30+
31+
github-token:
32+
description: GitHub token to use for authentication
33+
default: ${{ github.token }}
34+
1835
outputs:
1936
matrix:
2037
description: The PHP version matrix
38+
value: ${{ steps.generate-matrix.outputs.matrix }}
2139

2240
runs:
23-
using: docker
24-
image: Dockerfile
41+
using: "composite"
42+
steps:
43+
- name: Download PHP Matrix (Linux arm64)
44+
if: ${{ runner.os == 'Linux' && runner.arch == 'ARM64' }}
45+
run: gh release download --repo typisttech/php-matrix --output php-matrix.tar.gz --pattern "${PATTERN}" "${TAG}"
46+
shell: bash
47+
working-directory: ${{ github.action_path }}
48+
env:
49+
PATTERN: php-matrix_linux_arm64.tar.gz
50+
TAG: ${{ inputs.version }}
51+
GH_TOKEN: ${{ inputs.github-token }}
52+
53+
- name: Download PHP Matrix (Linux amd64)
54+
if: ${{ runner.os == 'Linux' && runner.arch == 'x64' }}
55+
run: gh release download --repo typisttech/php-matrix --output php-matrix.tar.gz --pattern "${PATTERN}" "${TAG}"
56+
shell: bash
57+
working-directory: ${{ github.action_path }}
58+
env:
59+
PATTERN: php-matrix_linux_amd64.tar.gz
60+
TAG: ${{ inputs.version }}
61+
GH_TOKEN: ${{ github.token }}
62+
63+
- name: Download PHP Matrix (Darwin arm64)
64+
if: ${{ runner.os == 'macOS' && runner.arch == 'ARM64' }}
65+
run: gh release download --repo typisttech/php-matrix --output php-matrix.tar.gz --pattern "${PATTERN}" "${TAG}"
66+
shell: bash
67+
working-directory: ${{ github.action_path }}
68+
env:
69+
PATTERN: php-matrix_darwin_arm64.tar.gz
70+
TAG: ${{ inputs.version }}
71+
GH_TOKEN: ${{ inputs.github-token }}
72+
73+
- name: Download PHP Matrix (Darwin amd64)
74+
if: ${{ runner.os == 'macOS' && runner.arch == 'x64' }}
75+
run: gh release download --repo typisttech/php-matrix --output php-matrix.tar.gz --pattern "${PATTERN}" "${TAG}"
76+
shell: bash
77+
working-directory: ${{ github.action_path }}
78+
env:
79+
PATTERN: php-matrix_darwin_amd64.tar.gz
80+
TAG: ${{ inputs.version }}
81+
GH_TOKEN: ${{ inputs.github-token }}
82+
83+
- name: Verify Attestation
84+
if: ${{ inputs.verify-attestation == 'true' }}
85+
run: gh attestation verify --repo typisttech/php-matrix php-matrix.tar.gz
86+
shell: bash
87+
working-directory: ${{ github.action_path }}
88+
env:
89+
GH_TOKEN: ${{ inputs.github-token }}
90+
91+
- name: Unarchive the binary
92+
run: |
93+
mkdir bin
94+
tar -xvf php-matrix.tar.gz -C ./bin php-matrix
95+
shell: bash
96+
working-directory: ${{ github.action_path }}
97+
98+
- name: Add the binary into PATH
99+
run: echo "${ACTION_PATH}/bin" >> "$GITHUB_PATH"
100+
shell: bash
101+
env:
102+
ACTION_PATH: ${{ github.action_path }}
103+
104+
- name: Print PHP Matrix Version
105+
run: php-matrix --version
106+
shell: bash
107+
108+
- name: Generate Matrix
109+
id: generate-matrix
110+
run: |
111+
php-matrix composer --mode="${INPUT_MODE}" --source="${INPUT_SOURCE}" "${INPUT_COMPOSER_JSON}" > matrix 2>&1
112+
retVal=$?
113+
114+
echo "::group::===> Matrix Output"
115+
cat matrix
116+
echo "::endgroup::"
117+
118+
if [ $retVal -ne 0 ]; then
119+
echo "::error::Unable to generate matrix"
120+
exit 1
121+
fi
122+
123+
{
124+
echo 'matrix<<EOF'
125+
cat matrix
126+
echo EOF
127+
} >> "$GITHUB_OUTPUT"
128+
shell: sh
129+
env:
130+
INPUT_COMPOSER_JSON: ${{ inputs.composer-json }}
131+
INPUT_MODE: ${{ inputs.mode }}
132+
INPUT_SOURCE: ${{ inputs.source }}

bin/decode-php-constraint

Lines changed: 0 additions & 15 deletions
This file was deleted.

composer.json

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)