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

AppVeyor CI integration #39

Merged
merged 1 commit into from
Apr 12, 2021
Merged
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
53 changes: 53 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# general configuration
version: '{branch}.{build}'

# environment configuration
image: Visual Studio 2017
clone_folder: C:\projects\php_simple_kafka_client
environment:
BIN_SDK_VER: 2.2.0
DEP: librdkafka-1.5.3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
DEP: librdkafka-1.5.3
DEP: librdkafka-1.6.1

Iif it is available, it would be great to use the latest version
I setup the project on AppVeyor, i hope the next change triggers the build, manually i was somehow only able to build the main branch 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, 1.5.3 is the newest version available for now. Since these libs have to be built manually, I'm hoping to switch to vcpkg, but they have only 1.5.0, so I suggest to stick with 1.5.3 for a while.

manually i was somehow only able to build the main branch

Yes, that's a bit contrieved. You might need to change the default branch under Settings to be able to manually trigger a build. However, there is a build in my fork which succeeded (basically this PR + PR #40). Anyhow, I'm going to push a rebased version of this patch right now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor CI is running. \o/

matrix:
- PHP_VER: 7.3
TS: 0
VC: vc15
ARCH: x64
OPCACHE: 0
- PHP_VER: 7.3
TS: 1
VC: vc15
ARCH: x64
OPCACHE: 1
- PHP_VER: 7.4
TS: 0
VC: vc15
ARCH: x64
OPCACHE: 0
- PHP_VER: 7.4
TS: 1
VC: vc15
ARCH: x64
OPCACHE: 1
- PHP_VER: 8.0
TS: 0
VC: vs16
ARCH: x64
OPCACHE: 0
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- PHP_VER: 8.0
TS: 1
VC: vs16
ARCH: x64
OPCACHE: 1
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
cache:
- C:\build-cache -> .appveyor.yml, .appveyor\install.ps1
install:
- ps: .appveyor\install.ps1

# build configuration
build_script:
- ps: .appveyor\build.ps1

after_build:
- ps: .appveyor\package.ps1
13 changes: 13 additions & 0 deletions .appveyor/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
$ErrorActionPreference = "Stop"

Set-Location 'C:\projects\php_simple_kafka_client'

$task = New-Item 'task.bat' -Force
Add-Content $task "call phpize 2>&1"
Add-Content $task "call configure --with-php-build=C:\build-cache\deps --with-simple-kafka-client --enable-debug-pack 2>&1"
Add-Content $task "nmake /nologo 2>&1"
Add-Content $task "exit %errorlevel%"
& "C:\build-cache\php-sdk-$env:BIN_SDK_VER\phpsdk-$env:VC-$env:ARCH.bat" -t $task
if (-not $?) {
throw "build failed with errorlevel $LastExitCode"
}
71 changes: 71 additions & 0 deletions .appveyor/install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
$ErrorActionPreference = "Stop"

if (-not (Test-Path 'C:\build-cache')) {
[void](New-Item 'C:\build-cache' -ItemType 'directory')
}

$bname = "php-sdk-$env:BIN_SDK_VER.zip"
if (-not (Test-Path "C:\build-cache\$bname")) {
Invoke-WebRequest "https://github.com/Microsoft/php-sdk-binary-tools/archive/$bname" -OutFile "C:\build-cache\$bname"
}
$dname0 = "php-sdk-binary-tools-php-sdk-$env:BIN_SDK_VER"
$dname1 = "php-sdk-$env:BIN_SDK_VER"
if (-not (Test-Path "C:\build-cache\$dname1")) {
Expand-Archive "C:\build-cache\$bname" 'C:\build-cache'
Move-Item "C:\build-cache\$dname0" "C:\build-cache\$dname1"
}

$gareleases = Invoke-WebRequest "https://windows.php.net/downloads/releases/releases.json" | ConvertFrom-Json
$qareleases = Invoke-WebRequest "https://windows.php.net/downloads/qa/releases.json" | ConvertFrom-Json
$garev = [regex]::split($gareleases.$env:PHP_VER.version, '[^\d]')[2]
$qarev = [regex]::split($qareleases.$env:PHP_VER.version, '[^\d]')[2]
if ($qarev -gt $garev) {
$phpversion = $qareleases.$env:PHP_VER.version
$phprelease = 'QA'
} else {
$phpversion = $gareleases.$env:PHP_VER.version
$phprelease = 'GA'
}

$ts_part = ''
if ($env:TS -eq '0') {
$ts_part += '-nts'
}
$bname = "php-devel-pack-$phpversion$ts_part-Win32-$env:VC-$env:ARCH.zip"
if (-not (Test-Path "C:\build-cache\$bname")) {
if ($phprelease -eq "GA") {
Invoke-WebRequest "https://windows.php.net/downloads/releases/$bname" -OutFile "C:\build-cache\$bname"
} else {
Invoke-WebRequest "https://windows.php.net/downloads/qa/$bname" -OutFile "C:\build-cache\$bname"
}
}
$dname0 = "php-$phpversion-devel-$env:VC-$env:ARCH"
$dname1 = "php-$phpversion$ts_part-devel-$env:VC-$env:ARCH"
if (-not (Test-Path "C:\build-cache\$dname1")) {
Expand-Archive "C:\build-cache\$bname" 'C:\build-cache'
if ($dname0 -ne $dname1) {
Move-Item "C:\build-cache\$dname0" "C:\build-cache\$dname1"
}
}
$env:PATH = "C:\build-cache\$dname1;$env:PATH"

$bname = "php-$phpversion$ts_part-Win32-$env:VC-$env:ARCH.zip"
if (-not (Test-Path "C:\build-cache\$bname")) {
if ($phprelease -eq "GA") {
Invoke-WebRequest "https://windows.php.net/downloads/releases/$bname" -OutFile "C:\build-cache\$bname"
} else {
Invoke-WebRequest "https://windows.php.net/downloads/qa/$bname" -OutFile "C:\build-cache\$bname"
}
}
$dname = "php-$phpversion$ts_part-$env:VC-$env:ARCH"
if (-not (Test-Path "C:\build-cache\$dname")) {
Expand-Archive "C:\build-cache\$bname" "C:\build-cache\$dname"
}
$env:PATH = "c:\build-cache\$dname;$env:PATH"

$bname = "$env:DEP-$env:VC-$env:ARCH.zip"
if (-not (Test-Path "C:\build-cache\$bname")) {
Invoke-WebRequest "http://windows.php.net/downloads/pecl/deps/$bname" -OutFile "C:\build-cache\$bname"
Expand-Archive "C:\build-cache\$bname" 'C:\build-cache\deps'
Copy-Item "C:\build-cache\deps\LICENSE" "C:\build-cache\deps\LICENSE.LIBRDKAFKA"
}
35 changes: 35 additions & 0 deletions .appveyor/package.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
$ErrorActionPreference = "Stop"

if ($env:TS -eq '0') {
$ts_part = 'nts'
} else {
$ts_part = 'ts';
}

if ($env:APPVEYOR_REPO_TAG -eq "true") {
$bname = "php_simple_kafka_client-$env:APPVEYOR_REPO_TAG_NAME-$env:PHP_VER-$ts_part-$env:VC-$env:ARCH"
} else {
$bname = "php_simple_kafka_client-$($env:APPVEYOR_REPO_COMMIT.substring(0, 8))-$env:PHP_VER-$ts_part-$env:VC-$env:ARCH"
}
$zip_bname = "$bname.zip"

$dir = 'C:\projects\php_simple_kafka_client\';
if ($env:ARCH -eq 'x64') {
$dir += 'x64\'
}
$dir += 'Release'
if ($env:TS -eq '1') {
$dir += '_TS'
}

$files = @(
"$dir\php_simple_kafka_client.dll",
"$dir\php_simple_kafka_client.pdb",
"C:\projects\php_simple_kafka_client\LICENSE",
"C:\projects\php_simple_kafka_client\README.md",
"C:\build-cache\deps\bin\librdkafka.dll",
"C:\build-cache\deps\bin\librdkafka.pdb",
"C:\build-cache\deps\LICENSE.LIBRDKAFKA"
)
Compress-Archive $files "C:\$zip_bname"
Push-AppveyorArtifact "C:\$zip_bname"