MadLittleMods / node-usb-detection

List USB devices in system and detect changes on them.
MIT License
371 stars 114 forks source link

ci: move CI to GitHub actions and get prebuilds working again #152

Closed mcous closed 2 years ago

mcous commented 2 years ago

Overview

(Diff ignoring lockfile: 141 insertions(+), 203 deletions(-))

As noted in #134, #140, #151, the existing CI setup has started to have issues, resulting in prebuilds not being correctly published to GitHub Releases.

From what I can tell, the problem may be that CI setup is configured somewhat redundantly. The prebuild utility is able to generate prebuilds for all available ABI versions while running on a single version of Node. However, CI is configured to run a matrix of different Node.js versions, too many of which are configured to run prebuild --all. Prebuilds only need to be generated once per OS/arch combination, and the compilation works most smoothly on later versions of Node.

Additionally, there's a few other snags and updates since these problems started appearing:

Rather than try to work around Travis' .org shutdown and figure out the .com migration, I decided to see what this CI would look like on GitHub Actions. Over at Opentrons/opentrons, where we use usb-detection, we switched from a Travis/AppVeyor combo to GH Actions, and it's gone pretty well. If the switch to GH Actions isn't too presumptuous, I think this is a good change!

Relevant outputs from my fork running this CI:

Heavy caveat: I don't write native Node.js modules. This is not my area of expertise, though I'm pretty handy with a CI config. I haven't actually tested any these prebuilds; the only thing I know about these builds right now is that they are compiling without errors.

Open questions / TODO

Change log

How does this CI pipeline work?

The CI pipeline starts by kicking off several jobs in parallel:

If all those jobs complete and the CI run was triggered by a tag, then a publish job will run, which will:

  1. Download all prebuilt artifacts
  2. Upload those artifacts to the GH release for the built version
  3. (TODO) Publish the release to npm
mcous commented 2 years ago

@MadLittleMods gentle ping on this one again. Is GitHub Actions a path you'd be willing to take on this repository?

MadLittleMods commented 2 years ago

Woot woot! https://github.com/MadLittleMods/node-usb-detection/releases/tag/v4.13.0 with a multitude of prebuilds and available on npm https://www.npmjs.com/package/usb-detection/v/4.13.0 🚀

Thanks again @mcous 🥰