-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
20 additions
and
7 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 |
---|---|---|
|
@@ -3,33 +3,46 @@ description: "Run yarn install with node_modules linker and cache enabled" | |
runs: | ||
using: "composite" | ||
steps: | ||
- name: Set up swap space | ||
if: runner.os == 'Linux' | ||
uses: pierotofy/[email protected] | ||
with: | ||
swap-size-gb: 10 | ||
|
||
- name: Expose yarn config as "$GITHUB_OUTPUT" | ||
id: yarn-config | ||
shell: bash | ||
env: | ||
YARN_ENABLE_GLOBAL_CACHE: "false" | ||
run: | | ||
echo "CACHE_FOLDER=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | ||
echo "CURRENT_NODE_VERSION="node-$(node --version)"" >> $GITHUB_OUTPUT | ||
echo "CURRENT_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's,/,-,g')" >> $GITHUB_OUTPUT | ||
echo "NPM_GLOBAL_CACHE_FOLDER=$(npm config get cache)" >> $GITHUB_OUTPUT | ||
- name: Restore yarn cache | ||
uses: actions/cache@v3 | ||
id: yarn-download-cache | ||
with: | ||
path: ${{ steps.yarn-config.outputs.CACHE_FOLDER }} | ||
key: yarn-download-cache-${{ hashFiles('yarn.lock') }} | ||
key: yarn-download-cache-default-${{ hashFiles(yarn.lock, .yarnrc.yml) }} | ||
restore-keys: | | ||
yarn-download-cache- | ||
yarn-download-cache-default- | ||
- name: Restore yarn install state | ||
id: yarn-install-state-cache | ||
- name: Restore global npm cache folder | ||
id: npm-global-cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: .yarn/ci-cache/ | ||
key: ${{ runner.os }}-yarn-install-state-cache-${{ hashFiles('yarn.lock', '.yarnrc.yml') }} | ||
path: ${{ steps.yarn-config.outputs.NPM_GLOBAL_CACHE_FOLDER }} | ||
key: npm-global-cache-default-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ hashFiles(yarn.lock, .yarnrc.yml) }} | ||
|
||
- name: Install dependencies | ||
shell: bash | ||
run: | | ||
yarn install --immutable --inline-builds | ||
env: | ||
YARN_ENABLE_GLOBAL_CACHE: "false" | ||
YARN_ENABLE_MIRROR: "false" | ||
YARN_NM_MODE: "hardlinks-local" | ||
YARN_INSTALL_STATE_PATH: .yarn/ci-cache/install-state.gz | ||
YARN_INSTALL_STATE_PATH: ".yarn/ci-cache/install-state.gz" | ||
HUSKY: "0" |