PCBC-859: Update build scripts and instructions for Windows #18
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: tests | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
source: | |
runs-on: ubuntu-22.04 | |
outputs: | |
extension_version: ${{ steps.build_extension.outputs.extension_version }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
fetch-tags: true | |
- uses: hendrikmuhs/[email protected] | |
with: | |
max-size: 2G | |
key: ${{ github.job }} | |
- name: Build | |
id: build_extension | |
run: | | |
gem install --no-document --user-install nokogiri | |
export COMMITS_SINCE_LAST_TAG=$(git describe --tags --always --long | awk -F '-' '{print $2}') | |
EXTENSION_VERSION=$(ruby -e 'print [ARGF.read[/PHP_COUCHBASE_VERSION "(\d+\.\d+\.\d+)"/, 1], ENV["COMMITS_SINCE_LAST_TAG"].to_i > 0 ? ENV["COMMITS_SINCE_LAST_TAG"] : nil].compact.join(".")' src/php_couchbase.hxx) | |
echo "extension_version=${EXTENSION_VERSION}" >> "$GITHUB_OUTPUT" | |
export BUILD_NUMBER="${COMMITS_SINCE_LAST_TAG}" | |
ruby ./bin/package.rb | |
- name: PHPDoc | |
run: | | |
ruby ./bin/docs.rb | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: couchbase-${{ steps.build_extension.outputs.extension_version }} | |
path: | | |
couchbase-*.tgz | |
- uses: actions/upload-artifact@v4 | |
with: | |
retention-days: 1 | |
name: scripts-${{ steps.build_extension.outputs.extension_version }} | |
path: | | |
bin/**/* | |
90-couchbase.ini | |
phpcs.xml | |
- uses: actions/upload-artifact@v4 | |
with: | |
retention-days: 1 | |
name: tests-${{ steps.build_extension.outputs.extension_version }} | |
path: | | |
tests/**/* | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: docs-${{ steps.build_extension.outputs.extension_version }} | |
path: | | |
build/couchbase-php-client-*/**/* | |
build_alpine: | |
needs: source | |
name: alpine | |
runs-on: ubuntu-22.04 | |
container: | |
image: alpine:3.19 | |
strategy: | |
fail-fast: false | |
matrix: | |
php: | |
- '81' | |
- '82' | |
- '83' | |
steps: | |
- name: Install build environment | |
run: | | |
apk update | |
apk add --no-cache \ | |
bash \ | |
build-base \ | |
ccache \ | |
cmake \ | |
curl \ | |
g++ \ | |
gcc \ | |
git \ | |
linux-headers \ | |
make \ | |
ninja-build \ | |
php${{ matrix.php }}-dev \ | |
php${{ matrix.php }}-pear \ | |
openssl \ | |
openssl-dev \ | |
readline-dev \ | |
ruby \ | |
tar \ | |
xz \ | |
yaml-dev \ | |
zlib-dev | |
- 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: hendrikmuhs/[email protected] | |
with: | |
max-size: 2G | |
key: ${{ github.job }}-${{ matrix.php }} | |
- name: Build | |
run: | | |
pecl${{ matrix.php }} bundle couchbase-${{ needs.source.outputs.extension_version }}.tgz | |
( | |
cd couchbase | |
phpize${{ matrix.php }} | |
./configure --enable-couchbase --with-php-config=$(which php-config${{ matrix.php }}) | |
mkdir target | |
make INSTALL_ROOT="$(realpath target)" install | |
) | |
PHP_VERSION_SHORT=${{ matrix.php }} | |
PHP_VERSION="${PHP_VERSION_SHORT:0:1}.${PHP_VERSION_SHORT:1}" | |
echo "PHP_VERSION=$PHP_VERSION" >> $GITHUB_ENV | |
DIST_NAME=couchbase-${{ needs.source.outputs.extension_version }}-php${PHP_VERSION}-nts-linux-musl-x86_64 | |
mkdir ${DIST_NAME} | |
cp -av couchbase/LICENSE 90-couchbase.ini couchbase/Couchbase couchbase/GPBMetadata ${DIST_NAME}/ | |
find couchbase/target -name couchbase.so -exec cp -v {} ${DIST_NAME}/ \; | |
strip --strip-all ${DIST_NAME}/couchbase.so | |
tar cv ${DIST_NAME}/ | gzip -9 > ${DIST_NAME}.tgz | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: couchbase-${{ needs.source.outputs.extension_version }}-php${{ matrix.php }}-nts-linux-musl-x86_64 | |
path: | | |
couchbase-*-linux-musl-x86_64.tgz | |
mock_alpine: | |
needs: | |
- source | |
- build_alpine | |
runs-on: ubuntu-22.04 | |
container: | |
image: alpine:3.19 | |
strategy: | |
fail-fast: false | |
matrix: | |
php: | |
- '81' | |
- '82' | |
- '83' | |
steps: | |
- name: Install test environment | |
run: | | |
apk update | |
apk add --no-cache \ | |
bash \ | |
curl \ | |
git \ | |
php${{ matrix.php }}-dev \ | |
php${{ matrix.php }}-pear \ | |
php${{ matrix.php }}-dom \ | |
php${{ matrix.php }}-intl \ | |
php${{ matrix.php }}-mbstring \ | |
php${{ matrix.php }}-pecl-pcov \ | |
php${{ matrix.php }}-pecl-xdebug \ | |
php${{ matrix.php }}-phar \ | |
php${{ matrix.php }}-sockets \ | |
php${{ matrix.php }}-tokenizer \ | |
php${{ matrix.php }}-xml \ | |
php${{ matrix.php }}-xmlwriter \ | |
openssl \ | |
ruby \ | |
tar \ | |
xz \ | |
yaml-dev \ | |
zlib-dev | |
- 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 }}-nts-linux-musl-x86_64 | |
- name: Test | |
env: | |
CB_PHP_NAME: php${{ matrix.php }} | |
run: | | |
tar xf couchbase-*-linux-musl-x86_64.tgz | |
ruby ./bin/test.rb | |
- name: Publish Test Report | |
uses: mikepenz/[email protected] | |
if: always() | |
with: | |
check_name: ⛰️ caves, php-${{ matrix.php }} | |
report_paths: results.xml | |
require_tests: true | |
annotate_only: true | |
build_linux_x86_64: | |
needs: source | |
runs-on: ubuntu-20.04 | |
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 | |
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: hendrikmuhs/[email protected] | |
with: | |
max-size: 2G | |
key: ${{ github.job }}-${{ matrix.php }}-${{ matrix.ts }} | |
- name: Build | |
run: | | |
pecl bundle couchbase-${{ needs.source.outputs.extension_version }}.tgz | |
( | |
cd couchbase | |
phpize | |
./configure --enable-couchbase | |
mkdir target | |
make INSTALL_ROOT="$(realpath target)" install | |
) | |
DIST_NAME=couchbase-${{ needs.source.outputs.extension_version }}-php${{ matrix.php }}-${{ matrix.ts }}-linux-x86_64 | |
mkdir ${DIST_NAME} | |
cp -av couchbase/LICENSE 90-couchbase.ini couchbase/Couchbase couchbase/GPBMetadata ${DIST_NAME}/ | |
find couchbase/target -name couchbase.so -exec cp -v {} ${DIST_NAME}/ \; | |
strip --strip-all ${DIST_NAME}/couchbase.so | |
tar cv ${DIST_NAME}/ | gzip -9 > ${DIST_NAME}.tgz | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: couchbase-${{ needs.source.outputs.extension_version }}-php${{ matrix.php }}-${{ matrix.ts }}-linux-x86_64 | |
path: | | |
couchbase-*-linux-x86_64.tgz | |
mock_linux_x86_64: | |
needs: | |
- source | |
- build_linux_x86_64 | |
runs-on: ubuntu-22.04 | |
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 | |
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 }}-linux-x86_64 | |
- name: Test | |
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: 🐧caves, php-${{ matrix.php }}-${{ matrix.ts }} | |
report_paths: results.xml | |
require_tests: true | |
annotate_only: true | |
build_macos_x86_64: | |
needs: source | |
runs-on: macos-13 | |
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 }} | |
# https://github.com/shivammathur/icu-intl#icu4c-builds | |
extensions: json, mbstring, intl-74.1 | |
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: hendrikmuhs/[email protected] | |
with: | |
max-size: 2G | |
key: ${{ github.job }}-${{ matrix.php }}-${{ matrix.ts }} | |
- name: Build | |
run: | | |
pecl bundle couchbase-${{ needs.source.outputs.extension_version }}.tgz | |
( | |
cd couchbase | |
phpize | |
./configure --enable-couchbase | |
mkdir target | |
make INSTALL_ROOT="$(realpath target)" install | |
) | |
DIST_NAME=couchbase-${{ needs.source.outputs.extension_version }}-php${{ matrix.php }}-${{ matrix.ts }}-macos-x86_64 | |
mkdir ${DIST_NAME} | |
cp -av couchbase/LICENSE 90-couchbase.ini couchbase/Couchbase couchbase/GPBMetadata ${DIST_NAME}/ | |
find couchbase/target -name couchbase.so -exec cp -v {} ${DIST_NAME}/ \; | |
strip ${DIST_NAME}/couchbase.so 2>/dev/null || true | |
tar cv ${DIST_NAME}/ | gzip -9 > ${DIST_NAME}.tgz | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: couchbase-${{ needs.source.outputs.extension_version }}-php${{ matrix.php }}-${{ matrix.ts }}-macos-x86_64 | |
path: | | |
couchbase-*-macos-x86_64.tgz | |
mock_macos_x86_64: | |
needs: | |
- source | |
- build_macos_x86_64 | |
runs-on: macos-13 | |
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 }} | |
# https://github.com/shivammathur/icu-intl#icu4c-builds | |
extensions: json, mbstring, intl-74.1 | |
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 }}-macos-x86_64 | |
- name: Test | |
run: | | |
tar xf couchbase-*-macos-x86_64.tgz | |
CB_PHP_EXECUTABLE=$(which php) 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 | |
build_macos_arm64: | |
needs: source | |
runs-on: macos-14 | |
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 }} | |
# https://github.com/shivammathur/icu-intl#icu4c-builds | |
extensions: json, mbstring, intl-74.1 | |
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: hendrikmuhs/[email protected] | |
with: | |
max-size: 2G | |
key: ${{ github.job }}-${{ matrix.php }}-${{ matrix.ts }} | |
- name: Build | |
run: | | |
pecl bundle couchbase-${{ needs.source.outputs.extension_version }}.tgz | |
( | |
cd couchbase | |
phpize | |
./configure --enable-couchbase | |
mkdir target | |
make INSTALL_ROOT="$(realpath target)" install | |
) | |
DIST_NAME=couchbase-${{ needs.source.outputs.extension_version }}-php${{ matrix.php }}-${{ matrix.ts }}-macos-arm64 | |
mkdir ${DIST_NAME} | |
cp -av couchbase/LICENSE 90-couchbase.ini couchbase/Couchbase couchbase/GPBMetadata ${DIST_NAME}/ | |
find couchbase/target -name couchbase.so -exec cp -v {} ${DIST_NAME}/ \; | |
strip ${DIST_NAME}/couchbase.so 2>/dev/null || true | |
tar cv ${DIST_NAME}/ | gzip -9 > ${DIST_NAME}.tgz | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: couchbase-${{ needs.source.outputs.extension_version }}-php${{ matrix.php }}-${{ matrix.ts }}-macos-arm64 | |
path: | | |
couchbase-*-macos-arm64.tgz | |
mock_macos_arm64: | |
needs: | |
- source | |
- build_macos_arm64 | |
runs-on: macos-14 | |
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 }} | |
# https://github.com/shivammathur/icu-intl#icu4c-builds | |
extensions: json, mbstring, intl-74.1 | |
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 }}-macos-arm64 | |
- name: Test | |
run: | | |
tar xf couchbase-*-macos-arm64.tgz | |
CB_PHP_EXECUTABLE=$(which php) 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 |