-
Notifications
You must be signed in to change notification settings - Fork 433
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
Add yarn support #895
Add yarn support #895
Conversation
Awesome, thank you @BanzaiMan! 😄 |
@@ -169,6 +194,12 @@ def setup_npm_cache | |||
def iojs_3_plus? | |||
(config[:node_js] || '').to_s.split('.')[0].to_i >= 3 | |||
end | |||
|
|||
def install_yarn | |||
sh.cmd "curl -o- -L https://yarnpkg.com/install.sh | bash", echo: true |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
I should add that the cache directive will cache |
To correspond with travis-ci/travis-build#895
Documentation PR is travis-ci/docs-travis-ci-com#811. |
The problem by using Use case : a node framework that want to test his installation with npm and yarn will not be able to do it, with Trails framework we want to test installations and generators with both. A Anyway, thanks for your great job !! :D |
@jaumard Could you elaborate on what you are asking? If there is no |
Even when `yarn.lock` is present, if Node.js requirement is not met, we fall back to the default `npm install` command.
To correspond with travis-ci/travis-build#895
@BanzaiMan of course we can always override install phase but I think it will be better/easier/natural to just have a field to choose witch package manager we want like we choose the node versions or os.
Yes and no if all library/frameworks/generators modules want to test yarn and npm install it will be a lot of cases ^^ |
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.
This looks fantastic, big 👍 from me!
We will consider We will deploy this Monday next week. |
By the way, you can see the test here: https://staging.travis-ci.org/BanzaiMan/example-yarn-package/builds/525479 |
I just had a build complete (node 6.9.1, yarn.lock file present) and I noticed that it still used As I'm typing this, I'm noticing that this was just merged in three hours ago... Can I assume this is still being rolled out, and my builds will eventually use yarn, as it becomes available? |
see above |
Missed that; thanks. |
@@ -41,7 +41,20 @@ def announce | |||
|
|||
def install | |||
sh.if '-f package.json' do | |||
sh.cmd "npm install #{config[:npm_args]}", retry: true, fold: 'install' | |||
sh.if "-f yarn.lock" do | |||
if version.to_i < 4 |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Is deploy still planned for today? |
@jdevalk that is the plan :) Hiro lives on the East Coast, so will be online soon to start the roll out. |
Awesome, I hope @BanzaiMan will update us when it's live :D my builds are waiting ;) |
Agree, let's merge current patch and then will improve it in other PRs. I soooo waiting |
* build: cleanup travis ci setup * travis-ci/travis-build#895 * Fix that Travis doesn't show if the tests failed * Cleanup browser providers * Update karma version * Properly report exit code to gulp * Return error * That's it
if data.cache?(:yarn) | ||
sh.fold 'cache.yarn' do | ||
sh.echo '' | ||
directory_cache.add '$HOME/.yarn-cache' |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This PR adds yarn support to Travis CI.
See travis-ci/travis-ci#6720
How Yarn support works
Yarn usage detection
If both
packag.json
andyarn.lock
file exist in the repository root, we activate yarn support.If
yarn.lock
exists but the defined Node.js version does not meet the minimum requirement for Yarn (versions less than 4), we fall back to the defaultnpm install
.Making the
yarn
command availableDuring the default
install
phase, if theyarn
command is not available, it is installed with the following command, as described in https://yarnpkg.com/en/docs/install#alternatives-tab:This is much faster on OS X/macOS than the documented
brew update && brew install yarn
, and as fast as (or slightly faster than) installing it viaapt-get install
on Ubuntu.If repositories are already installing
yarn
in some way during thebefore_install
or the overriddeninstall
, the installation will not take place (becauseyarn
is available in the former case, and our installation steps will not take place in the latter case).Caching
This PR also defines a new cache directive:
or, equivalently, with other cache directives: