ci: properly cache yarn deps

This commit is contained in:
iCrawl 2022-10-20 02:52:59 +02:00
parent 7083df7cef
commit c0e3629f64
No known key found for this signature in database
GPG key ID: 1AB888B16355FBB2
5 changed files with 40 additions and 10 deletions

View file

@ -38,10 +38,9 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: Install dependencies
run: yarn --immutable
uses: ./packages/actions/src/yarnCache
- name: Build dependencies
run: yarn build
@ -81,10 +80,9 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: Install dependencies
run: yarn --immutable
uses: ./packages/actions/src/yarnCache
- name: Build actions
run: yarn workspace @discordjs/actions build

View file

@ -16,10 +16,9 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: Install dependencies
run: yarn --immutable
uses: ./packages/actions/src/yarnCache
- name: Deprecate versions
run: 'yarn npm-deprecate --name "*dev*" --package @discordjs/brokers @discordjs/builders @discordjs/collection discord.js @discordjs/proxy @discordjs/rest @discordjs/util @discordjs/voice @discordjs/ws'

View file

@ -42,10 +42,9 @@ jobs:
with:
node-version: 16
registry-url: https://registry.npmjs.org/
cache: 'yarn'
- name: Install dependencies
run: yarn --immutable
uses: ./packages/actions/src/yarnCache
- name: Build dependencies
run: yarn build

View file

@ -20,10 +20,9 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: Install dependencies
run: yarn install --immutable
uses: ./packages/actions/src/yarnCache
- name: Build dependencies
run: yarn build

View file

@ -0,0 +1,35 @@
name: 'yarn install'
description: 'Run yarn install with node_modules linker and cache enabled'
runs:
using: 'composite'
steps:
- name: Expose yarn config as "$GITHUB_OUTPUT"
id: yarn-config
shell: bash
run: |
echo "CACHE_FOLDER=$(yarn config get cacheFolder)" >> $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') }}
restore-keys: |
yarn-download-cache-
- name: Restore yarn install state
id: yarn-install-state-cache
uses: actions/cache@v3
with:
path: .yarn/ci-cache/
key: ${{ runner.os }}-yarn-install-state-cache-${{ hashFiles('yarn.lock', '.yarnrc.yml') }}
- name: Install dependencies
shell: bash
run: |
yarn install --immutable --inline-builds
env:
YARN_ENABLE_GLOBAL_CACHE: 'false'
YARN_NM_MODE: 'hardlinks-local'
YARN_INSTALL_STATE_PATH: .yarn/ci-cache/install-state.gz