Skip to content

Commit

Permalink
ci(e2e): install pnpm for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
BrycensRanch committed Mar 18, 2023
1 parent 4ebf589 commit 452784e
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/actions/pnpm-install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
########################################################################################
# "pnpm install" composite action #
#--------------------------------------------------------------------------------------#
# Cache: #
# - Downloaded zip archive (multi-arch, preserved across pnpm.lock changes) #
# - Yarn install state (discarded in pnpm.lock changes) #
# References: #
# - bench: https://gist.github.com/belgattitude/0ecd26155b47e7be1be6163ecfbb0f0b #
# - vs @setup/node: https://github.com/actions/setup-node/issues/325 #
########################################################################################

name: 'PNPM install'
description: 'Run pnpm install with cache enabled'

runs:
using: 'composite'

steps:
- uses: pnpm/action-setup@v2

# If you're not setting the packageManager field in package.json, add the version here
with:
version: 7.16.1

- name: Expose pnpm config(s) through "$GITHUB_OUTPUT"
if: ${{ !env.ACT }}
id: pnpm-config
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Cache rotation keys
id: cache-rotation
if: ${{ !env.ACT }}
shell: bash
run: |
echo "YEAR_MONTH=$(/bin/date -u "+%Y%m")" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
if: ${{ !env.ACT }}
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 }}-
# Prevent store to grow over time (not needed with yarn)
# Note: not perfect as it prune too much in monorepos so the idea
# is to use cache-rotation as above. In the future this might work better.
#- name: Prune pnpm store
# shell: bash
# run: pnpm prune store

- name: Install dependencies
shell: bash
run: pnpm install --frozen-lockfile --strict-peer-dependencies --prefer-offline
env:
# Other environment variables
HUSKY: '0' # By default do not run HUSKY install
3 changes: 3 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ jobs:
- name: Grant execute permission to gradlew
run: chmod +x gradlew

- name: 📥 Monorepo install all deps & pnpm
uses: ./.github/actions/pnpm-install

- name: Test
working-directory: e2e
run: pnpm e2e
Expand Down

0 comments on commit 452784e

Please sign in to comment.