forked from nrc-cnrc/EGSnrc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial implementation of Travis-CI automation
Add a simple travis configuration file to automate testing software builds on each pull request. Travis-CI is a continuous integration service that automates building and testing software. As a starting point, the travis script simply clones the repository branch and attempts to configure EGSnrc with default parameters, to trap basic configuration failures. Add a configure.expect script to answer the EGSnrc configuration script questions automatically. This requires the expect utility to be available. Adjust the egsnrc_bashrc_additions to avoid returning an error when optional local additions files don't exist. Ensure the travis check fails when any part of the configuration fails. Some critical failures cause the configuration to abort with status 1 (error), but most failures merely echo a "failed" status to the terminal, hence travis does not trap those because it reports failure upon a non-zero return value. As a quick solution, tee the configuration terminal output message to file and use grep to trigger a status of 1 if the file contains "fail": ! grep -i fail configure.log
- Loading branch information
Showing
3 changed files
with
82 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
language: bash | ||
|
||
addons: | ||
apt: | ||
packages: | ||
- gfortran | ||
- gcc | ||
- g++ | ||
- expect | ||
|
||
before_install: | ||
- sudo apt-get -qq update | ||
- sudo apt-get install -y grace | ||
- sudo apt-get install -y libmotif-dev | ||
|
||
install: | ||
- HEN_HOUSE/scripts/configure.expect linux.conf | tee configure.log | ||
|
||
script: | ||
- pwd | ||
- for f in HEN_HOUSE/log/*.log configure.log; do echo $f; cat $f; done | ||
- (! grep -i fail configure.log) | ||
- export EGS_HOME=/home/travis/build/nrc-cnrc/EGSnrc/egs_home | ||
- export EGS_CONFIG=/home/travis/build/nrc-cnrc/EGSnrc/HEN_HOUSE/specs/linux.conf | ||
- source /home/travis/build/nrc-cnrc/EGSnrc/HEN_HOUSE/scripts/egsnrc_bashrc_additions | ||
- date |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/usr/bin/expect -f | ||
|
||
set timeout -1 | ||
|
||
# configuration filename | ||
set confname "expect.conf" | ||
if {$argc > 0} { | ||
set confname [lindex $argv 0] | ||
} | ||
|
||
# clear environment variables | ||
set env(HEN_HOUSE) "" | ||
set env(EGS_CONFIG) "" | ||
set env(EGS_HOME) "" | ||
|
||
# spawn EGSnrc configuration script | ||
spawn HEN_HOUSE/scripts/configure | ||
|
||
# Information | ||
expect "Press enter to continue." { send "\n" } | ||
|
||
# Fortran compiler | ||
expect "Input fortran compiler:" { send "\n" } | ||
expect "Input standard compilation flags:" { send "\n" } | ||
expect "Input optimization flags:" { send "\n" } | ||
expect "Input flags for debugging:" { send "\n" } | ||
expect "Input libraries that your compiler may need:" { send "\n" } | ||
|
||
# C compiler | ||
expect "Input the one you would like to use:" { send "\n" } | ||
expect "Input C compiler flags to use:" { send "\n" } | ||
|
||
# Configuration | ||
expect "Input path to EGSnrc HEN_HOUSE directory:" { send "\n" } | ||
expect "Choose a configuration file name:" { send "$confname\n" } | ||
set timeout 1 | ||
expect "Do you want to overwrite ?" { puts "no\n"; exit } | ||
set timeout -1 | ||
|
||
# C++ compiler | ||
expect "Input C++ compiler:" { send "\n" } | ||
expect "Input option to change, or enter to proceed:" { send "\n" } | ||
|
||
# Finalize for user | ||
expect "Do you want to finalize" { send "yes\n" } | ||
expect "Press enter to continue." { send "\n" } | ||
|
||
expect "Choose a directory for your user codes:" { send "\n" } | ||
expect "Choose 1 (all), 2 (some) or 3 (none):" { send "1\n" } | ||
expect "EOF" |
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