Skip to content
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

SWITCH to circleci over travisCI && CHANGE lerna bootstrap procedure: #1486

Merged
merged 6 commits into from
Jul 19, 2017

Conversation

ndelangen
Copy link
Member

Issue:

  • TravisCI is taking a long time to build
  • Fixes: Parallelise Travis build #1127
  • Bootstrapping takes a long time
  • A lot of modules are duplicated during bootstrap
    Because of this modules are not singletons during development.
    This leads to a list of problems, like duplicate react, no channel in lib/addons..
  • Storyshots testing is disabled in cra-kitchen-sink

What I did

  • Configure CircleCI (in parallel)
  • Remove TravisCI
  • Use yarn for installation of packages
  • Hoist all dependencies to root using --hoist
  • Hoist known packages to root using a custom script
  • Test storyshots in cra-kitchen-sink

How to test

  • This branch should be build with CircleCI
  • Doing a clean install and bootstrap on this branch should be successful
  • After bootstrap unit tests should pass
  • After bootstrap starting example/cra-kitchen-sink should be successful
  • You should feel a feeling of relief and inner happiness knowing how much faster the CI is.

- Use yarn for installation
- Hoist all dependencies to root
- Hoist known packages to root

- Test storyshots in cra-kitchen-sink
@ndelangen ndelangen added maintenance User-facing maintenance tasks needs review labels Jul 19, 2017
@ndelangen ndelangen self-assigned this Jul 19, 2017
Copy link
Member

@tmeasday tmeasday left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we separate these? The circle script seems awesome, but it seems an orthogonal concern to "true hoisting"+testing cra-kitchen-sink

@@ -20,3 +20,5 @@ function loadStories() {
}

configure(loadStories, module);

export { getStorybook };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's going on with this change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getStorybook returns a hash-table of stories.

If the config would export this, we can make storyshots framework agnostic 🎉

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems great, although can you explain a bit more why? Should this be part of this PR? It sounds like a seperate thing

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does exporting getStorybook help exactly? i'm already familiar with the function.

@codecov
Copy link

codecov bot commented Jul 19, 2017

Codecov Report

Merging #1486 into master will increase coverage by <.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1486      +/-   ##
==========================================
+ Coverage   14.54%   14.54%   +<.01%     
==========================================
  Files         202      202              
  Lines        4649     4647       -2     
  Branches      502      497       -5     
==========================================
  Hits          676      676              
  Misses       3549     3549              
+ Partials      424      422       -2
Impacted Files Coverage Δ
lib/addons/src/index.js 0% <0%> (ø) ⬆️
addons/storyshots/src/index.js 0% <0%> (ø) ⬆️
app/react/src/server/babel_config.js 44.82% <0%> (ø) ⬆️
...codemod/src/transforms/update-organisation-name.js 40.62% <0%> (ø) ⬆️
addons/info/src/components/PropVal.js 0% <0%> (ø) ⬆️
lib/ui/src/modules/ui/routes.js 0% <0%> (ø) ⬆️
addons/knobs/src/components/types/Number.js 8.06% <0%> (ø) ⬆️
...src/server/config/WatchMissingNodeModulesPlugin.js 0% <0%> (ø) ⬆️
addons/info/src/components/markdown/htags.js 0% <0%> (ø) ⬆️
addons/knobs/src/components/PropForm.js 8.51% <0%> (ø) ⬆️
... and 19 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 860e952...3be8c8d. Read the comment docs.

@ndelangen
Copy link
Member Author

No we cannot split this, TravisCI fails and I just don't see a good reason to spend time on fixing it.
https://travis-ci.org/storybooks/storybook/builds/255133024

What's your reason for splitting? is it too big to review? Is there any other way to get this approved? I'm interested in doing a demo video anyway, would that help?

@tmeasday
Copy link
Member

Could you not first do the circle changes and then a second pr targeting the first with the cra-ks changes.

Yes, I'll admit I have a lot of trouble properly reviewing these big PRs. There are some important subtleties around this symlinking stuff that it is hard enough to keep straight in my head without also needing to figure out if any given change is relevant to the fix.

Small PRs=non-linearly better imo

filename: configPath,
dirname: configDirPath,
};
// const babelConfig = loadBabelConfig(configDirPath);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

???

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well correct me if I'm wrong: jest can do babel transpilation, why are we doing it?
I don't understand why we're using require.requireActual either

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we're not using it, why comment it out? why not just delete it?

@@ -19,4 +19,5 @@ setTimeout(
);

AppRegistry.registerComponent('ReactNativeVanilla', () => StorybookUI);
export default StorybookUI;

export { StorybookUI as default, getStorybook };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question here

package.json Outdated
"bootstrap:docs": "cd docs && yarn install",
"bootstrap:react-native-vanilla": "lerna exec --scope react-native-vanilla -- yarn install",
"bootstrap:test-cra": "npm run build-packs && lerna exec --scope test-cra -- yarn install",
"build": "npm run bootstrap:docs && npm run docs:build",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this? bootstrap:docs alone should be fine?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I'm calling this script anywhere, will remove.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think you can get rid of docs:build too

package.json Outdated
@@ -25,15 +27,14 @@
"lint:js": "eslint . --cache --cache-location=.cache/eslint --ext .js,.jsx,.json",
"lint:md": "remark .",
"publish": "lerna publish",
"start": "serve ./docs/out --single",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add serve as dev dependency? i think you are mixing in some of your docsv2 stuff in here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will remove

.then(() => {
shell.echo(chalk.green('COMPLETE'), chalk.gray('=> Hoisting internal packages'));
})
.catch(() => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

print error

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commented but did not test yet

@shilman shilman merged commit 251c563 into master Jul 19, 2017
@shilman shilman deleted the hoisting-and-circleci branch July 19, 2017 21:53
@ndelangen
Copy link
Member Author

🎉

@@ -2,7 +2,7 @@ export class AddonStore {
constructor() {
this.loaders = {};
this.panels = {};
this.channel = null;
this.channel = { on() {}, emit() {} };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I think this change is going to just make it harder to debug problems with multiple loading. Why did you add it @ndelangen ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great point. Let's take this out unless it's necessary!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was giving us so much grief, I thought we could do without?

To the best of my abilities, everything actually works, there's no multiple loading going on.

It should never occur to not have set the channel.

Having said that, I think it's just really wrong to have a setup where side effects have such a major impact on whether a test can be run.

The channels is completely unneeded to run the snapshots for example, yet they have caused a lot of pain for a lot of users.

I just want people to be able to use and develop this. I think this code facilitates that better then without.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ndelangen completely disagree. if this doesn't get overwritten it will cause an error to fail silently! having been bit by this bug before, it will be even harder to debug when there is a problem!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to agree with @shilman here, it's better that our or even a user's tests fail than they can't actually run storybook or an addon in the first place and can't figure out why (it's hard enough with the channel undefined error in the first place).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to have a way to "ignore" the error, maybe that's a feature worth adding, if it's sometimes impossible to avoid the multi-loading problem. Something like initStoryshots({ nullChannel: true})?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance User-facing maintenance tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants