Skip to content

Commit

Permalink
Merge pull request #1901 from phalcon/development
Browse files Browse the repository at this point in the history
0.12.2
  • Loading branch information
sergeyklay authored Aug 5, 2019
2 parents 25cf1fd + b3f17c2 commit 4ab69bd
Show file tree
Hide file tree
Showing 55 changed files with 1,492 additions and 1,645 deletions.
30 changes: 23 additions & 7 deletions .ci/after-failure.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# This file is part of the Zephir.
#
Expand All @@ -15,17 +15,33 @@ shopt -s nullglob

export LC_ALL=C

for i in /tmp/core.*; do
if [ -f "$i" -a "$(file "$i" | grep -o 'core file')" ]; then
gdb -q $(phpenv which php) "$i" <<EOF
if [ -f ./compile-errors.log ]
then
log_contents=$(cat ./compile-errors.log)
[[ -z "${log_contents// }" ]] || {
(>&1 echo "Compiler log:")
(>&1 printf "%s\\n" "$log_contents")
}
fi

# for some reason Ubuntu 18.04 on Travis CI doesn't install gdb
function install_gcc() {
if [ "${CI}" = "true" ] && [ "$(command -v gdb 2>/dev/null)" = "" ]
then
(>&1 echo "Install gdb...")
sudo apt-get install --no-install-recommends --quiet --assume-yes gdb 1> /dev/null
fi
}

for i in /tmp/core.php.*; do
install_gcc
(>&1 printf "Found core dump file: %s\\n\\n" "$i")
gdb -q "$(phpenv which php)" "$i" <<EOF
set pagination 0
backtrace full
info registers
x/16i \$pc
thread apply all backtrace
quit
EOF
fi
done

$(phpenv which php) -m
62 changes: 0 additions & 62 deletions .ci/after-success.sh

This file was deleted.

24 changes: 10 additions & 14 deletions .ci/build-phar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,20 @@
# -u Treat unset variables as an error when substituting.
set -eu

project_root=$(readlink -enq "$(dirname $0)/../")

if [ $(command -v box 2>/dev/null) = "" ]; then
>&2 printf "To use this script you need to install humbug/box.\n"
>&2 printf "You can learn all about humbug/box on https://github.com/humbug/box.\n"
>&2 printf "Aborting.\n"
if [ "$(command -v box 2>/dev/null)" = "" ]; then
(>&2 printf "To use this script you need to install humbug/box: %s \\n" \
"https://github.com/humbug/box")
(>&2 echo "Aborting.")
exit 1
fi

box compile --working-dir=${project_root}
box compile

if [ ! -f "${project_root}/zephir.phar" ] || [ ! -x "${project_root}/zephir.phar" ]; then
>&2 printf "Something went wrong when building Zephir.\n"
>&2 printf "Aborting.\n"
if [ ! -f "./zephir.phar" ] || [ ! -x "./zephir.phar" ]; then
(>&2 echo "Something went wrong when building zephir.phar")
(>&2 echo "Aborting.")
exit 1
fi

mkdir -p ${HOME}/bin
rm -f ${HOME}/bin/zephir

ln -s "${project_root}/zephir.phar" ${HOME}/bin/zephir
mkdir -p "$HOME/bin"
mv "./zephir.phar" "$HOME/bin/zephir"
88 changes: 26 additions & 62 deletions .ci/build-test-ext.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env bash
#
# This file is part of the Zephir.
#
Expand All @@ -14,89 +14,53 @@ set -eu
# This allows the configuration of the executable path as follows:
# ZEPHIR_BIN=zephir.phar .ci/build-test-ext.sh
# ZEPHIR_BIN=./zephir .ci/build-test-ext.sh
: ${ZEPHIR_BIN:=zephir}
: "${ZEPHIR_BIN:=zephir}"

project_root=$(readlink -enq "$(dirname $0)/../")
gcov_report=${project_root}/unit-tests/output/lcov.info
# Some defaults
: "${REPORT_COVERAGE:=0}"
: "${CFLAGS:=}"
: "${CXXFLAGS:=}"
: "${LDFLAGS:=}"

alias zephir="${ZEPHIR_BIN}"

zephir clean 2>&1 || exit 1
zephir fullclean 2>&1 || exit 1
$ZEPHIR_BIN clean 2>&1 || exit 1
$ZEPHIR_BIN fullclean 2>&1 || exit 1

# TODO: Export ZFLAGS and process by Config class
ZFLAGS=""
# ZFLAGS="${ZFLAGS} -Wnonexistent-function -Wnonexistent-class -Wunused-variable -Wnonexistent-constant"
# ZFLAGS="${ZFLAGS} -Wunreachable-code -Wnot-supported-magic-constant -Wnon-valid-decrement"

zephir generate ${ZFLAGS} 2>&1 || exit 1
zephir stubs ${ZFLAGS} 2>&1 || exit 1
zephir api ${ZFLAGS} 2>&1 || exit 1
$ZEPHIR_BIN generate ${ZFLAGS} 2>&1 || exit 1
$ZEPHIR_BIN stubs ${ZFLAGS} 2>&1 || exit 1
$ZEPHIR_BIN api ${ZFLAGS} 2>&1 || exit 1

cd ext
cd ext || exit 1

phpize

if [ ! -z ${COLLECT_COVERAGE+x} ] && [ "$COLLECT_COVERAGE" = "true" ]; then
# The ltmain.sh which bundled with PHP it's from libtool 1.5.26.
# However, the version of libtool that claims to no longer remove
# ".gcno" profiler information is libtool 2.2.6. The fix is probably
# in later libtool versions as well.
if [ "$(uname -s 2>/dev/null)" = "Darwin" ]; then
# macOS
libtoolize_bin=$(command -v glibtoolize 2>/dev/null)
else
# Linux, Gentoo, etc
libtoolize_bin=$(command -v libtoolize 2>/dev/null)
fi

aclocal && ${libtoolize_bin} --copy --force && autoheader && autoconf

CFLAGS=`echo "${CFLAGS}" | sed -e 's/-O[0-9s]*//g'`
CXXFLAGS=`echo "${CXXFLAGS}" | sed -e 's/-O[0-9s]*//g'`
LDFLAGS=`echo "${LDFLAGS}" | sed -e 's/--coverage//g'`
if [ "$REPORT_COVERAGE" -eq 1 ]
then
CFLAGS=${CFLAGS//-O[0-9s]/}
CXXFLAGS=${CXXFLAGS//-O[0-9s]/}
LDFLAGS=${LDFLAGS//--coverage/}

LDFLAGS="${LDFLAGS} --coverage"
CFLAGS="${CFLAGS} -O0 -ggdb -fprofile-arcs -ftest-coverage"
CXXFLAGS="${CXXFLAGS} -O0 -ggdb -fprofile-arcs -ftest-coverage"
fi

if [ ! -z ${CFLAGS+x} ] && [ ! -z ${LDFLAGS+x} ]; then
if [ -n "$CFLAGS" ] && [ -n "$LDFLAGS" ]
then
./configure --enable-test CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}"
else
./configure --enable-test
fi

make -j"$(getconf _NPROCESSORS_ONLN)"

cd ..
make -j"$(getconf _NPROCESSORS_ONLN)" 2> ./compile-errors.log
exitcode=$?

if [ ! -z ${COLLECT_COVERAGE+x} ] && [ "$COLLECT_COVERAGE" = "true" ]; then
if [ $(command -v lcov 2>/dev/null) = "" ]; then
printf "lcov does not exist.\nSkip capturing coverage data.\n"
else
# Reset all execution counts to zero
lcov \
--quiet \
--directory ext \
--base-directory=${project_root} \
--zerocounters 2>/dev/null

# Capture coverage data
lcov \
--quiet \
--directory ext \
--base-directory=${project_root} \
--capture \
--compat-libtool \
--initial \
--output-file ${gcov_report} 2>/dev/null

# FIXME: Fix the report
# geninfo: WARNING: could not open ${PROJECT_ROOT}/kernel/fcall.h
# geninfo: WARNING: some exclusion markers may be ignored
sed -i.bak s_${project_root}/kernel_${project_root}/ext/kernel_g ${gcov_report}
fi
fi
test "$exitcode" = 0 || {
test -f ./compile-errors.log && cat ./compile-errors.log
}

exit $?
exit $exitcode
28 changes: 13 additions & 15 deletions .ci/install-prereqs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,41 +12,39 @@
set -eu

# Ensure that this is being run inside a CI container
if [ "${CI}" != "true" ];
if [ "${CI}" != "true" ]
then
>&2 echo "This script is designed to run inside a CI container only."
>&2 echo "Aborting."
(>&2 echo "This script is designed to run inside a CI container only.")
(>&2 echo "Aborting.")
exit 1
fi

PHP_INI="$(phpenv root)/versions/$(phpenv version-name)/etc/php.ini"

: ${ZEPHIR_PARSER_VERSION:=master}
: "${ZEPHIR_PARSER_VERSION:=master}"

# Install psr extension
printf "Install psr extension\n"
printf "\n" | pecl install --force psr 1> /dev/null
(>&1 echo "Install psr extension...")
printf "\\n" | pecl install --force psr 1> /dev/null

# Install Zephir Parser
printf "Install Zephir Parser\n"
git clone -b "${ZEPHIR_PARSER_VERSION}" --depth 1 -q https://github.com/phalcon/php-zephir-parser
(>&1 echo "Install Zephir Parser...")
git clone -b "$ZEPHIR_PARSER_VERSION" --depth 1 -q https://github.com/phalcon/php-zephir-parser
cd php-zephir-parser
# shellcheck disable=SC2091
$(phpenv which phpize)
./configure --silent --with-php-config=$(phpenv which php-config) --enable-zephir_parser
./configure --silent --with-php-config="$(phpenv which php-config)" --enable-zephir_parser
make --silent -j"$(getconf _NPROCESSORS_ONLN)"
make --silent install
echo 'extension="zephir_parser.so"' > "$(phpenv root)/versions/$(phpenv version-name)/etc/conf.d/zephir_parser.ini"

# Install Box
if [ "$BUILD_PHAR" = "true" ]; then
printf "Install Box\n"
printf "PHP version number is ${PHP_VERNUM}\nDownloading humbug/box...\n"
if [ "$BUILD_PHAR" -eq "1" ]
then
(>&1 echo "Install Box...")
wget \
"https://github.com/humbug/box/releases/download/${BOX_VERSION}/box.phar" \
--quiet \
-O "${HOME}/bin/box"

chmod +x "${HOME}/bin/box"

box --version
fi
Loading

0 comments on commit 4ab69bd

Please sign in to comment.