Skip to content

Commit 255e38b

Browse files
committed
Implement github action
1 parent 86aee53 commit 255e38b

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ PHP Code compiler - Phar executable compiling utility
1717
- [Install](#install)
1818
- [Requirements](#requirements)
1919
- [Quick install](#quick-install)
20+
- [Github Action](#github-action)
2021
- [License](#license)
2122

2223
## Usage
@@ -136,6 +137,38 @@ _Add execution permissions to the binary_
136137
chmod +x ${BINDIR}/phpcc
137138
```
138139

140+
### Github Action
141+
142+
A [github action](actions/install/action.yaml) is available for integration in CI scripts.
143+
144+
The action will install PHP (in the desired version), and the `phpcc` binary.
145+
146+
Synopsis: use `yannoff/phpcc/actions/install@<release>`.
147+
148+
#### Integration example
149+
150+
_Installing phpcc version 1.2.4 / PHP 8.0_
151+
152+
```yaml
153+
# ...
154+
jobs:
155+
job1:
156+
steps:
157+
- name: Checkout repository
158+
uses: actions/checkout@v4
159+
160+
- name: Install PHP & PHPCodeCompiler
161+
uses: yannoff/phpcc/actions/install@1.2.4
162+
with:
163+
php-version: 8.0
164+
165+
- name: Compile ACME application
166+
run: phpcc -q -e bin/acme.php -d src/Acme:php -d vendor/ -f LICENSE -o bin/acme
167+
168+
- name: Smoke test (show version)
169+
run: bin/acme --version
170+
```
171+
139172
## License
140173
141174
Licensed under the [MIT License](LICENSE).

actions/install/action.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#
2+
# This file is part of the PHP Code Compiler project
3+
#
4+
# Copyright (c) Yannoff (https://github.com/yannoff)
5+
#
6+
# @project PHP Code Compiler (yannoff/phpcc)
7+
# @homepage https://github.com/yannoff/phpcc
8+
# @license https://github.com/yannoff/phpcc/blob/main/LICENSE
9+
#
10+
# For the full copyright and license information, please view
11+
# the LICENSE file that was distributed with this source code.
12+
#
13+
14+
name: Install PHP Code Compiler (phpcc)
15+
author: Yannoff
16+
description: Install PHP Environment & Download PHP Code Compiler binary (phpcc)
17+
18+
inputs:
19+
php-version:
20+
description: The PHP version to install
21+
required: true
22+
23+
runs:
24+
using: composite
25+
steps:
26+
- name: Install PHP Environment
27+
uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: ${{ inputs.php-version }}
30+
coverage: none
31+
32+
- name: Download phpcc binary
33+
id: phpcc
34+
shell: bash
35+
run: curl -SL -O https://github.com/yannoff/phpcc/releases/latest/download/phpcc && chmod +x ./phpcc && mv -v phpcc /usr/local/bin

0 commit comments

Comments
 (0)