27
27
verify-available-downloads :
28
28
runs-on : ubuntu-latest
29
29
30
- # Only run this workflow in the context of this repo.
31
- if : github.repository_owner == 'PHPCSStandards'
30
+ # Only run this workflow in the context of this repo.
31
+ if : github.repository_owner == 'PHPCSStandards'
32
32
33
33
strategy :
34
34
fail-fast : false
@@ -109,9 +109,11 @@ jobs:
109
109
ini-values : error_reporting=-1, display_errors=On
110
110
coverage : none
111
111
112
- # Note: the `.` is in the command to make it work for both PHPCS as well PHPCBF.
112
+ - name : Create a PHP file
113
+ run : echo '<?php echo "Hello, World!";' > hello.php
114
+
113
115
- name : Verify the PHAR is nominally functional
114
- run : php ${{ steps.source.outputs.FILE }} . -e --standard=PSR12
116
+ run : php ${{ steps.source.outputs.FILE }} -- -ps hello.php --standard=PSR2
115
117
116
118
- name : Grab the version
117
119
id : asset_version
@@ -133,8 +135,8 @@ jobs:
133
135
verify-phive :
134
136
runs-on : ubuntu-latest
135
137
136
- # Only run this workflow in the context of this repo.
137
- if : github.repository_owner == 'PHPCSStandards'
138
+ # Only run this workflow in the context of this repo.
139
+ if : github.repository_owner == 'PHPCSStandards'
138
140
139
141
strategy :
140
142
fail-fast : false
@@ -146,24 +148,28 @@ jobs:
146
148
name : " PHIVE: ${{ matrix.pharfile }}"
147
149
148
150
steps :
149
- - name : Retrieve latest release info
150
-
151
- id : get_latest_release
152
- with :
153
- route : GET /repos/PHPCSStandards/PHP_CodeSniffer/releases/latest
151
+ # Phive does not support a stability flag yet, so it will always download the
152
+ # very latest release, even when this is a pre-release.
153
+ # I.e. to verify the downloaded version, we need to select the version number including pre-releases.
154
+ # Ref: https://github.com/phar-io/phive/issues/154
155
+ - name : Retrieve latest release info (including prereleases)
156
+ id : latest_release
157
+ run : |
158
+ latestRelease="$(gh release list --repo PHPCSStandards/PHP_CodeSniffer --limit 1 --json tagName --jq '.[0].tagName')"
159
+ echo "TAG=$latestRelease" >> "$GITHUB_OUTPUT"
154
160
env :
155
161
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
156
162
157
- - name : " DEBUG: Show API request failure status"
158
- if : ${{ failure() }}
159
- run : " echo No release found. Request failed with status ${{ steps.get_latest_release.outputs.status }}"
163
+ - name : " DEBUG: Show tag name found in API response"
164
+ run : " echo ${{ steps.latest_release.outputs.TAG }}"
160
165
161
- - name : Grab latest tag name from API response
166
+ # Just get the version number, without alpha/beta/RC.
167
+ - name : Clean up the version number
162
168
id : version
163
- run : |
164
- echo "TAG=${{ fromJson( steps.get_latest_release .outputs.data).tag_name }}" >> "$GITHUB_OUTPUT"
169
+ # yamllint disable-line rule:line-length
170
+ run : echo "TAG=$(echo '$ {{ steps.latest_release .outputs.TAG }}' | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+(\.[0-9]+)+') " >> "$GITHUB_OUTPUT"
165
171
166
- - name : " DEBUG: Show tag name found in API response "
172
+ - name : " DEBUG: Show cleaned up tag name "
167
173
run : " echo ${{ steps.version.outputs.TAG }}"
168
174
169
175
- name : Setup PHP
@@ -186,9 +192,11 @@ jobs:
186
192
GH_TOKEN : ${{ github.token }}
187
193
GH_FORCE_TTY : true
188
194
189
- # Note: the `.` is in the command to make it work for both PHPCS as well PHPCBF.
195
+ - name : Create a PHP file
196
+ run : echo '<?php echo "Hello, World!";' > hello.php
197
+
190
198
- name : Verify the PHAR is nominally functional
191
- run : php ./tools/${{ matrix.pharfile }} . -e --standard=PSR12
199
+ run : php ./tools/${{ matrix.pharfile }} -- -ps hello.php --standard=PSR2
192
200
193
201
- name : Grab the version
194
202
id : asset_version
0 commit comments