travis-ci script
Asked Answered
G

2

17

I'm trying to setup phing to work with travis-ci, but I can't get it to run a setup script to get all the dependencies installed.

My .travis.yml file is:

language: php
php:
  - 5.2
script: ./.travis-phing.sh

In travis, I get the error:

/home/travis/build.sh: line 105: ./.travis-phing.sh: Permission denied

What is causing that?

Galoshes answered 22/3, 2013 at 13:46 Comment(0)
G
26

Solved

The script to be set to execute. I used:

chmod a+x .travis-phing.sh

Then simply commit, and push back to github.

Galoshes answered 22/3, 2013 at 14:20 Comment(2)
The travis docs suggest chmod ugo+x rather than a+x. (No idea if there are cases where this matters!)Tertias
No; a is just a shorthand for ugo.Afresh
C
1

Run the script using bash

Another option would be to run the script using bash, this would omit the need to modify the files' permissions.

bash path/to/file.sh

Alternatively:

sh path/to/file.sh

Note that

In this case you're not executing the script itself, you're executing bash or sh which then runs the script. Therefore the script does not need to be executable.

Make sense?


I've found this solution incredibly useful myself. I'm mainly running node & npm projects on travis-ci, those builds make use of the npm test command which you can configure to be anything.

I'm order to modify file permission I need to use sudo chmod ... on my local machine. But you can't always use sudo on travis-ci.

sh file.sh allows me to run my tests both locally and on travis-ci without having to manually update permissions.

Creatine answered 19/10, 2017 at 6:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.