Repository navigation
ci: extract checkout, node setup, and install into setup action - #595
Conversation
This is in preparation for moving to pnpm. This change centralizes common ci setup steps into a single action.
|
|
||
| - name: Install dependencies | ||
| run: npm install | ||
| - uses: $/.github/actions/setup |
There was a problem hiding this comment.
@michaelfaith is the $ required here?
| - uses: $/.github/actions/setup | |
| - uses: ./.github/actions/setup |
I did a search we may need . instead of $ ? but i'm not an expert in reusable actions
There was a problem hiding this comment.
same question for the other actions around calling reusable actions syntax
There was a problem hiding this comment.
This was a recent change to workflows, which allows workflows to reference local actions without having to checkout the repo. That's what allows for us to include the checkout action in the setup action. Otherwise, there would be a chicken and egg situation. When using the old . way of referencing, you have to checkout the repo before you can reference local actions (so you wouldn't be able to include checkout). But using the new $ syntax, you don't have to 😊
There was a problem hiding this comment.
gosh didn't know about this either. thanks!
lwasser
left a comment
There was a problem hiding this comment.
@michaelfaith this is awesome. i never thought about using reusable actions as a setup mechanism. i had just a few questions around
- syntax using
$/vs./ - node version at 24 throughout and then
npm installvsnpm ci
| type: string | ||
| node-version: | ||
| description: Node.js version to use | ||
| default: '22' |
There was a problem hiding this comment.
here we declare node 22 but below we use 24 to build the cli
There was a problem hiding this comment.
| default: '22' | |
| default: '24' |
?
There was a problem hiding this comment.
I'm ok with that. I just didn't want to change our node support in the same change. I was going for as like-to-like behavior with the refactor.
| - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | ||
| - uses: $/.github/actions/setup | ||
| with: | ||
| node-version: '24' |
There was a problem hiding this comment.
here node 24 vs 22 declared above. i'm just curious why not use 24 throughout?
There was a problem hiding this comment.
I was just going for like-for-like behavior, and it just be a reorganization of actions. Then followup with node version bumps separately. But I could do it here too if you want.
There was a problem hiding this comment.
no - no worries if that is your goal. let's merge as is.
| with: | ||
| node-version: ${{ inputs.node-version }} | ||
| - name: Install dependencies | ||
| run: npm install ${{ inputs.install-flags }} |
There was a problem hiding this comment.
| run: npm install ${{ inputs.install-flags }} | |
| run: npm ci ${{ inputs.install-flags }} |
could we use ci rather than install for ci jobs? we'd probably want the dependencies to NOT update in ci because we'd want to ensure we are maintaining them locally and get the same results as ci returns.
There was a problem hiding this comment.
The problem with npm ci is it doesn't reuse node_modules. So it wouldn't take advantage of the cache. Since our ultimate aim is to move to pnpm, I figured it would be ok to go with this temporarily. With pnpm, its default behavior is to force a frozen lockfile in ci. So there'd be no special handling needed 😊
There was a problem hiding this comment.
ok perfect. i suspected you. had a reason for this so appreciate the answers and i didn't realize it wouldn't leverage the cache as well! thanks! pnpm will be a good move!
lwasser
left a comment
There was a problem hiding this comment.
I'm actually ok with your merging after answering questions as I may need to learn a bit more about reusable actions too here!! ✨
|
this needs a rebase - i don't love the update branch button as it creates a merge commit which makes rebasing icky 🙃 so i won't use it! |
|
It looks like there are no conflict. So I'll go ahead and merge, and we can do the node bumps separately. |
closes #647 This migrates us to a reusable action similar to w[hat was done in the cli](all-contributors/cli#595) This will make updates to ci simpler. It also removes the stats.yml run that runs for 3+ hours daily and doesn't share the data anywhere!! i have recreated that worfklow to be more efficient [in the dashboard repo](https://all-contributors.github.io/dashboard/) - [ ] Documentation - [x] Ready to be merged <!-- In your opinion, is this ready to be merged as soon as it's reviewed? --> - [ ] Added myself to contributors table. <!-- this is optional, see the contributing guidelines for instructions -->

This is in preparation for moving to pnpm. This change centralizes common ci setup steps into a single action.