Skip to content

Commit ad09067

Browse files
committed
Update workflow
1 parent 3fa2d3a commit ad09067

File tree

1 file changed

+34
-44
lines changed

1 file changed

+34
-44
lines changed

.github/workflows/phar.yml

Lines changed: 34 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,10 @@ jobs:
145145
ref: 2.1.x
146146
phar-checksum: ${{needs.compiler-tests.outputs.checksum}}
147147

148-
checksum-phar:
149-
name: "Checksum PHAR"
150-
if: github.event_name == 'pull_request' && needs.compiler-tests.outputs.compiler_changed == 'true'
148+
download-base-sha-phar:
149+
name: "Download base SHA PHAR"
151150
needs: compiler-tests
151+
if: github.event_name == 'pull_request' && needs.compiler-tests.outputs.compiler_changed == 'true'
152152
runs-on: "ubuntu-latest"
153153
steps:
154154
- uses: actions/checkout@v4
@@ -182,16 +182,36 @@ jobs:
182182
const script = require('./.github/scripts/dist/find-artifact.js');
183183
await script({github, context, core})
184184
185+
# saved to phar-file-checksum/phpstan.phar
185186
- name: Download old artifact by ID
186187
uses: actions/download-artifact@v4
187188
with:
188189
artifact-ids: ${{ steps.find-artifact.outputs.artifact_id }}
189190
run-id: ${{ steps.find-artifact.outputs.run_id }}
190191
github-token: ${{ secrets.GITHUB_TOKEN }}
191192

193+
- name: "Upload old artifact"
194+
uses: actions/upload-artifact@v4
195+
with:
196+
name: phar-file-checksum-base
197+
path: phar-file-checksum/phpstan.phar
198+
199+
checksum-phar:
200+
name: "Checksum PHAR"
201+
needs:
202+
- compiler-tests
203+
- download-base-sha-phar
204+
runs-on: "ubuntu-latest"
205+
steps:
206+
# saved to phpstan.phar
207+
- name: "Download base phpstan.phar"
208+
uses: actions/download-artifact@v4
209+
with:
210+
name: phar-file-checksum-base
211+
192212
- name: "Save old checksum"
193213
id: "old_checksum"
194-
run: echo "md5=$(md5sum phar-file-checksum/phpstan.phar | cut -d' ' -f1)" >> $GITHUB_OUTPUT
214+
run: echo "md5=$(md5sum phpstan.phar | cut -d' ' -f1)" >> $GITHUB_OUTPUT
195215

196216
- name: "Assert checksum"
197217
run: |
@@ -201,54 +221,24 @@ jobs:
201221
202222
phar-prefix-diff:
203223
name: "PHAR Prefix Diff"
204-
if: github.event_name == 'pull_request' && needs.compiler-tests.outputs.compiler_changed == 'true'
205-
needs: compiler-tests
224+
needs: download-base-sha-phar
206225
runs-on: "ubuntu-latest"
207226
steps:
208227
- uses: actions/checkout@v4
209228

210-
- name: Get base commit SHA
211-
id: base
212-
run: echo "base_sha=${{ github.event.pull_request.base.sha }}" >> "$GITHUB_OUTPUT"
213-
214-
- name: Set up Node.js
215-
uses: actions/setup-node@v4
216-
with:
217-
node-version: 20
218-
219-
- name: Install dependencies
220-
working-directory: .github/scripts
221-
run: npm ci
222-
223-
- name: "Compile TS scripts"
224-
working-directory: .github/scripts
225-
run: npx tsc
226-
227-
- name: Find phar-file-checksum from base commit
228-
id: find-artifact
229-
uses: actions/github-script@v7
230-
env:
231-
BASE_SHA: ${{ steps.base.outputs.base_sha }}
232-
ARTIFACT_NAME: phar-file-checksum
233-
WORKFLOW_NAME: Compile PHAR
234-
with:
235-
script: |
236-
const script = require('./.github/scripts/dist/find-artifact.js');
237-
await script({github, context, core})
238-
239229
# saved to phar-file-checksum/phpstan.phar
240-
- name: Download old artifact by ID
230+
- name: "Download phpstan.phar"
241231
uses: actions/download-artifact@v4
242232
with:
243-
artifact-ids: ${{ steps.find-artifact.outputs.artifact_id }}
244-
run-id: ${{ steps.find-artifact.outputs.run_id }}
245-
github-token: ${{ secrets.GITHUB_TOKEN }}
233+
name: phar-file-checksum
234+
path: phar-file-checksum
246235

247-
# saved to phpstan.phar
248-
- name: "Download phpstan.phar"
236+
# saved to phar-file-checksum-base/phpstan.phar
237+
- name: "Download base phpstan.phar"
249238
uses: actions/download-artifact@v4
250239
with:
251-
name: phar-file-checksum
240+
name: phar-file-checksum-base
241+
path: phar-file-checksum-base
252242

253243
- name: "Install PHP"
254244
uses: "shivammathur/setup-php@v2"
@@ -264,10 +254,10 @@ jobs:
264254
run: "composer install"
265255

266256
- name: "Extract old phpstan.phar"
267-
run: "php ../box/vendor/bin/box extract phar-file-checksum/phpstan.phar phar-old"
257+
run: "php ../box/vendor/bin/box extract phar-file-checksum-base/phpstan.phar phar-old"
268258

269259
- name: "Extract new phpstan.phar"
270-
run: "php ../box/vendor/bin/box extract phpstan.phar phar-new"
260+
run: "php ../box/vendor/bin/box extract phar-file-checksum/phpstan.phar phar-new"
271261

272262
- name: "List prefix locations in old PHAR"
273263
run: "php .github/scripts/listPrefix.php ${{ github.workspace }}/phar-old > phar-old.txt"

0 commit comments

Comments
 (0)