ipld / js-block

IPLD Block Interface
6 stars 3 forks source link

test: migrate from aegir to polendina #6

Closed mikeal closed 4 years ago

mikeal commented 4 years ago

This PR moves from aegir to smaller tools that accomplish everything we do with aegir. Namely, this directly uses standard, mocha and polendina (for browser testing). This drastically reduces npm install time and the tests run much faster as well.

mikeal commented 4 years ago

Aegir is not only about testing, but also about code linting and doing releases. You only need to upgrade Aegir and not all dependencies separately, that lowers the maintenance burden. Also not using it would split the ipfs-related ecosystem.

We don’t actually use anything unique to aegir.

A few final notes:

I would rather suggest that polendina gets integrated into Aegir.

That may happen, but it wouldn’t change how I would want to adopt it here. If all I’m getting out of aegir is the browser testing I don’t see any reason to include everything else it does. Aegir may have very good reasons for not adopting polendina that simply aren’t a concern for this module.

js-ipfs is a very large project with some very unique problems and those are driving the needs of aegir, as they should be. For aegir to be a great tool for js-ipfs it will become increasingly problematic for small modules like js-block and that’s an expected tradeoff we shouldn’t worry too much about. One of the benefits of small modules is that you don’t have to make big project problems everyone’s problem.

mikeal commented 4 years ago

GitHub Action Performance Comparison:

Note: since we are able to use the standard action image instead of the puppeteer docker image we skip a large phase in the beginning.

IMG_0303

IMG_0304

rvagg commented 4 years ago

I agree with all of that ^.

The size and dependency bloat problem for me is the major one though. Something that has a few plain dependencies shouldn't take an age to install its devDependencies. Simple should be simple. This repo, after npm install takes up 500Mb of space, spread across many dependencies, not just one large one. This is a simple project, and that size is unreasonable. I have a large dev directory with many active projects and I can't afford all of them being that size. polendina, if you bypass the chrome install and do a global (info in the readme on that) takes up 32Mb. standard is a little extra. I can manage that. Still more than I'd like but it's mainly Webpack's fault.

When I encounter a project with a hugely complex dependency graph I won't contribute to it unless I'm absolutely desperate. The install time, disk space and additional mental overhead suggested by a large dependency tree is rarely worth it. I also use dependency count as a code quality indicator. If you're pulling in lodash to do something you could do with Array#reduce then it's probably code I don't want to trust too far. An npm install that keeps going for pages and pages sets off red flags like this for me. I know I'm not alone in using such heuristics in this massive ecosystem.

mikeal commented 4 years ago

Bonus!

Now that we are just using the default github actions container I don’t need to worry about the puppeteer image changing and altering the cache key so... I was able to add node_module caching and skip the entire build phase when you don’t change the modules in package.json!!!

This branch now brings down the CI time from 5-9 minutes (depending on container caching) to less than 2 minutes w/ an extra minute added if you alter package.json.

mikeal commented 4 years ago

Aegir e.g. also does pre-push hooks, commit lints, changelogs, updating the contributors (and probably more).

These are great features for js-ipfs but we aren’t using any of these features either.