According to the manual at travis-ci, if I have in my .travis.yml
env:
- FOO=foo BAR=bar
- FOO=bar BAR=foo
it will trigger two parallel builds:
FOO=foo and BAR=bar
FOO=bar and BAR=foo
Is it possible to have conditional code which only run in one instance, i.e. the first? I have a test which I only want to do for the instance (1) but not two, as it will produce an error in (2)?
My .tavis.yml looks at the moment like this:
Language: objective-c
before_install:
- brew update
install:
- brew tap rkrug/experimental
- brew tap homebrew/science
- brew update
env:
- PACKAGE=nc_spm_08_grass7 INSTALLOPTIONS=""
- PACKAGE=grass-71 INSTALLOPTIONS="--HEAD"
script:
# - brew audit $PACKAGE
- brew install $INSTALLOPTIONS $PACKAGE
- brew test -v $PACKAGE
- brew uninstall $PACKAGE
and the brew audit $PACKAGE I only want to execute for the first instance.
How about using an if condition in Bash to test the $PACKAGE environment variable?
You could replace the commented line in your .travis.yml file with something like:
- if [[ "$PACKAGE" == "nc_spm_08_grass7" ]]; then brew audit $PACKAGE; else echo "[SKIPPED] brew audit $PACKAGE"; fi
Hope this helps!
Related
I am trying to create a conda environment in Docker, which has worked fine in the past. Recently, however, I am met with the following error
Command
conda env create --file /workflow/environment.yml
Error
Pip subprocess error:
ERROR: Invalid requirement: '=' (from line 9 of /workflow/condaenv.8c7h85ns.requirements.txt)
Hint: = is not a valid operator. Did you mean == ?
This is the contents of my environment.yml file
name: pipeline
channels:
- conda-forge
- bioconda
dependencies:
- python=3.7
- pip=20.2.*
- snakemake=5.22.*
- nanoplot=1.31.*
- nanofilt=2.7.*
- nanoqc=0.9.*
- minimap2=2.*
- seqkit=0.13.*
- cutadapt=2.*
- plotly=4.8.*
- spoa=4.*
- seaborn=0.10.*
- edlib>=1.1.2
- natsort=7.1.*
- pip:
- networkx==2.3.*
The only place I'm using pip is in the last line, and I'm already using a double equal-sign. I tried to create the environment outside docker, which worked. I'm not sure where this is going wrong.
I appreciate any help!
I am trying to run lint and tests separately with tox-travis, but I cannot seem to get the right combo.
Here are the two base files:
tox.ini
[tox]
envlist = py27, py34, py35, py36, lint
[travis]
python =
3.6: py36
3.5: py35
3.4: py34
2.7: py27
[travis:env]
LINT =
yes: py36, lint
[testenv:lint]
....
[testenv]
...
commands =
pip install -U pip
py.test --basetemp={envtmpdir}
travis.yml
language: python
python:
- 3.6, lint
- 3.5
- 3.4
- 2.7
matrix:
include:
- python: 3.6
env:
- LINT=yes
install: pip install -U tox-travis
script: tox
When python={3.6,3.5,3.4,2.7} and LINT is not set only tests are
run. (correct).
When python=3.6 and LINT=yes it runs NEITHER lint
or tests. (incorrect)
Setting
LINT =
yes: lint
When python={3.6,3.5,3.4,2.7} and LINT is not set only tests are
run. (correct).
When python=3.6 and LINT=yes it runs neither
tests or lint. (incorrect)
Setting: 3.6: py36,lint and yes: lint runs lint whenever python=3.6 regardless of LINT value.
What am I doing wrong here?
How can i answer a question made by the console in travis-ci? I made a script that is downloading gvm but right after it completes i receive something like this:
"Do you want grails 2.1.5 to be set as default? (Y/n):"
Right after this question the build can't go foward, i tried to use expects but i was not very successful, my travis.yml is this:
language: groovy
jdk:
- oraclejdk7
before_install:
rm -rf ~/.gvm
curl -s get.gvmtool.net > ~/install_gvm.sh
chmod 775 ~/install_gvm.sh
~/install_gvm.sh
source "/home/travis/.sdkman/bin/sdkman-init.sh"
sdk install grails 2.1.5
echo "gvm_auto_answer=Y" > ~/.sdkman/bin/config
branches:
only:
- master
script: grails test-app --non-interactive
EDIT Grails wrapper is not working as you can see here
https://travis-ci.org/jpms2/ResS/builds/81761164
I seemed to find a problem like mine that happened with gvm instalation, the solution to this problem was a command like this:
echo "gvm_auto_answer=true" >> ~/.gvm/etc/config
So i tried to use this command and had no success:
echo "gvm_auto_answer=Y" >> ~/.sdkman/etc/config
I did find a way to pass the log message, using
echo sdkman_auto_answer=true > ~/.sdkman/etc/config
my travis.yml file is like this now:
language: groovy
jdk:
- oraclejdk7
before_install:
rm -rf ~/.gvm
curl -s get.gvmtool.net > ~/install_gvm.sh
chmod 775 ~/install_gvm.sh
~/install_gvm.sh
echo sdkman_auto_answer=true > ~/.sdkman/etc/config
source "/home/travis/.sdkman/bin/sdkman-init.sh"
sdk install grails 2.1.5
branches:
only:
- master
script: grails test-app --non-interactive
This is my travis.yml
language: java
sudo: required
jdk:
- oraclejdk8
install: true
script:
- sudo apt-get update && sudo apt-get install oracle-java8-installer
- java -version
after_success:
- ./gradlew test jacocoTestReport coveralls
And this is the travis output:
[...]
:processTestResources
:testClasses
:test
Download https://repo1.maven.org/maven2/org/jacoco/org.jacoco.agent/0.7.5.201505241946/org.jacoco.agent-0.7.5.201505241946.pom
Download https://repo1.maven.org/maven2/org/jacoco/org.jacoco.build/0.7.5.201505241946/org.jacoco.build-0.7.5.201505241946.pom
Download https://repo1.maven.org/maven2/org/jacoco/org.jacoco.agent/0.7.5.201505241946/org.jacoco.agent-0.7.5.201505241946.jar
No output has been received in the last 10 minutes, this potentially indicates a stalled build or something wrong with the build itself.
The build has been terminated
I have no idea why and how I can debug this :\ any hints?
Works on my machine.
It turned out it has nothing to do with jacoco. I'm using JavaFX with TestFX and, of course, it needs a frame buffer. It works after enabling xvfb:
before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
I am playing with travis-ci for the first time and have run into an error thats confusing me.
Below is my .travis.yml which validates when linted.
language: node_js
node_js:
- 0.8
after_script:
- echo "Hello World"
The following is my travis build output:
$ git clone --depth=50 --branch=master git://github.com/iancrowther/travis-experiment.git iancrowther/travis-experiment
Cloning into 'iancrowther/travis-experiment'...
remote: Counting objects: 27, done.
remote: Compressing objects: 100% (21/21), done.
remote: Total 27 (delta 2), reused 20 (delta 0)
Receiving objects: 100% (27/27), done.
Resolving deltas: 100% (2/2), done.
$ cd iancrowther/travis-experiment
git.2
$ git checkout -qf xxx
$ nvm use 0.8
Now using node v0.8.22
$ node --version
v0.8.22
$ npm --version
1.2.14
$ make test
make: *** No rule to make target `test'. Stop.
The command "make test" exited with 2.
after_script
$ echo "Hello World"
Hello World
Done. Your build exited with 1.
How can i prevent the make file being executed?
Any help would be great, I cant seem to ind the errors explained in the doc's
Ian
ps. does anyone have any links to a guide about styling code??
UPDATE
when #User re-formatted the question, they added the following comment: "used {} button to make the code visible".
change after_script to script
Have a look at this .travis.yml :
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq python3.2 python2.7
python:
- "2.7"
script: ./run_build.sh
The last line is the important one.
script is the command that runs the test.
before is something that enables the test to run
and after is something to clean up.
It is the same pattern you may know from unittests. Setup, Test, Teardown
Since Travis does not find a script: I guess it takes a default option for testing.