Override properties of php for HHVM - travis-ci

i try use phpenv config_add ./new.php.ini in job for HHVM, but job is filed with message
cp: cannot create regular file `/home/travis/.phpenv/versions/hhvm/etc/conf.d': No such file or directory
How can I override some properties on travis-ci?

You don't need to run pnpenv config_add in hhvm environment:
before_script:
- |
if [[ $TRAVIS_PHP_VERSION = "hhv"* ]]; then
cat new.php.ini >> /etc/hhvm/php.ini
else
phpenv config-add new.php.ini
fi

Create /etc/hhvm/php.ini, and put your settings in there.

Related

How can I configure Travis CI to test correct loading a library repo under PlatformIO?

I have a library used by a number of Arduino projects. I use PlatformIO as my build system, so I've created a library.json file in the root of the library to identify dependent libraries that should be loaded when I include this library in a project. All good.
Sometimes the dependent libraries get changed - PlatformIO is particularly sensitive to renaming them in the Arduino library.properties file. It is a pain when I discover that my library is broken only when I try to build a project that uses it.
I'd like to configure Travis to run periodically (thanks, Travis cron jobs!) and confirm that I can load all dependent libaries.
pio ci does not really apply to libraries. pio test requires a PlatformIO subscription (highly recommended, but not always an option).
Put the following in .travis.yml:
```
PlatformIO dependency test
- language: python
python: 2.7
install:
- pip install -U platformio
script:
- mkdir test_platformio_deps
- cd test_platformio_deps
- echo "[env:adafruit_feather_m0]" > platformio.ini
- echo "platform = atmelsam" >> platformio.ini
- echo "board = adafruit_feather_m0" >> platformio.ini
- echo "framework = arduino" >> platformio.ini
- if [ "${TRAVIS_PULL_REQUEST_SLUG}" = "" ]; then echo "lib_deps = SPI, https://github.com/${TRAVIS_REPO_SLUG}" ; else echo "lib_deps = SPI, https://github.com/${TRAVIS_PULL_REQUEST_SLUG}#${TRAVIS_PULL_REQUEST_BRANCH}" ; fi >> platformio.ini
- cat platformio.ini
- mkdir src
- echo "int main() {}" > src/main.cpp
- platformio run
cache:
directories:
- "~/.platformio"
```
It will create a simple project that depends on your library and then attempt to build it. If all dependencies load, it will succeed.
The tricky line with TRAVIS_PULL_REQUEST_SLUG handles running the test within a PR.

error with Uncrustify in xcode for an ios app

I have installed the uncrustify through brew (as per the git instructions), and I have added the run script build phase to the xcode and tried to build an ios project, but the build is failing with the following error:
**/bin/sh: /Users/test/Library/Developer/Xcode/DerivedData/testProj- amlbymrfycxuzmemclwtovltjxzl/Build/Intermediates/testProj.build/Debug-iphoneos/testProj.build/Script-AC898878187BE0A00056CAB1.sh: sh: bad interpreter: No such file or directory**
How can I resolve this error? Any help would be appreciated. Thanks in advance.
My sh script:
if [ -n "$1" ]
then
# recover directory to format :
pathToSourcesDirectory=`echo $(pwd)/$1`
# go to current folder :
scriptDirectory=$(dirname $0)
cd $scriptDirectory
# find sources files to format :
echo ""
echo "==> Getting files to format in directory " + $pathToSourcesDirectory
mkdir -p temp
find $pathToSourcesDirectory -name "*.[mh]" > temp/sources_to_uncrustify.txt
# format files :
echo ""
echo "==> Format files"
/usr/local/bin/uncrustify -F temp/sources_to_uncrustify.txt -c "../uncrustify_objective_c.cfg" --no-backup
# remove temp files :
rm -rf temp/
else
echo "Error : You must specify a source folder as first parameter"
fi
It looks like you don't have Shell set to /bin/sh in the Xcode Run Script configuration:
(screenshot taken from here).

jenkins plugin for triggering build whenever any file changed in a given directory

I am looking for functionality where we have a directory with some files in it.
Whenever any one makes a change in any of the files in the directory, jenkins shoukd trigger a build.
Is there any plugin or mathod for this functionality. Please advise.
Thanks in advance.
I have not tried it myself, but The FSTrigger plugin seems to do what you want:
FSTrigger provides polling mechanisms to monitor a file system and
trigger a build if a file or a set of files have changed.
If you can monitor the directory with a script, you can trigger the build with a HTTP GET, for example with wget or curl:
wget -O- $JENKINS_URL/job/JOBNAME/build
Although slightly related.. it seems like this issue was about monitoring static files on system.. however there are many version control systems for just this purpose.
I answered this in another post if you're using git to track changes on the files themselves:
#!/bin/bash
set -e
job_name="whatever"
JOB_URL="http://myserver:8080/job/${job_name}/"
FILTER_PATH="path/to/folder/to/monitor"
python_func="import json, sys
obj = json.loads(sys.stdin.read())
ch_list = obj['changeSet']['items']
_list = [ j['affectedPaths'] for j in ch_list ]
for outer in _list:
for inner in outer:
print inner
"
_affected_files=`curl --silent ${JOB_URL}${BUILD_NUMBER}'/api/json' | python -c "$python_func"`
if [ -z "`echo \"$_affected_files\" | grep \"${FILTER_PATH}\"`" ]; then
echo "[INFO] no changes detected in ${FILTER_PATH}"
exit 0
else
echo "[INFO] changed files detected: "
for a_file in `echo "$_affected_files" | grep "${FILTER_PATH}"`; do
echo " $a_file"
done;
fi;
You can add the check directly to the top of the job's exec shell, and it will exit 0 if no changes detected.. Hence, you can always poll the top level of the repo for check-in's to trigger a build. And only complete a build if the files in question change.

Is there a good macvim git diff?

I have been using textmate for many years and I just made the switch to macvim and one thing that I used all the time with textmate was the command git df which in my .gitconfig was just an alias for
[alias]
df = !git diff | mate
and what that did was give me a screen like this
Is there a replacement in mvim that I can add somewhere for me to get similar behavior
I describe what I use here.
Basically, add the following lines to your "~/.gitconfig":
[diff]
tool = default-difftool
[difftool "default-difftool"]
cmd = default-difftool.sh $LOCAL $REMOTE
With the following wrapper script:
#! /bin/bash
if [[ -f /Applications/MacVim.app/Contents/MacOS/Vim ]]
then
# bypass mvim for speed
VIMPATH='/Applications/MacVim.app/Contents/MacOS/Vim -g -dO -f'
elif [[ -f /usr/local/bin/mvim ]]
then
# fall back to mvim
VIMPATH='mvim -d -f'
else
# fall back to original vim
VIMPATH='vimdiff'
fi
$VIMPATH $#
You can get the diff one file at a time by doing:
git difftool -t vimdiff
vimdiff can be replaced with gvimdiff for gvim, so I would assume you can also replace it with mvimdiff for macvim.
I am not sure of a way to pipe the entirety of git diff into vim though.

How can I find the location of the tcsh shell script I'm executing?

Say I put an executable tcsh file in /path/to/my_script.csh
and my current directory is anywhere, for example I'm in /path
So I type to/my_script.csh
I want to have a line in my_script.csh that will return "/path/to/my_script.csh" - like ruby's
__FILE__
In c shell, try like this:
set rootdir = `dirname $0`
set abs_rootdir = `cd $rootdir && pwd`
echo $abs_rootdir
If you want to ensure the same result (full path and script name) try something like this:
...
rootdir=`/bin/dirname $0` # may be relative path
rootdir=`cd $rootdir && pwd` # ensure absolute path
zero=$rootdir/`/bin/basename $0`
echo $zero
...
Then you can call it as foo.sh, ./foo.sh, some/lower/dir/foo.sh and still get the same result no matter how it is called.
If you want an absolute path then this should help you out:
#!/bin/tcsh -f
set called=($_)
if ( "$called" != "" ) then ### called by source
echo "branch 1"
set script_fn=`readlink -f $called[2]`
else ### called by direct execution of the script
echo "branch 2"
set script_fn=`readlink -f $0`
endif
echo "A:$0"
echo "B:$called"
set script_dir=`dirname $script_fn`
echo "script file name=$script_fn"
echo "script dir=$script_dir"
Source: http://tipsarea.com/2013/04/11/how-to-get-the-script-path-name-in-cshtcsh/
#!/bin/tcsh
echo "I am $0."

Resources