Build PHP Extension https://pecl.php.net/package/redis/6.1.0, https://pecl.php.net/package/redis/6.1.0 #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build PHP Extension From PECL | |
run-name: Build PHP Extension ${{ inputs.extension-url }}, ${{ inputs.extension-ref }} | |
on: | |
workflow_dispatch: | |
inputs: | |
extension-url: | |
description: 'Extension URL' | |
required: true | |
extension-ref: | |
description: 'Extension ref' | |
required: true | |
php-version-list: | |
description: 'PHP versions to build' | |
required: false | |
arch-list: | |
type: choice | |
options: ['x64', 'x86', 'x64,x86'] | |
description: 'Architectures to build' | |
required: false | |
default: 'x64,x86' | |
ts-list: | |
type: choice | |
options: ['nts', 'ts', 'nts,ts'] | |
description: 'Thread safety to build' | |
required: false | |
default: 'nts,ts' | |
args: | |
description: 'Configure arguments' | |
required: false | |
libs: | |
description: 'Libraries' | |
required: false | |
run-tests: | |
type: choice | |
options: ['true', 'false'] | |
description: 'Run tests after building the extension' | |
required: false | |
default: 'false' | |
test-runner: | |
description: 'Test runner to use' | |
required: false | |
default: 'run-tests.php' | |
jobs: | |
get-extension-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.extension-matrix.outputs.matrix }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get the extension matrix | |
id: extension-matrix | |
uses: ./extension-matrix | |
with: | |
extension-url: ${{ inputs.extension-url }} | |
extension-ref: ${{ inputs.extension-ref }} | |
php-version-list: ${{ inputs.php-version-list }} | |
arch-list: ${{ inputs.arch-list }} | |
ts-list: ${{ inputs.ts-list }} | |
extension: | |
needs: get-extension-matrix | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: ${{fromJson(needs.get-extension-matrix.outputs.matrix)}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build the extension | |
uses: ./extension | |
with: | |
extension-url: ${{ inputs.extension-url }} | |
extension-ref: ${{ inputs.extension-ref }} | |
php-version: ${{ matrix.php-version }} | |
arch: ${{ matrix.arch }} | |
ts: ${{ matrix.ts }} | |
args: ${{ inputs.args }} | |
libs: ${{ inputs.libs }} | |
run-tests: ${{ inputs.run-tests }} | |
test-runner: ${{ inputs.test-runner }} | |
build-directory: C:\build | |
env: | |
artifact-naming-scheme: pecl | |
auto-detect-args: true | |
auto-detect-libs: true | |
artifacts: | |
runs-on: ubuntu-latest | |
needs: extension | |
steps: | |
- name: Upload artifacts | |
uses: actions/upload-artifact/merge@v4 | |
with: | |
name: artifacts | |
delete-merged: true | |
pecl-release: | |
runs-on: ubuntu-latest | |
needs: artifacts | |
steps: | |
- name: Get artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: artifacts | |
path: artifacts | |
- name: Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
ls -l artifacts | |
extension=$(basename "${{ inputs.extension-url }}") | |
mkdir -p /tmp/$extension/${{ inputs.extension-ref }}/ | |
cp -a artifacts/* /tmp/$extension/${{ inputs.extension-ref }}/ | |
cd /tmp || exit 1 | |
zip -r $extension-${{ inputs.extension-ref }}.zip $extension | |
if ! gh release view pecl -R ${{ github.repository }}; then | |
gh release create pecl $extension-${{ inputs.extension-ref }}.zip -t pecl -n pecl -R ${{ github.repository }} | |
else | |
gh release upload pecl $extension-${{ inputs.extension-ref }}.zip -R ${{ github.repository }} --clobber | |
fi |