Skip to content

Commit

Permalink
Improve CI configuration
Browse files Browse the repository at this point in the history
- Cleaned up Travis CI configuration
- Move all buil/test scripts to .ci subfolder
  • Loading branch information
sergeyklay committed Nov 13, 2018
1 parent 0437bd0 commit 9a0051b
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 37 deletions.
13 changes: 13 additions & 0 deletions .ci/999-default.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
; This file is part of the Zephir.
;
; (c) Zephir Team <[email protected]>
;
; For the full copyright and license information, please view the LICENSE
; file that was distributed with this source code.

variables_order=EGPCS
enable_dl=true
opcache.enable=0
opcache.enable_cli=0
zend.assertions=1
assert.exception=On
1 change: 0 additions & 1 deletion unit-tests/ci/after-failure.sh → .ci/after-failure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

shopt -s nullglob

$(phpenv which php) -v
$(phpenv which php) -m

export LC_ALL=C
Expand Down
7 changes: 1 addition & 6 deletions unit-tests/ci/after-success.sh → .ci/after-success.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.

if [ "${CI}" != "true" ]; then
echo "This script is designed to run inside a CI container only. Stop."
exit 1
fi

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

c_output=${PROJECT_ROOT}/unit-tests/output/coverage.info
p_output=${PROJECT_ROOT}/unit-tests/output/clover.xml
Expand Down
7 changes: 7 additions & 0 deletions unit-tests/ci/appveyor.psm1 → .ci/appveyor.psm1
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# This file is part of the Zephir.
#
# (c) Zephir Team <[email protected]>
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.

Function AppendSessionPath {
$PathsCollection = @("C:\Program Files (x86)\MSBuild\${Env:VC_VERSION}.0\Bin")
$PathsCollection += "C:\Program Files (x86)\Microsoft Visual Studio ${Env:VC_VERSION}.0\VC"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Exit the script if any statement returns a non-true return value
set -e

PROJECT_ROOT=$(readlink -enq "$(dirname $0)/../../")
PROJECT_ROOT=$(readlink -enq "$(dirname $0)/../")
DEFAULT_ZFLAGS="-Wnonexistent-function -Wnonexistent-class -Wunused-variable"

shopt -s nullglob
Expand Down
7 changes: 2 additions & 5 deletions unit-tests/ci/install-php-psr.sh → .ci/install-php-psr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,16 @@
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.

echo -e "Install a tool for writing fast and flexible scanners in C from regular expressions"

if [ "${CI}" != "true" ]; then
echo "This script is designed to run inside a CI container only. Stop."
exit 1
fi

PHP_MAJOR="$(`phpenv which php` -r 'echo phpversion();' | cut -d '.' -f 1)"
PROJECT_ROOT=$(readlink -enq "$(dirname $0)/../../")
PROJECT_ROOT=$(readlink -enq "$(dirname $0)/../")

if [ ! -f "$HOME/.cache/php-psr/php_psr.c" ]; then
rm -rf "$HOME/.cache/php-psr"
mkdir "$HOME/.cache/php-psr"
mkdir -p "$HOME/.cache/php-psr"

git clone https://github.com/jbboehr/php-psr.git "$HOME/.cache/php-psr"
fi
Expand Down
4 changes: 2 additions & 2 deletions unit-tests/ci/install-re2c.sh → .ci/install-re2c.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.

echo -e "Install a tool for writing fast and flexible scanners in C from regular expressions"

if [ "${CI}" != "true" ]; then
echo "This script is designed to run inside a CI container only. Stop."
exit 1
Expand Down Expand Up @@ -72,6 +70,8 @@ if [ ! -x "${bindir}/re2c" ]; then
exit 1
fi

cd ${TRAVIS_BUILD_DIR}

mkdir -p ${HOME}/bin
ln -s "${bindir}/re2c" ${HOME}/bin/re2c

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@ make install
popd

echo "extension=zephir_parser.so" >> $(phpenv root)/versions/$(phpenv version-name)/etc/conf.d/zephir-parser.ini

php --ri 'Zephir Parser'
12 changes: 10 additions & 2 deletions unit-tests/ci/memcheck.sh → .ci/memcheck.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#!/usr/bin/env bash
#
# This file is part of the Zephir.
#
# (c) Zephir Team <[email protected]>
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.

if [ $(valgrind -v glibtoolize 2>/dev/null) = "" ]; then
echo "Skip check for memory leaks. Valgring does not exist"
Expand All @@ -14,7 +21,7 @@ export USE_ZEND_ALLOC=0
# Do not stop testing on failures
export PHPUNIT_DONT_EXIT=1

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

valgrind
--read-var-info=yes \
Expand All @@ -24,7 +31,8 @@ valgrind
--leak-check=full \
--num-callers=20 \
--run-libc-freeres=no \
$(phpenv which php) -d "extension=${PROJECT_ROOT}/ext/modules/test.so" \
$(phpenv which php)
-d "extension=${PROJECT_ROOT}/ext/modules/test.so" \
"${PROJECT_ROOT}/unit-tests/phpunit" \
-c "${PROJECT_ROOT}/phpunit.xml.dist" \
--no-coverage \
Expand Down
22 changes: 11 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ branches:
addons:
apt:
packages:
- valgrind
- gdb
- lcov

Expand Down Expand Up @@ -55,15 +56,14 @@ before_install:
- export PHP_MINOR="$(php -r 'echo phpversion();' | cut -d '.' -f 2)"
- export PHP_VERNUM="$(php-config --vernum)"
- ulimit -c unlimited -S
- phpenv config-add ./unit-tests/ci/999-default.ini
- echo "$TRAVIS_PHP_VERSION"
- phpenv config-add ./ci/999-default.ini

install:
- ./unit-tests/ci/install-zephir-parser.sh
- ./unit-tests/ci/install-re2c.sh $RE2C_VERSION
- ./unit-tests/ci/install-php-psr.sh
- .ci/install-zephir-parser.sh
- .ci/install-re2c.sh $RE2C_VERSION
- .ci/install-php-psr.sh
- travis_retry composer install $DEFAULT_COMPOSER_FLAGS
- ./unit-tests/ci/install-test-ext.sh
- .ci/build-test-ext.sh

before_script:
# see: https://github.com/sebastianbergmann/phpunit/pull/3359
Expand Down Expand Up @@ -108,9 +108,9 @@ jobs:
env:
- REPORT_COVERAGE=0
install:
- ./unit-tests/ci/install-zephir-parser.sh
- ./unit-tests/ci/install-re2c.sh $RE2C_VERSION
- ./unit-tests/ci/install-php-psr.sh
- .ci/install-zephir-parser.sh
- .ci/install-re2c.sh $RE2C_VERSION
- .ci/install-php-psr.sh
- travis_retry composer install $DEFAULT_COMPOSER_FLAGS
- mkdir -p ${HOME}/bin
- |
Expand Down Expand Up @@ -140,10 +140,10 @@ jobs:
- php -d extension=ext/modules/test.so unit-tests/microbench.php

after_success:
- ./unit-tests/ci/after-success.sh
- .ci/after-success.sh

after_failure:
- ./unit-tests/ci/after-failure.sh
- .ci/after-failure.sh

notifications:
email: false
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ environment:
PARSER_VERSION: 1.1.3
PARSER_RELEASE: 401
ZEPHIRDIR: c:\projects\zephir
PSR_VERSION: 0.6.0
PSR_VERSION: 0.6.1

matrix:
fast_finish: true
Expand Down Expand Up @@ -74,7 +74,7 @@ init:

install:
- git submodule update --init --recursive
- ps: Import-Module .\unit-tests\ci\appveyor.psm1
- ps: Import-Module .\.ci\appveyor.psm1
- ps: AppendSessionPath
- ps: SetupPhpVersionString
- ps: EnsureRequiredDirectoriesPresent
Expand Down
6 changes: 0 additions & 6 deletions unit-tests/ci/999-default.ini

This file was deleted.

0 comments on commit 9a0051b

Please sign in to comment.