From 7a629674f8c0f180869a81bb43d39d4b467f9c46 Mon Sep 17 00:00:00 2001 From: Yannoff Date: Wed, 5 Nov 2025 12:10:18 +0100 Subject: [PATCH] Implement github action --- README.md | 33 +++++++++++++++++++++++++++++++++ actions/install/action.yaml | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 actions/install/action.yaml diff --git a/README.md b/README.md index 7f2a778..6736795 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ PHP Code compiler - Phar executable compiling utility - [Install](#install) - [Requirements](#requirements) - [Quick install](#quick-install) + - [Github Action](#github-action) - [License](#license) ## Usage @@ -136,6 +137,38 @@ _Add execution permissions to the binary_ chmod +x ${BINDIR}/phpcc ``` +### Github Action + +A [github action](actions/install/action.yaml) is available for integration in CI scripts. + +The action will install PHP (in the desired version), and the `phpcc` binary. + +Synopsis: use `yannoff/phpcc/actions/install@`. + +#### Integration example + +_Installing phpcc version 1.2.4 / PHP 8.0_ + +```yaml +# ... +jobs: + job1: + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install PHP & PHPCodeCompiler + uses: yannoff/phpcc/actions/install@1.2.4 + with: + php-version: 8.0 + + - name: Compile ACME application + run: phpcc -q -e bin/acme.php -d src/Acme:php -d vendor/ -f LICENSE -o bin/acme + + - name: Smoke test (show version) + run: bin/acme --version +``` + ## License Licensed under the [MIT License](LICENSE). diff --git a/actions/install/action.yaml b/actions/install/action.yaml new file mode 100644 index 0000000..e74136d --- /dev/null +++ b/actions/install/action.yaml @@ -0,0 +1,35 @@ +# +# This file is part of the PHP Code Compiler project +# +# Copyright (c) Yannoff (https://github.com/yannoff) +# +# @project PHP Code Compiler (yannoff/phpcc) +# @homepage https://github.com/yannoff/phpcc +# @license https://github.com/yannoff/phpcc/blob/main/LICENSE +# +# For the full copyright and license information, please view +# the LICENSE file that was distributed with this source code. +# + +name: Install PHP Code Compiler (phpcc) +author: Yannoff +description: Install PHP Environment & Download PHP Code Compiler binary (phpcc) + +inputs: + php-version: + description: The PHP version to install + required: true + +runs: + using: composite + steps: + - name: Install PHP Environment + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ inputs.php-version }} + coverage: none + + - name: Download phpcc binary + id: phpcc + shell: bash + run: curl -SL -O https://github.com/yannoff/phpcc/releases/latest/download/phpcc && chmod +x ./phpcc && mv -v phpcc /usr/local/bin