Windows support #295
This file contains hidden or 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: CI | |
on: | |
push: | |
branches: | |
- '**' | |
tags: | |
- '*' | |
paths-ignore: | |
- '**.md' | |
- '**.txt' | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
name: build / php-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.name }}-${{ matrix.compiler }} | |
# FIXME temporary disabled | |
if: false | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
php: [ '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ] | |
name: | |
- linux | |
- debian | |
- mac | |
include: | |
# Linux | |
- { name: linux, ts: 'nts', compiler: 'gcc', os: ubuntu-22.04 } | |
# Debian (docker) | |
- { name: debian, ts: 'nts', compiler: 'gcc', os: ubuntu-22.04 } | |
# macOS | |
- { name: mac, ts: 'nts', compiler: 'clang', os: macos-13 } | |
env: | |
DOCKER_BUILD_RECORD_UPLOAD: false # disable docker buildx record upload as build artifact | |
DOCKER_BUILD_SUMMARY: false # disable docker buildx summary | |
steps: | |
- uses: actions/checkout@v4 | |
# configure spx artifact name in next format: | |
# {php}-{ts}-{os.name}-{compiler} | |
# spx-php-8.1-nts-linux-gcc | |
- name: Set artifact name | |
id: setup-artifact | |
run: | | |
echo "spx_file_name=spx-php-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.name }}-${{ matrix.compiler }}" >> $GITHUB_OUTPUT | |
- name: Build extension for Ubuntu and macOS | |
if: matrix.name != 'debian' | |
uses: ./.github/workflows/build-linux-mac-ext | |
- name: Build extension for Debian using docker | |
if: matrix.name == 'debian' && matrix.php != '5.4' && matrix.php != '5.5' | |
uses: ./.github/workflows/build-debian-ext | |
- name: Upload build artifacts after Failure | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: debug-${{ steps.setup-artifact.outputs.spx_file_name }} | |
path: | | |
${{ github.workspace }}/*.log | |
${{ github.workspace }}/tests/*.log | |
retention-days: 7 | |
- name: Create ZIP archive with build artifact | |
run: | | |
zip -rvj ${{ steps.setup-artifact.outputs.spx_file_name }}.zip \ | |
./modules/spx.so LICENSE $ZIP_EXCLUDE | |
zip -rv ${{ steps.setup-artifact.outputs.spx_file_name }}.zip \ | |
./assets $ZIP_EXCLUDE | |
env: | |
ZIP_EXCLUDE: -x ".*" -x "__MACOSX" -x "*.DS_Store" | |
- name: Check Release notes | |
run: | | |
echo "-- Parsing Release Notes from CHANGELOG" | |
./.github/release-notes.sh ./CHANGELOG.md | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.setup-artifact.outputs.spx_file_name }}.zip | |
path: ${{ steps.setup-artifact.outputs.spx_file_name }}.zip | |
build-win-old: | |
# FIXME this hacky pipeline will be cleaned later | |
if: false | |
runs-on: windows-latest | |
steps: | |
- name: Install zlib | |
run: | | |
vcpkg.exe install zlib | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 | |
- name: Setup PHP SDK with Developer Pack | |
uses: zephir-lang/setup-php-sdk@fd5f1bce00956a7e8ac30faaa1ff0692d6dacdfb # v1.0 | |
with: | |
php_version: '8.3' | |
ts: 'nts' | |
msvc: 'vs16' | |
arch: 'x64' | |
install_dir: 'C:\tools' | |
cache_dir: 'C:\Temp' | |
- name: Clone PHP-src | |
run: | | |
git clone https://github.com/php/php-src.git C:\php-src | |
- name: Copy SPX to PHP-src ext directory | |
run: | | |
xcopy /e /k /h /i . C:\php-src\ext\php-spx | |
- name: Configure and build 1 | |
run: | | |
cd C:\php-src | |
./buildconf.bat | |
- name: Configure and build 2 | |
run: | | |
cd C:\php-src | |
./configure --help | |
./configure --disable-all --enable-cli --enable-spx | |
- name: Configure and build 3 | |
run: | | |
cd C:\php-src | |
nmake | |
build-win: | |
runs-on: windows-latest | |
steps: | |
- name: Build the extension | |
uses: php/php-windows-builder/extension@7d5c246d2471327972cf214ef37de59c278a6b38 | |
#uses: php/php-windows-builder/extension@5199585cd19be6fb11e6b229d4b662649dc79ac8 | |
#uses: php/php-windows-builder/extension@2a031a68a7ed21340248d07946a8f655faf1d6aa | |
with: | |
#extension-url: https://github.com/xdebug/xdebug | |
#extension-ref: '3.3.1' | |
php-version: '8.3' | |
ts: nts | |
run-tests: false | |
arch: x64 | |
args: --enable-spx | |
libs: zlib | |
release: | |
# FIXME temporary disabled | |
if: false && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
needs: [ build ] | |
name: Create Release | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Get the release version | |
id: get-version | |
run: | | |
echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
- name: Download SPX build artifacts | |
id: download | |
uses: actions/download-artifact@v4 | |
with: | |
path: ./build-artifacts | |
- name: Prepare Release notes | |
run: | | |
echo "-- Creating Release Notes" | |
./.github/release-notes.sh ./CHANGELOG.md > ./release-notes.md | |
- name: Create Release | |
uses: ncipollo/release-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
name: ${{ steps.get-version.outputs.version }} | |
tag: ${{ steps.get-version.outputs.version }} | |
bodyFile: "./release-notes.md" | |
allowUpdates: true | |
artifacts: "./build-artifacts/*/*.zip" | |
artifactContentType: application/octet-stream |