Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build and publish Windows binaries to Release #107

Open
wants to merge 2 commits into
base: release
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
159 changes: 0 additions & 159 deletions .appveyor.yml

This file was deleted.

91 changes: 91 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Build and Test
on: [push, pull_request]
jobs:
windows:
defaults:
run:
shell: cmd
strategy:
matrix:
version: ['8.0', '8.1', '8.2', '8.3']
arch: [x64, x86]
ts: [ts, nts]
runs-on: windows-latest
steps:
- name: Checkout pcov
uses: actions/checkout@v4
- name: Extract Version
shell: powershell
run: |
chcp 65001
$r = Select-String -Path php_pcov.h -Pattern 'PHP_PCOV_VERSION\s+"(.*)"'
$s = $r.Matches[0].Groups[1]
echo "$s"
$extension_version = 'EXTENSION_VERSION=' + $s
echo $extension_version >> $env:GITHUB_ENV
- name: Setup PHP
id: setup-php
uses: php/[email protected]
with:
version: ${{matrix.version}}
arch: ${{matrix.arch}}
ts: ${{matrix.ts}}
- name: Enable Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{matrix.arch}}
toolset: ${{steps.setup-php.outputs.toolset}}
- name: phpize
run: phpize
- name: configure
run: configure --enable-pcov --with-prefix=${{steps.setup-php.outputs.prefix}}
- name: make
run: nmake
- name: test
run: nmake test TESTS="-g FAIL,SKIP --show-diff tests"
- name: Define Module Env
shell: powershell
run: |
chcp 65001

$dir = (Get-Location).Path + '\'
if ('x64' -eq '${{matrix.arch}}') { $dir = $dir + 'x64\' }
$dir = $dir + 'Release'
if ('ts' -eq '${{matrix.ts}}') { $dir = $dir + '_TS' }

$artifact_name = 'php_pcov-${{env.EXTENSION_VERSION}}-${{matrix.version}}'

if ('ts' -eq '${{matrix.ts}}') { $artifact_name = $artifact_name + '-ts' }
if ('nts' -eq '${{matrix.ts}}') { $artifact_name = $artifact_name + '-nts' }

if ('7.2' -eq '${{matrix.version}}') { $artifact_name = $artifact_name + '-vc15' }
if ('7.3' -eq '${{matrix.version}}') { $artifact_name = $artifact_name + '-vc15' }
if ('7.4' -eq '${{matrix.version}}') { $artifact_name = $artifact_name + '-vc15' }
if ('8.0' -eq '${{matrix.version}}') { $artifact_name = $artifact_name + '-vs16' }
if ('8.1' -eq '${{matrix.version}}') { $artifact_name = $artifact_name + '-vs16' }
if ('8.2' -eq '${{matrix.version}}') { $artifact_name = $artifact_name + '-vs16' }
if ('8.3' -eq '${{matrix.version}}') { $artifact_name = $artifact_name + '-vs16' }

if ('x64' -eq '${{matrix.arch}}') { $artifact_name = $artifact_name + '-x64' }
if ('x86' -eq '${{matrix.arch}}') { $artifact_name = $artifact_name + '-x86' }

$extension_artifact_name = "ARTIFACT_NAME=" + $artifact_name
echo $extension_artifact_name >> $env:GITHUB_ENV

$from = $dir + '\php_pcov.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: 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