Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: rush build cache setup #4679

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/actions/set-up-rush-with-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Set up rush with cache
description: This action sets up rush with cache

runs:
using: 'composite'
steps:
- name: Enable rush cache via environment variable
run: echo "RUSH_BUILD_CACHE_ENABLED=1" >> $GITHUB_ENV
shell: bash

- name: Setup rush cache
uses: gigara/rush-cache@v2

- name: Cache Rush
uses: actions/cache@v4
with:
path: |
common/temp/install-run
~/.rush
key: Rush-cache-${{ hashFiles('rush.json') }}

- name: Cache pnpm
uses: actions/cache@v4
with:
path: |
common/temp/pnpm-store
common/temp/node_modules
key: pnpm-cache-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}

- name: Install rush
run: |
node common/scripts/install-run-rush.js install
shell: bash
29 changes: 29 additions & 0 deletions .github/workflows/rw-test-build-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#this demonstrates how to use the rush build cache and pnpm module cache action
#caching use github actions cache to store the rush build cache via configured official plugin github-action-build-cache
#see: https://www.npmjs.com/package/@gigara/rush-github-action-build-cache-plugin
#all configuration is done in the build-cache.json
#all projects have set its build configuration outputs see example in libs/api-client-bear/config/rush-project.json
#set-up-rush-with-cache action enable cache via environment variable RUSH_BUILD_CACHE_ENABLED to allow cache only on CI

name: rw ~ Rush cache test
on:
workflow_call:
#workflow_dispatch:
jobs:
test-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: 'master'
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18.17.0

- name: Setup rush
uses: gooddata/gooddata-ui-sdk/.github/actions/set-up-rush-with-cache@master

- name: Build rush
run: |
node common/scripts/install-run-rush.js build
12 changes: 12 additions & 0 deletions common/autoinstallers/rush-plugins/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Rush uses this file to configure the package registry, regardless of whether the
# package manager is PNPM, NPM, or Yarn. Prior to invoking the package manager,
# Rush will always copy this file to the folder where installation is performed.
# When NPM is the package manager, Rush works around NPM's processing of
# undefined environment variables by deleting any lines that reference undefined
# environment variables.
#
# DO NOT SPECIFY AUTHENTICATION CREDENTIALS IN THIS FILE. It should only be used
# to configure registry sources.

registry=https://registry.npmjs.org/
always-auth=false
8 changes: 8 additions & 0 deletions common/autoinstallers/rush-plugins/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "rush-plugins",
"version": "1.0.0",
"private": true,
"dependencies": {
"@gigara/rush-github-action-build-cache-plugin": "^1.0.4"
}
}
Loading
Loading