In my application.rb, I have
config.time_zone = "Pacific Time (US & Canada)"
And this works correctly in development/test, and production servers. However when I push to Travis-CI, it appears to be localized to UTC for example the output of I18n.l Time.now
.
Is there something different about the Travis-CI ruby/rails environment?
Configuration. Travis CI is configured by adding a file named . travis. yml , which is a YAML format text file, to the root directory of the repository.
JVM (Clojure, Groovy, Java, Scala) VM images #
This worked for me:
before_install:
- export TZ=Australia/Canberra
to check that is correct you can output the date with this:
- date
The way I accomplish setting the timezone is in the before_script section of the travis.yml
They give you root access to the VM running your project, so you can simply set the OS timezone that ruby uses:
before_script:
- echo 'Canada/Pacific' | sudo tee /etc/timezone
- sudo dpkg-reconfigure --frontend noninteractive tzdata
If you wish, you can also force an update by adding this below:
- sudo ntpdate ntp.ubuntu.com
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With