forked from whitphx/stlite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Cache node_modules * Create init-node action with caching * Fix * Fix * Run yarn install in init-all * Use init-node from init-all * Include the NodeJS version to the cache key
- Loading branch information
Showing
4 changed files
with
62 additions
and
27 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
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,38 @@ | ||
name: 'Node Initialization Action' | ||
description: 'Node initialization steps for CI jobs' | ||
inputs: | ||
node-version-file: | ||
description: 'Node version file to setup' | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
## Set up Node environment | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: ${{ inputs.node-version-file }} | ||
cache: 'yarn' | ||
|
||
- name: Get Node.js version | ||
id: node-version | ||
run: echo "NODE_VERSION=$(node -v)" >> $GITHUB_ENV | ||
shell: bash | ||
# Include the NodeJS version in the cache key. | ||
# While there are several reasons not to recommend caching `node_modules` (https://github.com/actions/setup-node/issues/304#issuecomment-886241508), | ||
# NodeJS version incompatibility is one of them (https://github.com/actions/setup-node/issues/304#issuecomment-886240594). | ||
# So invalidating the cache based on the NodeJS version is not perfect but | ||
# it makes things safer. | ||
# See also https://github.com/actions/setup-node/issues/406 and https://dev.to/flydiverny/comment/1lk25. | ||
|
||
- uses: actions/cache@v4 | ||
with: | ||
path: '**/node_modules' | ||
key: node_modules-${{ env.NODE_VERSION }}-${{ hashFiles('yarn.lock') }} | ||
|
||
# `yarn install` often takes so long time on in the Windows env. | ||
# https://github.com/yarnpkg/yarn/issues/8242 | ||
- run: yarn config set network-timeout 600000 | ||
shell: bash | ||
|
||
- run: yarn install --frozen-lockfile | ||
shell: bash |
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