上一章节大概介绍了一下是什么?了解更多请点击一下链接查看。这篇着重强调一下怎么正确使用。
PHP官方Windows构建工具php-windows-builder 1.0.0 发布
Fork 官方仓库
官方仓库地址:https://github.com/php/php-windows-builder
流水线配置
官方默认配置位于你的Github项目仓库
.github/workflows/php.yml
,这里我们直接新建一个 https://github.com/Tinywan/php-windows-builder/actions
php8.3.2.yml
name: Build PHP 8.3.2
on:
release:
types: [published]
jobs:
php:
strategy:
matrix:
arch: x64
ts: nts
runs-on: windows-2019
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build
uses: ./php
with:
php-version: ${{ github.event.inputs.php-version }}
arch: ${{ matrix.arch }}
ts: ${{ matrix.ts }}
release:
runs-on: ubuntu-latest
steps:
- name: Upload artifact to the release
uses: php/php-windows-builder/release@v1
with:
release: 8.3.2
token: ${{ secrets.PHP_TOKEN }}
注意配置:
-
PHP 版本: 8.3.2
-
架构arch: x64
-
线程安全: nts
构建PHP
运行流水线
环境监测
Run actions/checkout@v4
with:
repository: Tinywan/php-windows-builder
token: ***
ssh-strict: true
persist-credentials: true
clean: true
sparse-checkout-cone-mode: true
fetch-depth: 1
fetch-tags: false
show-progress: true
lfs: false
submodules: false
set-safe-directory: true
Syncing repository: Tinywan/php-windows-builder
Getting Git version info
Temporarily overriding HOME=\\\'D:\\\\a\\\\_temp\\\\f932e9ec-2aae-4f93-a890-821934d7acaa\\\' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
\\\"C:\\\\Program Files\\\\Git\\\\bin\\\\git.exe\\\" config --global --add safe.directory D:\\\\a\\\\php-windows-builder\\\\php-windows-builder
Deleting the contents of \\\'D:\\\\a\\\\php-windows-builder\\\\php-windows-builder\\\'
Initializing the repository
Disabling automatic garbage collection
Setting up auth
Fetching the repository
Determining the checkout info
Checking out the ref
\\\"C:\\\\Program Files\\\\Git\\\\bin\\\\git.exe\\\" log -1 --format=\\\'%H\\\'
\\\'120c092ef7c71be9ecca3a5f79c2ae5d659ca0d0\\\'
正式构建
这里比较漫长,请耐心等待哦!
终于构建结束啦!
下载构建好的包
下载地址:
https://github.com/Tinywan/php-windows-builder/actions/runs/8282409968
解压:
php-8.3.2-nts-Win32-vs16-x64.zip
查看PHP版本
$ ./php.exe -v
PHP 8.3.2 (cli) (built: Mar 14 2024 14:42:01) (NTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.3.2, Copyright (c) Zend Technologies
查看PHP扩展
构建PHP扩展
name: Build PHP Extension
on:
workflow_dispatch:
inputs:
extension_url:
description: \\\'Extension URL\\\'
required: true
extension_ref:
description: \\\'Extension ref\\\'
required: true
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 }}
arch-list: \\\'x64, x86\\\'
ts-list: \\\'nts, ts\\\'
extension:
needs: get-extension-matrix
runs-on: ${{ matrix.os }}
strategy:
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 }}
artifacts:
runs-on: ubuntu-latest
needs: extension
steps:
- name: Upload artifacts
uses: actions/upload-artifact/merge@v4
with:
name: artifacts
delete-merged: true
构建结果
点击下载
artifacts
构建好的扩展包Xdebug
,解压后
随便解压一个
php_xdebug-3.3.1-8.1-nts-vs16-x64.zip
看看,你想要的php_xdebug.dll
就已经在里面啦!
原创文章,作者:网络技术联盟站,如若转载,请注明出处:https://www.sudun.com/ask/49735.html