Skip to content

macos test

macos test #632

Workflow file for this run

name: macos test
on:
workflow_dispatch:
inputs:
libraries:
description: "libraries"
required: false
default: "zstd,libssh2,curl,zlib,brotli,libffi,openssl,libzip,bzip2,nghttp2,onig,libyaml,xz,libxml2"
extensions:
description: "extensions"
required: false
default: "iconv,dom,xml,simplexml,xmlwriter,xmlreader,opcache,bcmath,pdo,phar,mysqlnd,mysqli,pdo,pdo_mysql,mbstring,mbregex,session,ctype,fileinfo,filter,tokenizer,curl,ffi,swow,redis,sockets,openssl,zip,zlib,bz2,yaml,zstd,posix,pcntl,sysvshm,sysvsem,sysvmsg"
lib_only:
description: "build libraries only"
required: false
default: ""
push:
schedule:
- cron: "33 4 * * *"
env:
LWMBS_LIBRARIES: zstd,libssh2,curl,zlib,brotli,libffi,openssl,libzip,bzip2,nghttp2,onig,libyaml,xz,libxml2
LWMBS_EXTENSIONS: iconv,dom,xml,simplexml,xmlwriter,xmlreader,opcache,bcmath,pdo,phar,mysqlnd,mysqli,pdo,pdo_mysql,mbstring,mbregex,session,ctype,fileinfo,filter,tokenizer,curl,ffi,swow,redis,sockets,openssl,zip,zlib,bz2,yaml,zstd,posix,pcntl,sysvshm,sysvsem,sysvmsg
jobs:
macos:
name: PHP ${{ matrix.php-version }} ${{ matrix.arch }}
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
php-version: ["8.2", "8.1", "8.0"]
arch: ["x86_64", "arm64"]
max-parallel: 6
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Calc sources hash
id: src_hash
run: |
set -xeo pipefail
printf 'hash=' >> $GITHUB_OUTPUT
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} php fetch_source.php \
"${{ (github.event.inputs && github.event.inputs.libraries) || env.LWMBS_LIBRARIES }}" \
"${{ (github.event.inputs && github.event.inputs.extensions) || env.LWMBS_EXTENSIONS }}" \
--phpVer=${{ matrix.php-version }} \
--hash >> $GITHUB_OUTPUT
echo
- name: Cache libraries
uses: actions/cache@v3
id: cache
with:
path: |
build/src
build/downloads
build/lib
build/include
key: macos-${{ matrix.arch }}-v3-${{ steps.src_hash.outputs.hash }}
- name: Prepare tools and sources
run: |
set -xeo pipefail
brew install bison re2c automake autoconf
brew link automake
mkdir -p build
cd build
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} php ../fetch_source.php \
"${{ (github.event.inputs && github.event.inputs.libraries) || env.LWMBS_LIBRARIES }}" \
"${{ (github.event.inputs && github.event.inputs.extensions) || env.LWMBS_EXTENSIONS }}" \
--phpVer=${{ matrix.php-version }} \
--shallowClone
mkdir -p \
${GITHUB_WORKSPACE}/micro \
${GITHUB_WORKSPACE}/micro-cli \
${GITHUB_WORKSPACE}/cli
php ${GITHUB_WORKSPACE}/dump_licenses.php ${GITHUB_WORKSPACE}/micro/licenses
php ${GITHUB_WORKSPACE}/dump_licenses.php ${GITHUB_WORKSPACE}/micro-cli/licenses
php ${GITHUB_WORKSPACE}/dump_licenses.php ${GITHUB_WORKSPACE}/cli/licenses
- name: Prepare libraries
if: steps.cache.outputs.cache-hit != 'true'
working-directory: build
run: |
set -xeo pipefail
export PATH="/usr/local/opt/bison/bin:/usr/local/opt/re2c/bin:$PATH"
php ../build_libs.php \
"${{ (github.event.inputs && github.event.inputs.libraries) || env.LWMBS_LIBRARIES }}" \
--arch=${{ matrix.arch }}
- name: Build micro
if: "! (github.event.inputs && github.event.inputs.lib_only)"
id: micro
working-directory: build
continue-on-error: true
run: |
set -xeo pipefail
export PATH="/usr/local/opt/bison/bin:/usr/local/opt/re2c/bin:$PATH"
php ${GITHUB_WORKSPACE}/build_micro.php \
"${{ (github.event.inputs && github.event.inputs.libraries) || env.LWMBS_LIBRARIES }}" \
"${{ (github.event.inputs && github.event.inputs.extensions) || env.LWMBS_EXTENSIONS }}" \
--arch=${{ matrix.arch }}
cp src/php-src/sapi/micro/micro.sfx src/php-src/sapi/micro/micro.sfx.dwarf ${GITHUB_WORKSPACE}/micro/
- name: Upload artifact for micro
if: steps.micro.outcome == 'success'
uses: actions/upload-artifact@v3
with:
name: micro_${{ matrix.php-version }}_${{ matrix.arch }}_${{ steps.src_hash.outputs.hash }}
path: |
micro
- name: Build micro-cli
if: "! (github.event.inputs && github.event.inputs.lib_only)"
id: micro-cli
working-directory: build
continue-on-error: true
run: |
set -xeo pipefail
export PATH="/usr/local/opt/bison/bin:/usr/local/opt/re2c/bin:$PATH"
rm -f src/php-src/sapi/micro/php_micro.lo
php ${GITHUB_WORKSPACE}/build_micro.php \
"${{ (github.event.inputs && github.event.inputs.libraries) || env.LWMBS_LIBRARIES }}" \
"${{ (github.event.inputs && github.event.inputs.extensions) || env.LWMBS_EXTENSIONS }}" \
--arch=${{ matrix.arch }} \
--fakeCli
cp src/php-src/sapi/micro/micro.sfx ${GITHUB_WORKSPACE}/micro-cli/micro-cli.sfx
cp src/php-src/sapi/micro/micro.sfx.dwarf ${GITHUB_WORKSPACE}/micro-cli/micro-cli.sfx.dwarf
- name: Upload artifact for micro-cli
if: steps.micro-cli.outcome == 'success'
uses: actions/upload-artifact@v3
with:
name: micro-cli_${{ matrix.php-version }}_${{ matrix.arch }}_${{ steps.src_hash.outputs.hash }}
path: |
micro-cli
- name: Build cli
if: "! (github.event.inputs && github.event.inputs.lib_only)"
id: cli
working-directory: build
continue-on-error: true
run: |
set -xeo pipefail
export PATH="/usr/local/opt/bison/bin:/usr/local/opt/re2c/bin:$PATH"
php ${GITHUB_WORKSPACE}/build_cli.php \
"${{ (github.event.inputs && github.event.inputs.libraries) || env.LWMBS_LIBRARIES }}" \
"${{ (github.event.inputs && github.event.inputs.extensions) || env.LWMBS_EXTENSIONS }}" \
--arch=${{ matrix.arch }}
cp src/php-src/sapi/cli/php src/php-src/sapi/cli/php.dwarf ${GITHUB_WORKSPACE}/cli/
- name: Upload artifact for cli
if: steps.cli.outcome == 'success'
uses: actions/upload-artifact@v3
with:
name: cli_${{ matrix.php-version }}_${{ matrix.arch }}_${{ steps.src_hash.outputs.hash }}
path: |
cli
- name: Fail if anything failed
if: |
steps.cli.outcome == 'failure' ||
steps.micro.outcome == 'failure'
run: |
false
- name: Remove php src to avoid cache
run: |
rm -rf build/src/php-src