Skip to content

PCBC-859: configure Github Actions for Windows #164

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

Merged
merged 1 commit into from
Apr 23, 2024
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
228 changes: 228 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,111 @@ jobs:
require_tests: true
annotate_only: true

server_linux_x86_64:
needs:
- source
- build_linux_x86_64
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
php:
- '8.3'
ts:
- nts
- zts
server:
- 7.6.0
- 7.2.4
- 7.1.6
- 7.0.5
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: json, mbstring, intl
env:
phpts: ${{ matrix.ts }}
- name: Install cbdinocluster
run: |
mkdir -p "$HOME/bin"
curl -L -o "$HOME/bin/cbdinocluster" https://github.com/couchbaselabs/cbdinocluster/releases/download/v0.0.35/cbdinocluster-linux
chmod a+x "$HOME/bin/cbdinocluster"
echo "$HOME/bin" >> $GITHUB_PATH
- name: Initialize cbdinocluster
run: |
cbdinocluster -v init --auto
- name: Start couchbase cluster
env:
CLUSTERCONFIG: |
nodes:
- count: 2
version: ${{ matrix.server }}
services:
- kv
- n1ql
- index
- count: 1
version: ${{ matrix.server }}
services:
- kv
- fts
- cbas
docker:
kv-memory: 1600
run: |
CLUSTER_ID=$(cbdinocluster -v allocate --def="${CLUSTERCONFIG}")
CONNECTION_STRING=$(cbdinocluster -v connstr "${CLUSTER_ID}")
cbdinocluster -v buckets add ${CLUSTER_ID} default --ram-quota-mb=100 --flush-enabled=true
cbdinocluster -v buckets load-sample ${CLUSTER_ID} travel-sample
echo "CLUSTER_ID=${CLUSTER_ID}" >> "$GITHUB_ENV"
echo "TEST_CONNECTION_STRING=${CONNECTION_STRING}?dump_configuration=true" >> "$GITHUB_ENV"
- uses: actions/download-artifact@v4
with:
name: couchbase-${{ needs.source.outputs.extension_version }}
- uses: actions/download-artifact@v4
with:
name: scripts-${{ needs.source.outputs.extension_version }}
- uses: actions/download-artifact@v4
with:
path: tests
name: tests-${{ needs.source.outputs.extension_version }}
- uses: actions/download-artifact@v4
with:
name: couchbase-${{ needs.source.outputs.extension_version }}-php${{ matrix.php }}-${{ matrix.ts }}-linux-x86_64
- name: Test
timeout-minutes: 60
env:
TEST_SERVER_VERSION: "${{ matrix.server }}"
TEST_LOG_LEVEL: trace
TEST_BUCKET: default
TEST_USE_WAN_DEVELOPMENT_PROFILE: true
OTHER_TEST_BUCKET: secBucket
run: |
tar xf couchbase-*-linux-x86_64.tgz
ruby ./bin/test.rb
- name: Publish Test Report
uses: mikepenz/[email protected]
if: always()
with:
check_name: 🐧server, php-${{ matrix.php }}-${{ matrix.ts }}
report_paths: results.xml
require_tests: true
annotate_only: true
- name: Collect server logs
timeout-minutes: 15
if: failure()
run: |
cbdinocluster -v collect-logs $CLUSTER_ID ./logs
- name: Upload logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.server }}-logs
path: |
logs/*

build_macos_x86_64:
needs: source
runs-on: macos-13
Expand Down Expand Up @@ -509,3 +614,126 @@ jobs:
report_paths: results.xml
require_tests: true
annotate_only: true

build_windows:
needs: source
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
php:
- '8.3.4'
- '8.2.17'
- '8.1.27'
ts:
- nts
- zts
arch:
- x64
- x86
steps:
- name: Install dependencies
shell: cmd
run: |
# winget install Git.Git
# winget install Kitware.CMake
# winget install NASM.NASM
choco install nasm
git clone --no-progress https://github.com/php/php-sdk-binary-tools.git c:\php\php-sdk
git clone --no-progress --depth 1 --branch php-${{ matrix.php }} https://github.com/php/php-src.git c:\php\php-src
- uses: actions/download-artifact@v4
with:
path: c:\php
name: couchbase-${{ needs.source.outputs.extension_version }}
- uses: actions/download-artifact@v4
with:
path: c:\php
name: scripts-${{ needs.source.outputs.extension_version }}
- name: Build
working-directory: c:\php
shell: cmd
run: |
7z x couchbase-${{ needs.source.outputs.extension_version }}.tgz -so | 7z x -aoa -si -ttar
cd c:\php\php-src
echo call buildconf.bat --add-modules-dir=c:\php > task.bat
echo call configure.bat --disable-all --enable-cli ${{ matrix.ts == 'nts' && '--disable-zts' || '' }} --enable-couchbase >> task.bat
echo nmake >> task.bat
call c:\php\php-sdk\phpsdk-vs16-${{ matrix.arch }}.bat -t task.bat
exit /b %ERRORLEVEL%
- name: Package
id: package
working-directory: c:\php
run: |
$PhpVersion = ("${{ matrix.php }}" -split '\.')[0..1] -join '.'
Add-Content -Path $env:GITHUB_OUTPUT -Value "php_version=$PhpVersion"
$SourceDirectory = (Get-ChildItem -Path "c:\php" -Directory "couchbase-*" | Select-Object -First 1).FullName
$DistName = "couchbase-${{ needs.source.outputs.extension_version }}-php${PhpVersion}-${{ matrix.ts }}-windows-${{ matrix.arch }}"
New-Item -ItemType Directory -Path $DistName | Out-Null
$FilesToCopy = Get-ChildItem -Path . -Filter "couchbase-*" -Include LICENSE,"Couchbase","GPBMetadata"
Copy-Item -Path 90-couchbase.ini -Destination $DistName -Force
Copy-Item -Path "${SourceDirectory}\LICENSE" -Destination $DistName -Force
Copy-Item -Path "${SourceDirectory}\Couchbase" -Destination $DistName -Force -Recurse
Copy-Item -Path "${SourceDirectory}\GPBMetadata" -Destination $DistName -Force -Recurse
$FilesToCopy = Get-ChildItem -Path "C:\php\php-src\${{ matrix.arch == 'x64' && 'x64\\' || '' }}Release${{ matrix.ts == 'zts' && '_TS' || '' }}" -Filter "php_couchbase.*"
foreach ($File in $FilesToCopy) {
Write-Host "Copying file: $($File.FullName)"
Copy-Item -Path $File.FullName -Destination $DistName -Force
}
$ZipArchive = $DistName + ".zip"
Write-Host "Compressing $DistName directory into $ZipArchive"
Compress-Archive -Path $DistName -DestinationPath $ZipArchive -CompressionLevel Optimal
- uses: actions/upload-artifact@v4
with:
name: couchbase-${{ needs.source.outputs.extension_version }}-php${{ steps.package.outputs.php_version }}-${{ matrix.ts }}-windows-${{ matrix.arch }}
path: |
c:\php\couchbase-*-windows-${{ matrix.arch }}.zip

mock_windows:
needs:
- source
- build_windows
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
php:
- '8.1'
- '8.2'
- '8.3'
ts:
- nts
- zts
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: json, mbstring, intl, sockets
env:
phpts: ${{ matrix.ts }}
- uses: actions/download-artifact@v4
with:
name: couchbase-${{ needs.source.outputs.extension_version }}
- uses: actions/download-artifact@v4
with:
name: scripts-${{ needs.source.outputs.extension_version }}
- uses: actions/download-artifact@v4
with:
path: tests
name: tests-${{ needs.source.outputs.extension_version }}
- uses: actions/download-artifact@v4
with:
name: couchbase-${{ needs.source.outputs.extension_version }}-php${{ matrix.php }}-${{ matrix.ts }}-windows-x64
- name: Test
timeout-minutes: 60
run: |
Expand-Archive -Path couchbase-*-windows-x64.zip
ruby ./bin/test.rb
- name: Publish Test Report
uses: mikepenz/[email protected]
if: always()
with:
check_name: 🪟caves, php-${{ matrix.php }}-${{ matrix.ts }}
report_paths: results.xml
require_tests: true
annotate_only: true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
.deps
.libs/
.phpdoc
.cache
/*.out
/logs
/.idea/
/.phpunit.result.cache
/Debug/
Expand Down
Loading