Fix artifacts names #22
Workflow file for this run
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: Win32Service build | |
on: | |
push: | |
branches: [ v1.0.x ] | |
tags: | |
- v1.** | |
pull_request: | |
branches: [ v1.0.x ] | |
jobs: | |
build: | |
name: Build | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: cmd | |
outputs: | |
repo_tag_name: ${{ steps.install.outputs.repo_tag_name }} | |
strategy: | |
fail-fast: false | |
matrix: | |
php-rel: ['8.0', '8.1', '8.2', '8.3'] | |
platform: [x64, x86] | |
ts: [ts, nts] | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Extract Version | |
shell: powershell | |
run: | | |
chcp 65001 | |
$r = Select-String -Path php_win32service.h -Pattern 'PHP_WIN32SERVICE_VERSION\s+"(.*)"' | |
$s = $r.Matches[0].Groups[1] | |
$extension_version = 'EXTENSION_VERSION=' + $s | |
echo $extension_version >> $env:GITHUB_ENV | |
echo $extension_version | |
- name: Setup PHP | |
id: setup-php | |
uses: php/setup-php-sdk@v0.8 | |
with: | |
version: ${{matrix.php-rel}} | |
arch: ${{matrix.platform}} | |
ts: ${{matrix.ts}} | |
- name: Enable Developer Command Prompt | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: ${{matrix.platform}} | |
toolset: ${{steps.setup-php.outputs.toolset}} | |
- name: Generate Build Files | |
run: phpize | |
- name: Configure Build | |
run: configure --enable-win32service --with-prefix=${{steps.setup-php.outputs.prefix}} | |
- name: Build | |
run: nmake | |
- name: Define Module Env | |
shell: powershell | |
run: | | |
chcp 65001 | |
$dir = (Get-Location).Path + '\' | |
if ('x64' -eq '${{matrix.platform}}') { $dir = $dir + 'x64\' } | |
$dir = $dir + 'Release' | |
if ('ts' -eq '${{matrix.ts}}') { $dir = $dir + '_TS' } | |
("[php] `nextension=$dir\php_win32service.dll") | Set-Content $env:SystemRoot\php.ini | |
$artifact_name = 'php_win32service-${{env.EXTENSION_VERSION}}-${{matrix.php-rel}}' | |
if ('ts' -eq '${{matrix.ts}}') { $artifact_name = $artifact_name + '-ts' } | |
if ('nts' -eq '${{matrix.ts}}') { $artifact_name = $artifact_name + '-nts' } | |
if ('8.0' -eq '${{matrix.php-rel}}') { $artifact_name = $artifact_name + '-vs16' } | |
if ('8.1' -eq '${{matrix.php-rel}}') { $artifact_name = $artifact_name + '-vs16' } | |
if ('8.2' -eq '${{matrix.php-rel}}') { $artifact_name = $artifact_name + '-vs16' } | |
if ('8.3' -eq '${{matrix.php-rel}}') { $artifact_name = $artifact_name + '-vs16' } | |
if ('x64' -eq '${{matrix.platform}}') { $artifact_name = $artifact_name + '-x64' } | |
if ('x86' -eq '${{matrix.platform}}') { $artifact_name = $artifact_name + '-x86' } | |
$extension_artifact_name = "ARTIFACT_NAME=" + $artifact_name | |
echo $extension_artifact_name >> $env:GITHUB_ENV | |
$from = $dir + '\php_win32service.dll' | |
$to = $from + ".zip" | |
Compress-Archive $from $to | |
$extension_artifact = "ARTIFACT=" + $from | |
echo $extension_artifact >> $env:GITHUB_ENV | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{env.ARTIFACT_NAME}} | |
path: ${{env.ARTIFACT}} | |
- name: test | |
shell: powershell | |
run: | | |
chcp 65001 | |
sc delete WindowsServicePhpTest | |
sc delete WindowsServicePhpTestRun | |
mkdir c:\tests_tmp | |
$env:TEST_PHP_JUNIT = "c:\junit.out.xml" | |
nmake test TESTS="-c null -q --offline --show-diff --show-slow 1000 --set-timeout 120 -g FAIL,XFAIL,BORK,WARN,LEAK,SKIP --temp-source c:\tests_tmp --temp-target c:\tests_tmp" | |
- name: Publish Binaries to Release | |
if: ${{ startsWith(github.ref, 'refs/tags') }} | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
asset_name: ${{env.ARTIFACT_NAME}}.zip | |
file: ${{env.ARTIFACT}}.zip |