build: pnpm (#9806)

This commit is contained in:
Noel
2023-08-27 20:24:03 +02:00
committed by GitHub
parent 8325fa6540
commit e96a8a977f
82 changed files with 24444 additions and 28614 deletions

View File

@@ -0,0 +1,42 @@
name: 'pnpm install'
description: 'Run pnpm install with cache enabled'
runs:
using: 'composite'
steps:
- name: Set up swap space
if: runner.os == 'Linux'
uses: pierotofy/set-swap-space@v1.0
with:
swap-size-gb: 10
- uses: pnpm/action-setup@v2.2.4
name: Install pnpm
with:
run_install: false
- name: Expose pnpm config(s) through "$GITHUB_OUTPUT"
id: pnpm-config
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Cache rotation keys
id: cache-rotation
shell: bash
run: |
echo "YEAR_MONTH=$(/bin/date -u "+%Y%m")" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-config.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-cache-${{ steps.cache-rotation.outputs.YEAR_MONTH }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-cache-${{ steps.cache-rotation.outputs.YEAR_MONTH }}-
- name: Install dependencies
shell: bash
run: |
pnpm install --frozen-lockfile --prefer-offline --loglevel error
env:
HUSKY: '0'

View File

@@ -12,24 +12,29 @@ runs:
- 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
@@ -37,6 +42,7 @@ runs:
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'