richardtallent / vite-plugin-singlefile

Vite plugin for inlining JavaScript and CSS resources
MIT License
808 stars 53 forks source link

Add a basic CI GitHub Actions for testing #64

Closed aloisklink closed 1 year ago

aloisklink commented 1 year ago

This PR adds a basic GitHub Actions CI action for automated tests. This should hopefully make reviewing PRs a lot easier for you, as well as making sure support isn't dropped for older Node.JS versions.

GitHub Actions is currently free for standard GitHub-hosted runners in public repositories. From https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions

Basically, this action will run on every git push (or GitHub Pull Request) and should give you a green tick if all the tests pass, and a red cross if anything fails, e.g.

image

As an example, see my fork of your repo: https://github.com/aloisklink/vite-plugin-singlefile/tree/9cc63ec392d6f2be939c87959f520002c9253baf

You'll probably still want to do manual testing to make sure the result of running npm run build on https://github.com/richardtallent/vite-plugin-singlefile-example actually looks good, as this PR only checks if the command works without errors, it can't tell you if the generated index.html actually works.


As part of this PR, I also changed the prepublishOnly script to prepare, so that it also runs when doing npm ci, see https://docs.npmjs.com/cli/v9/using-npm/scripts#life-cycle-scripts. The prepare script is what most people use to build their packages, because it's: