Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MVP: reusable workflow #1

Closed
dominykas opened this issue Oct 8, 2021 · 4 comments · Fixed by #2
Closed

MVP: reusable workflow #1

dominykas opened this issue Oct 8, 2021 · 4 comments · Fixed by #2

Comments

@dominykas
Copy link
Member

dominykas commented Oct 8, 2021

I initially asked to create this repo so that we can try out the composite actions, but Github finally came out with reusable workflows 🎉 a few days ago, so I figure the MVP here is actually a reusable workflow.

Here's the things I think it should support for the very first draft:

  • generate a matrix based on an upgrade-policy
    • policy keywords same as ci-config-travis: all, lts (default), lts-strict
    • detect the minimum version based on engines.node in package.json; fail if undefined/invalid
  • actions/checkout
  • actions/setup-node
  • run npm install
  • run npm test
    • pass an environment variable to npm test when testing in latest version so that folks can skip linting for non-latest versions

Usage example:

jobs:
  test:
    uses: pkgjs/action/.github/workflows/test.yml@main
    with:
        upgrade-policy: lts # optional

I should be able to PR today (or before Monday anyways).


I'm sure there will be other features we'll want to support (e.g. passing through caching params to setup-node, customizing npm version, etc - basically anything), but I'd like to get the very basics out asap, so that we still have time to iterate on it a little bit before Node.js 16 turns LTS / Node.js 17 comes out and people start updating their workflows manually.

@mcollina
Copy link

mcollina commented Oct 8, 2021

This would be amazing.

@dominykas dominykas mentioned this issue Oct 8, 2021
Merged
@ljharb
Copy link
Member

ljharb commented Oct 8, 2021

I would be very interested to see how this works; writing new GitHub actions is very difficult and an example would be helpful :-)

@dominykas
Copy link
Member Author

dominykas commented Oct 8, 2021

This is how you use it: https://github.com/pkgjs/action/blob/66bf678e530a693e59a340342165238d8049e67e/.github/workflows/ci.yaml (once #2 gets merged)

Gives you a matrix with lts versions, where oldest is the one from your engines.

@ljharb
Copy link
Member

ljharb commented Oct 8, 2021

hm, ok - so basically you make one job in the consumer, and it can delegate the entire thing, including using a matrix, to the upstream? i'll give that a shot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants