-
Notifications
You must be signed in to change notification settings - Fork 980
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): refactor out set up steps (#10249)
Want to keep working on CI every now and then. Starting by cleaning up some things so it's easier to reason about. Most jobs run the following steps: - enable corepack (this should go away one day when the setup node action supports it) - set up node - enable corepack again (for windows) - set up yarn cache - yarn install - build Refactoring these out into a composite action so that we can save some lines in ci.yml which is starting to get quite long. I can also document some things better this way.
- Loading branch information
Showing
7 changed files
with
107 additions
and
311 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Set up job | ||
description: > | ||
Everything you need to run a job in CI. | ||
Checkout this repo (redwoodjs/redwood), set up Node.js, yarn install, and build. | ||
inputs: | ||
set-up-yarn-cache: | ||
description: > | ||
For some actions, setting up the yarn cache takes longer than it would to just yarn install. | ||
required: false | ||
default: true | ||
|
||
yarn-install-directory: | ||
description: > | ||
The directory to run `yarn install` in. | ||
required: false | ||
|
||
build: | ||
description: > | ||
Whether or not to run `yarn build` to build all the framework packages. | ||
required: false | ||
default: true | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
- name: ⬢ Enable Corepack | ||
shell: bash | ||
run: corepack enable | ||
|
||
- name: ⬢ Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
|
||
# We have to enable Corepack again for Windows. 🤷 | ||
# In general, we're waiting on [this issue](https://github.com/actions/setup-node/issues/531) | ||
# to be resolved so that `actions/setup-node@v4` has first-class Corepack support. | ||
- name: ⬢ Enable Corepack | ||
if: runner.os == 'Windows' | ||
shell: bash | ||
run: corepack enable | ||
|
||
- name: 🐈 Set up yarn cache | ||
if: inputs.set-up-yarn-cache == 'true' | ||
uses: ./.github/actions/set-up-yarn-cache | ||
|
||
# One of our dependencies is on GitHub instead of NPM and without authentication | ||
# we'll get rate limited and this step becomes flaky. | ||
- name: 🐈 Yarn install | ||
shell: bash | ||
working-directory: ${{ inputs.yarn-install-directory }} | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
run: yarn install --inline-builds | ||
|
||
- name: 🏗️ Build | ||
if: inputs.build == 'true' | ||
shell: bash | ||
run: yarn build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.