-
-
Notifications
You must be signed in to change notification settings - Fork 63
81 lines (70 loc) · 2.66 KB
/
reusable-build-phar.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Build PHAR files
on:
workflow_call:
inputs:
phpVersion:
description: "The PHP version to use. Defaults to PHP 8.0 as used for the releases."
type: string
required: false
default: '8.0'
uploadArtifacts:
description: "Whether or not to upload the artifacts. Defaults to false."
type: boolean
required: false
default: false
retentionDays:
description: "How long uploaded artifacts should remain available (in days). Defaults to 1 day."
type: string
required: false
default: 1
createAttestations:
description: "Whether or not to create attestations for the artifacts. Defaults to false."
type: boolean
required: false
default: false
jobs:
build:
runs-on: ubuntu-latest
name: "Build Phar on PHP: ${{ inputs.phpVersion }}"
continue-on-error: ${{ inputs.phpVersion == 'nightly' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.phpVersion }}
coverage: none
ini-values: phar.readonly=Off, error_reporting=-1, display_errors=On
- name: Build the phar files
run: php scripts/build-phar.php
# Provide provenance for generated binaries.
- name: Generate artifact attestations
if: ${{ inputs.createAttestations == true }}
uses: actions/attest-build-provenance@v2
with:
subject-path: |
${{ github.workspace }}/phpcs.phar
${{ github.workspace }}/phpcbf.phar
- name: Upload the PHPCS phar
if: ${{ inputs.uploadArtifacts == true }}
uses: actions/upload-artifact@v4
with:
name: phpcs-phar
path: ./phpcs.phar
if-no-files-found: error
retention-days: ${{ inputs.retentionDays }}
- name: Upload the PHPCBF phar
if: ${{ inputs.uploadArtifacts == true }}
uses: actions/upload-artifact@v4
with:
name: phpcbf-phar
path: ./phpcbf.phar
if-no-files-found: error
retention-days: ${{ inputs.retentionDays }}
# Both the below only check a file which is rarely changed and therefore unlikely to have issues.
# This test is about testing that the phars are functional, *not* about whether the code style complies.
- name: 'PHPCS: check code style using the Phar file to test the Phar is functional'
run: php phpcs.phar ./scripts
- name: 'PHPCBF: fix code style using the Phar file to test the Phar is functional'
run: php phpcbf.phar ./scripts