According to the [jest docs], setting `maxWorkers=4` can substantially improve performance on CI. This commit sets `maxWorkers=4` when running `yarn unit` as a part of `yarn test`. Based on my local testing (see data below), this improves performance locally in addition to the expected performance improvement on travis. \## Testing `yarn unit` by itself ``` yarn unit --maxWorkers=1 15.28s user 3.71s system 112% cpu 16.848 total 15.13s user 3.68s system 112% cpu 16.708 total 15.32s user 3.76s system 112% cpu 16.917 total 15.91s user 3.74s system 112% cpu 17.425 total 15.61s user 3.76s system 113% cpu 17.125 total yarn unit --maxWorkers=2 19.43s user 4.03s system 212% cpu 11.061 total 19.86s user 4.19s system 210% cpu 11.407 total 21.19s user 4.26s system 213% cpu 11.902 total 20.68s user 4.51s system 212% cpu 11.873 total 20.78s user 4.26s system 212% cpu 11.780 total yarn unit --maxWorkers=4 29.43s user 5.14s system 389% cpu 8.865 total 29.99s user 5.18s system 392% cpu 8.961 total 32.22s user 5.52s system 390% cpu 9.659 total 33.99s user 5.97s system 395% cpu 10.097 total 33.38s user 5.93s system 395% cpu 9.933 total yarn unit --maxWorkers=8 48.21s user 6.57s system 621% cpu 8.815 total 51.61s user 7.16s system 610% cpu 9.622 total 59.48s user 7.82s system 621% cpu 10.833 total 58.18s user 8.10s system 624% cpu 10.607 total 58.92s user 8.22s system 620% cpu 10.817 total unset 46.27s user 6.44s system 599% cpu 8.799 total 49.08s user 7.04s system 600% cpu 9.342 total 54.85s user 7.52s system 600% cpu 10.383 total 55.66s user 7.52s system 605% cpu 10.438 total 53.77s user 7.50s system 604% cpu 10.142 total ``` \## Testing `yarn test` ``` maxWorkers=1 46.65s user 5.92s system 249% cpu 21.038 total 47.94s user 5.81s system 251% cpu 21.354 total 51.50s user 6.44s system 260% cpu 22.234 total 52.60s user 6.65s system 268% cpu 22.077 total 53.04s user 6.27s system 266% cpu 22.278 total maxWorkers=2 56.13s user 6.13s system 409% cpu 15.204 total 63.32s user 7.22s system 412% cpu 17.091 total 64.82s user 7.19s system 422% cpu 17.027 total 64.59s user 7.41s system 417% cpu 17.227 total 65.40s user 7.30s system 419% cpu 17.318 total maxWorkers=4 74.64s user 7.60s system 584% cpu 14.066 total 82.69s user 8.43s system 582% cpu 15.643 total 85.00s user 8.68s system 591% cpu 15.835 total 84.81s user 8.58s system 595% cpu 15.690 total 85.22s user 8.59s system 596% cpu 15.719 total maxWorkers=4 and everything depends on unit 59.29s user 6.01s system 378% cpu 17.261 total 62.99s user 6.64s system 375% cpu 18.564 total 65.54s user 7.31s system 375% cpu 19.419 total 63.24s user 7.13s system 379% cpu 18.548 total 63.68s user 7.13s system 383% cpu 18.457 total maxWorkers=8 92.85s user 8.13s system 643% cpu 15.702 total 101.63s user 9.21s system 632% cpu 17.510 total 101.63s user 9.23s system 636% cpu 17.428 total 101.81s user 9.32s system 633% cpu 17.546 total 101.62s user 9.39s system 632% cpu 17.542 total unset 88.75s user 8.15s system 646% cpu 14.988 total 96.43s user 9.23s system 631% cpu 16.739 total 98.27s user 9.17s system 638% cpu 16.819 total 98.46s user 9.01s system 642% cpu 16.729 total 98.53s user 9.15s system 637% cpu 16.889 total unset + everything depends on unit 76.02s user 7.61s system 486% cpu 17.208 total 79.14s user 8.26s system 484% cpu 18.030 total 84.32s user 9.19s system 488% cpu 19.136 total 84.92s user 9.14s system 497% cpu 18.919 total 84.46s user 8.94s system 492% cpu 18.965 total ``` Test plan: `yarn test` passes here and on travis [jest docs]: https://jestjs.io/docs/en/troubleshooting
SourceCred
SourceCred creates reputation networks for open-source projects. Any open-source project can create its own cred, which is a reputational metric showing how much credit contributors deserve for helping the project. To compute cred, we organize a project’s contributions into a graph, whose edges connect contributions to each other and to contributors. We then run PageRank on that graph.
To learn more about SourceCred’s vision and values, please check out our website and our forum. One good forum post to start with is A Gentle Introduction to Cred.
For an example of SourceCred in action, you can see SourceCred’s own prototype cred attribution.
Current Status
We have a prototype that can generate a cred attribution based on GitHub interactions (issues, pull requests, comments, references, etc.). We’re working on adding more information to the prototype, such as tracking modifications to individual files, source-code analysis, GitHub reactions, and more.
Running the Prototype
If you’d like to try it out, you can run a local copy of SourceCred as follows. First, make sure that you have the following dependencies:
- Install Node (tested on v8.x.x).
- Install Yarn (tested on v1.7.0).
- Create a GitHub API token. No special permissions are required.
- For macOS users: Ensure that your environment provides GNU coreutils. See this comment for details about what, how, and why.
Then, run the following commands to clone and build SourceCred:
git clone https://github.com/sourcecred/sourcecred.git
cd sourcecred
yarn install
yarn backend
export SOURCECRED_GITHUB_TOKEN=YOUR_GITHUB_TOKEN
node bin/sourcecred.js load REPO_OWNER/REPO_NAME
# this loads sourcecred data for a particular repository
yarn start
# then navigate to localhost:8080 in your browser
For example, if you wanted to look at cred for ipfs/js-ipfs, you could run:
$ export SOURCECRED_GITHUB_TOKEN=0000000000000000000000000000000000000000
$ node bin/sourcecred.js load ipfs/js-ipfs
replacing the big string of zeros with your actual token.
You can also combine data from multiple repositories into a single graph.
To do so, pass multiple repositories to the load
command, and specify an “output name” for the repository.
For instance, the invocation
node bin/sourcecred.js load ipfs/js-ipfs ipfs/go-ipfs --output ipfs/meta-ipfs
will create a graph called ipfs/meta-ipfs
in the cred explorer, containing the combined contents of the js-ipfs and go-ipfs repositories.
Early Adopters
We’re looking for projects who want to be early adopters of SourceCred! If you’re a maintainer of an open-source project and would like to start using SourceCred, please reach out to us on our Discord or our forum.
Contributing
We’d love to accept your contributions! You can reach out to us by posting on our forum, or chatting with us on Discord. We'd be happy to help you get started and show you around the codebase. Please also take a look at our contributing guide.
If you’re looking for a place to start, we’ve tagged some issues Contributions Welcome.
Acknowledgements
We’d like to thank Protocol Labs for funding and support of SourceCred. We’d also like to thank the many open-source communities that produced the software that SourceCred is built on top of, such as Git and Node.