-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Travis configuration #229
Travis configuration #229
Conversation
Ah, forgot all the new stuff needs to be in a |
7be842a
to
9bc36d2
Compare
Instead of doing big conditional blocks in Travis, I might pull the new steps into a shell script. |
39b3031
to
00af78f
Compare
Not as pretty, but it works. |
Thanks for writing this! I think Also, I think we should run all the steps unconditionally, except the ones that will fail without credentials. For instance, |
|
||
sudo install -o "$USER" -d /etc/blocktogether | ||
sudo install -o "$USER" -d /data/blocktogether | ||
cp -a "$(dirname ${BASH_SOURCE[0]})/../../"config/* /etc/blocktogether/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this type of stuff, I usually put a cd $(dirname $0)
at the top of the file. You could do the same with ${BASH_SOURCE[0]}
(I assume that's more broadly accurate?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I assumed $0
had a different value, but it looks like BASH_SOURCE
is slightly more reliable: http://stackoverflow.com/a/179231
But I'll add the cd
to the top. Should we also do set -e
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, -e
is good.
For PRs from branches that are part of your own repository, Travis will build them twice as long as "Build pushes" is turned on; once as a PR and once as a push. But I also thought encrypted variables weren't available for any PRs, when they are only hidden from PRs coming from forks. So I'll update to check for the variable(s). |
What would be the benefit of running |
It makes the .travis.yml simpler, so there are fewer places where a reader has to say "Why is there a conditional here?" |
OK, fair enough. |
|
||
cd "$(dirname ${BASH_SOURCE[0]})/../../" | ||
|
||
node_modules/.bin/sequelize --config /etc/blocktogether/sequelize.json db:migrate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you put a ./
in from of this and run-dev.sh
? I generally like to do that in case .
isn't in PATH, which is fairly common. I'm actually surprised it is in Travis' PATH.
Sweet, we're passing again: https://travis-ci.org/dunn/blocktogether/builds/157387268 |
mariadb: '5.5' | ||
|
||
services: | ||
- mariadb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://docs.travis-ci.com/user/database-setup/#Starting-Services
"If you install a service in the addons: section, such as MariaDB, you do not need to add it to the services: section as well."
- secure: 'kpwd5Wl7rlVBoNzVvhU7A8FN7lIxjoL1V5gCQSdKU7FJD5SHMXctBkaw1mcvpwMqDjcvX0XCcvPyCToe2yzdRRLif8cJJqVC/CMcArkLoyhhBcqBjw9Fq3Qaj2eZZW8K0T3Ie2rLu0n3XmAW9HGUa2osc9sALXxDYwZSW+Tk4AjwcXdTzkonQe9sz+oYhOpYMX8qhjJ7LJk4sdEInemnoK0vjRTIu/9ndUcFe5WpJaNMo+k3GhfM4r+Kvv26l0m/j+daVOALzBcLTLn6XgTo0/YkTGl+50VPYhz8WbYAPWa02JzwXOzfezxe3UQDzWClU+G1CpnBpAOsvqj4Q54ccqZTrFOXvvH61n9aSI/WxFxSWRka3crGjmr//jcGfTr2dIi5YmDtDv7vD2cRzy2Gh3xZe7FtfyXMIDSiXpZ52Dq+ZESKPlWOWfYhncQ7dwj+xptqpPsZXFFI6dA5QqfGJYq8Wtelu0o8bSwSdFEUE4y656/sY4pOGpXpE/jZ091kFCQQTHb2bjXl8asKeA7FBkSJKbbaJeyQ56y3PMmn7OqPDMtzOKTtK9MDrK0fiaZUDgEMp7AOzHMViFX3vSH/u1rX+3UfkYCeKW52bK4xiGQKpsmNIK3BCqIjJfX17qW5GOgSjsAnfWTT81rdcydpf0rxI3JWse65ZMAHudNn/2k=' | ||
- secure: 'y+crCYO9hfMVE8PYe3hTpxsLQzg0zc4AWPyUClmdHUA+VvH3pPw7gtJNpO+D51IrR82pDMBrDcUH1KaEcAsN2rKDG5yLbwrt7/n2nnzFfnvUY0tA/MyR+gcu/lrjNid8VpttW5C0GF2BPkzRSy+MKfa47Iodu7OTndr3ie8KRJpjJ+R8AnSU+wIRyCe+aE5ttMHKEx7TC3ItjtGrUuwZL0lJv0OBYenRzU1QhZBR5+0Wh0yHpOdHcwhQGuutjyYC1g4iDEBygBUTWK69nEIFknUv46gAAOXk53cj9IFTeMhnUL/SFepelxMVI8Z5YrzFS0S6hQp8zliO5iv6f1H0xT6V2plngBKLP+ZzUkJdzAU1RB2Ukj3VBsEAR3PZir9nVnf+OxZhmDqiaI1uaDtCWOGA4tzeYa6jtbbrOY/7ouTCzxCHJwZia7rpH4cIHTgluVypm9wMxMcxdEB0noowEnn2miaQYB/4/FP5KNnqMC7mjT/RXDQd3LTgospLMmZDDPC26lnW841pAEA/RjbdDOhlBrN4IDSP7Jv4gYXhSHwuxEzH26LciWy/4AKz/tuQhw3Gzw3epHBYUo3iH/GQ02OTSTXmJ5Dyuv3PfZYCe0nY0J4p8yEM8otGX3qd9nAKYjEnnXta6AvSZr5nL99MHQzLtEySYsr/mPFC2SEjSMw=' | ||
|
||
before_install: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding of Travis build lifecycle is that before_install
and before_script
are only useful if you want to rely on the default install
or script
steps that Travis provides for a given environment: https://docs.travis-ci.com/user/customizing-the-build#Customizing-the-Installation-Step.
Since we're overriding install
and script
, simpler to move these steps into those and reduce the number of sections we have. That should also allow you to merge before_install.sh and before_script.sh into a single script, say travis_setup.sh, that gets run in the install phase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, yeah! Will do.
436420b
to
f3d857e
Compare
Looks like you forgot to |
🙀 |
Yeah, this is the error I saw before: https://travis-ci.org/dunn/blocktogether/jobs/157389915#L277 |
I think this is the cause: https://stackoverflow.com/questions/26299552/travis-sudo-is-disabled I'm guessing that when you put
to the config. I think we can do some refactoring to make things work without sudo, but that's work for another change. |
440e045
to
abaae13
Compare
Looks like |
Oh, it's the quotes messing it up. |
Yep - there are two layer of interpolation here, I think. The string gets evaluated once, interpolating Did you conclude that Travis' YAML parser really does need those quotes? |
Yeah, I tried without and it died with the same error message: https://travis-ci.org/dunn/blocktogether/builds/157388926 I got 1/2 passing this time: https://travis-ci.org/dunn/blocktogether/builds/157391226. I went back to having them run simultaneously, but I'm not sure why that would matter. |
Oh right, I forgot! Ok, I'm convinced that the |
Re-ran the failing job and it passed. |
Great. LGTM, will merge later tonight when I have a chance to set up the On Sat, Sep 3, 2016 at 10:28 PM, Alex Dunn notifications@github.com wrote:
|
Per https://docs.travis-ci.com/user/environment-variables/:
The third case is true, so I'm going to set the vars in Repository Settings, then merge this, then remove the env vars lines from .travis.yml. |
Great! |
The secure environment variables need to be refreshed:
BT_TEST_MAIN_USER
BT_TEST_MAIN_PASS
CONSUMER_KEY
CONSUMER_SECRET
I used the
travis
gem:and so on.