Skip to content

ci: add cache

ci: add cache #4

Workflow file for this run

name: CI
on:
- push
- pull_request
jobs:
common-setup:
name: Common Setup
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['20.x']
needs: common-setup
steps:
- name: Build packages
run: pnpm run build
lint:
name: Lint
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['20.x']
needs: common-setup
steps:
- name: Lint code
run: npx turbo lint
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['18.x', '20.x']
needs: common-setup
steps:
- name: Run tests
run: npx turbo test