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

Possible to avoid rebuilding within happo and have it point to an already built bundle? #86

Open
JonahMoses opened this issue Jul 16, 2019 · 2 comments

Comments

@JonahMoses
Copy link

We're running happo in our CI for our PR builds and that process goes:

  1. Build
  2. Test
  3. Screenshot Tests (Happo)

Part of step 3 is having happo rebuild our bundles, I'm curious if some one can point me in the direction of enabling happo to use the output from step 1. I saw that there is a tmpdir option (https://github.com/happo/happo.io#tmpdir) but haven't been successful with it yet. This is what my current .happo.js looks like (prior to my failed attemps with tmpdir):

module.exports = {
  apiKey: process.env.HAPPO_API_KEY,
  apiSecret: process.env.HAPPO_API_SECRET,
  plugins: [
    happoPluginStorybook({
      configDir: 'docs/.storybook',
      outputDir: '.happo-out',
    }),
  ],
  targets: {
    chrome: new RemoteBrowserTarget('chrome', {
      viewport: '1280x1024',
    }),
  },
  type: 'react',
};
@trotzig
Copy link
Contributor

trotzig commented Jul 16, 2019

Hi @JonahMoses 👋

The tmpdir option isn't used (IIRC) when using the storybook plugin. This isn't supported right now, but it wouldn't take much to add an option to the happo-plugin-storybook code to allow reusing the build. Right around here is where the static package is created. We could add a useExistingBuild option to the plugin and skip the whole build phase if it's true.

The only tricky part here is that happo will occasionally run twice -- once for the base commit (the commit that the PR is based on) and once for the tip of the PR. The build in step 1 can't be used for the base commit, so we'll have to figure out how to only conditionally apply the useExistingBuild flag. It might involve setting an environment variable or something right around here to signal that we're generating the "previous" report.

@JonahMoses
Copy link
Author

JonahMoses commented Jul 16, 2019

@trotzig this would be incredible, as it would certainly cut down on some build time for us! Thank you for pointing this out.

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

No branches or pull requests

2 participants