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:
- Someone opens an issue for a bug with a sandbox reproducible
- Someone opens a fix PR mentioning the issue
- 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:
- Run
git clone
on the repository -
Run
yarn install
ornpm install
, based on the lockfile and configuration options. You can give a custom install command here. -
Run
yarn build
ornpm build
, based on the lockfile and configuration options. You can give a custom build command here. -
Run
yarn pack
to get the files we need to publish - Upload the files to our storage, which you can then use in a sandbox or locally
- 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.