WIP Refactor sourcer fetcher #557
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: windows test | |
on: | |
workflow_dispatch: | |
inputs: | |
libraries: | |
description: "libraries" | |
required: false | |
default: "zstd,libssh2,curl,zlib,brotli,libffi,openssl,libzip,bzip2,nghttp2,onig,libyaml,xz,libxml2" | |
extensions: | |
description: "extensions" | |
required: false | |
default: "dom,xml,simplexml,xmlwriter,xmlreader,opcache,bcmath,pdo,phar,mysqlnd,mysqli,pdo,pdo_mysql,mbstring,mbregex,session,ctype,fileinfo,filter,tokenizer,curl,ffi,swow,redis,sockets,openssl,zip,zlib,bz2,yaml,zstd" | |
lib_only: | |
description: "build libraries only" | |
required: false | |
default: "" | |
push: | |
schedule: | |
- cron: "33 4 * * *" | |
env: | |
LWMBS_LIBRARIES: zstd,libssh2,curl,zlib,brotli,libffi,openssl,libzip,bzip2,nghttp2,onig,libyaml,xz,libxml2 | |
LWMBS_EXTENSIONS: dom,xml,simplexml,xmlwriter,xmlreader,opcache,bcmath,pdo,phar,mysqlnd,mysqli,pdo,pdo_mysql,mbstring,mbregex,session,ctype,fileinfo,filter,tokenizer,curl,ffi,swow,redis,sockets,openssl,zip,zlib,bz2,yaml,zstd | |
jobs: | |
build: | |
name: PHP ${{ matrix.php-version }} ${{ matrix.arch }} | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- php-version: "8.2" | |
arch: "x64" | |
- php-version: "8.1" | |
arch: "x64" | |
- php-version: "8.0" | |
arch: "x64" | |
- php-version: "8.2" | |
arch: "arm64" | |
max-parallel: 4 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Calc sources hash | |
id: src_hash | |
shell: pwsh | |
run: | | |
${env:GITHUB_TOKEN} = "${{ secrets.GITHUB_TOKEN }}" | |
Write-Output "hash=" | Out-File "${env:GITHUB_OUTPUT}" -Append -NoNewline | |
php fetch_source.php ` | |
"${{ (github.event.inputs && github.event.inputs.libraries) || env.LWMBS_LIBRARIES }}" ` | |
"${{ (github.event.inputs && github.event.inputs.extensions) || env.LWMBS_EXTENSIONS }}" ` | |
--phpVer=${{ matrix.php-version }} ` | |
--hash | Out-File "${env:GITHUB_OUTPUT}" -Append -NoNewline | |
Write-Host "" | |
- name: Cache libraries | |
uses: actions/cache@v3 | |
id: cache | |
with: | |
path: | | |
build/src | |
build/downloads | |
build/deps | |
key: windows-v2-${{ matrix.arch }}-${{ steps.src_hash.outputs.hash }} | |
- name: Prepare tools and sources | |
id: prepare | |
shell: pwsh | |
run: | | |
${env:GITHUB_TOKEN} = "${{ secrets.GITHUB_TOKEN }}" | |
New-Item -ItemType Container -Force C:\tools\php-sdk-binary-tools | |
New-Item -ItemType Container -Force build | |
Set-Location build | |
# prepare nasm | |
Invoke-WebRequest -Uri "https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/win64/nasm-2.15.05-win64.zip" ` | |
-OutFile "nasm-2.15.05-win64.zip" | |
unzip nasm-2.15.05-win64.zip | |
if (0 -Ne $lastexitcode) { | |
exit 1 | |
} | |
Move-Item nasm-2.15.05/*.exe C:\Windows\system32 | |
Move-Item nasm-2.15.05/rdoff/*.exe C:\Windows\system32 | |
# prepare binary sdk | |
git clone --depth 1 --single-branch --branch master https://github.com/php/php-sdk-binary-tools C:\tools\php-sdk-binary-tools | |
if (0 -Ne $lastexitcode) { | |
exit 1 | |
} | |
# fetch source | |
php ${env:GITHUB_WORKSPACE}/fetch_source.php ` | |
"${{ (github.event.inputs && github.event.inputs.libraries) || env.LWMBS_LIBRARIES }}" ` | |
"${{ (github.event.inputs && github.event.inputs.extensions) || env.LWMBS_EXTENSIONS }}" ` | |
--phpVer=${{ matrix.php-version }} ` | |
--shallowClone | |
if (0 -Ne $lastexitcode) { | |
exit 1 | |
} | |
php ${env:GITHUB_WORKSPACE}/dump_licenses.php ` | |
${env:GITHUB_WORKSPACE}\licenses | |
if (0 -Ne $lastexitcode) { | |
exit 1 | |
} | |
# TODO: filters | |
# if ("${{ matrix.arch }}" -Eq "arm64") { | |
# # https://github.com/openssl/openssl/issues/20234 | |
# Invoke-WebRequest -Uri https://patch-diff.githubusercontent.com/raw/openssl/openssl/pull/20244.patch ` | |
# -OutFile "win-openssl-aa64.patch" | |
# Push-Location src\openssl | |
# Get-Content ..\..\win-openssl-aa64.patch | & patch -p1 | |
# if (0 -Ne $lastexitcode) { | |
# exit 1 | |
# } | |
# Pop-Location | |
# } | |
- name: Prepare libraries | |
if: steps.cache.outputs.cache-hit != 'true' | |
working-directory: build | |
shell: pwsh | |
run: | | |
${env:GITHUB_TOKEN} = "${{ secrets.GITHUB_TOKEN }}" | |
php ${env:GITHUB_WORKSPACE}/build_libs.php ` | |
"${{ (github.event.inputs && github.event.inputs.libraries) || env.LWMBS_LIBRARIES }}" ` | |
-phpBinarySDKDir=C:\tools\php-sdk-binary-tools ` | |
--vsVer=17 ` | |
--arch=${{ matrix.arch }} | |
- name: Build micro | |
if: "! (github.event.inputs && github.event.inputs.lib_only)" | |
id: micro | |
shell: pwsh | |
working-directory: build | |
continue-on-error: true | |
run: | | |
${env:GITHUB_TOKEN} = "${{ secrets.GITHUB_TOKEN }}" | |
php ${env:GITHUB_WORKSPACE}/build_micro.php ` | |
"${{ (github.event.inputs && github.event.inputs.libraries) || env.LWMBS_LIBRARIES }}" ` | |
"${{ (github.event.inputs && github.event.inputs.extensions) || env.LWMBS_EXTENSIONS }}" ` | |
-phpBinarySDKDir=C:\tools\php-sdk-binary-tools ` | |
--vsVer=17 ` | |
--arch=${{ matrix.arch }} | |
cp src/php-src/${{ matrix.arch }}/Release_TS/micro.sfx .. | |
- name: Upload artifact for micro | |
if: steps.micro.outcome == 'success' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: micro_${{ matrix.php-version }}_${{ matrix.arch }}_${{ steps.src_hash.outputs.hash }} | |
path: | | |
licenses | |
micro.sfx | |
- name: Build micro-cli | |
if: "! (github.event.inputs && github.event.inputs.lib_only)" | |
id: micro-cli | |
shell: pwsh | |
working-directory: build | |
continue-on-error: true | |
run: | | |
${env:GITHUB_TOKEN} = "${{ secrets.GITHUB_TOKEN }}" | |
rm -Force src/php-src/${{ matrix.arch }}/Release_TS/sapi/micro/php_micro.obj | |
php ${env:GITHUB_WORKSPACE}/build_micro.php ` | |
"${{ (github.event.inputs && github.event.inputs.libraries) || env.LWMBS_LIBRARIES }}" ` | |
"${{ (github.event.inputs && github.event.inputs.extensions) || env.LWMBS_EXTENSIONS }}" ` | |
-phpBinarySDKDir=C:\tools\php-sdk-binary-tools ` | |
--vsVer=17 ` | |
--arch=${{ matrix.arch }} ` | |
--fakeCli | |
cp src/php-src/${{ matrix.arch }}/Release_TS/micro.sfx ../micro-cli.sfx | |
- name: Upload artifact for micro-cli | |
if: steps.micro-cli.outcome == 'success' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: micro-cli_${{ matrix.php-version }}_${{ matrix.arch }}_${{ steps.src_hash.outputs.hash }} | |
path: | | |
licenses | |
micro-cli.sfx | |
- name: Build cli | |
if: "! (github.event.inputs && github.event.inputs.lib_only)" | |
id: cli | |
shell: pwsh | |
working-directory: build | |
continue-on-error: true | |
run: | | |
${env:GITHUB_TOKEN} = "${{ secrets.GITHUB_TOKEN }}" | |
php ${env:GITHUB_WORKSPACE}/build_cli.php ` | |
"${{ (github.event.inputs && github.event.inputs.libraries) || env.LWMBS_LIBRARIES }}" ` | |
"${{ (github.event.inputs && github.event.inputs.extensions) || env.LWMBS_EXTENSIONS }}" ` | |
-phpBinarySDKDir=C:\tools\php-sdk-binary-tools ` | |
--vsVer=17 ` | |
--arch=${{ matrix.arch }} | |
cp src/php-src/${{ matrix.arch }}/Release_TS/php.exe .. | |
- name: Upload artifact for cli | |
if: steps.cli.outcome == 'success' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cli_${{ matrix.php-version }}_${{ matrix.arch }}_${{ steps.src_hash.outputs.hash }} | |
path: | | |
licenses | |
php.exe | |
- name: Fail if anything failed | |
if: steps.micro.outcome == 'failure' || steps.micro-cli.outcome == 'failure' || steps.cli.outcome == 'failure' | |
shell: cmd | |
run: | | |
exit /b 1 | |
- name: Remove php src to avoid cache | |
shell: pwsh | |
run: | | |
Remove-Item -Recurse -Force build\src\php-src |