What is CodeSandbox CI?

CodeSandbox CI is a GitHub App that you can install in your repository. The app is responsible for building your library: whenever a Pull Request is opened we will make sure to build a version of the library from that PR. We will publish this version of the library to our registry, so you can immediately test the library in CodeSandbox or locally.

Why do I want this?

The goal of this app is to make it easier for you to test your library without publishing to npm yet. Since CodeSandbox is already used for bug reports we wanted to make it possible to also test the PR version of your library with the existing bug reports.

In an ideal flow, it would work like this:

  1. Someone opens an issue for a bug with a sandbox reproducible
  2. Someone opens a fix PR mentioning the issue
  3. We build the library from the PR, fork the sandbox repro and install the new library in that sandbox

This way you will only have to open the generated sandbox to confirm that the fix works. No need to clone, install or test locally.

How do I set this up?

For most libraries, the only thing you need to do is install this GitHub App. In some cases you might need to do some configuration, an example of this is for monorepos. You can configure your library by creating a file called ci.json in a folder called .codesandbox (.codesandbox/ci.json) in the root of your repo, more info on that in the documentation. An example PR can be found here.

What do you do on the server?

We run a couple of steps:

  1. Run git clone on the repository
  2. Run yarn install or npm install, based on the lockfile and configuration options. You can give a custom install command here.
  3. Run yarn build or npm build, based on the lockfile and configuration options. You can give a custom build command here.
  4. Run yarn pack to get the files we need to publish
  5. Upload the files to our storage, which you can then use in a sandbox or locally
  6. Generate new sandboxes with the new dependencies. We take the sandboxes mentioned in the config, in the pr body or in the issue mentioned by the pr, and fork them.

Does this support monorepos?

Yes! You do need some custom configuration, an example can be found here.

Is this public?

Yes! You can install the app from here: CodeSandbox GitHub App.

That's it!

We hope you're enthusiastic about this functionality. We've tried to build this with the library maintainer workflow in mind. We think that this will make it much easier for maintainers to review PRs and test their library.

If you have any feedback, please contact us at [email protected] or send us a direct message. We'd appreciate it!