Skip to content

Commit

Permalink
ci: add custom restore build action
Browse files Browse the repository at this point in the history
  • Loading branch information
denolfe committed Nov 8, 2023
1 parent 15459fb commit 5671179
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 75 deletions.
21 changes: 21 additions & 0 deletions .github/actions/restore-build-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Restore build cache
description: Installes node, pnpm, and restores the build cache
runs:
using: composite
steps:
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false

- name: Restore build
uses: actions/cache@v3
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
80 changes: 5 additions & 75 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,8 @@ jobs:
POSTGRES_DB: payloadtests

steps:
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false

- name: Restore build
uses: actions/cache@v3
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
uses: actions/restore-build-cache@v1

- name: Start PostgreSQL
uses: CasperWA/[email protected]
Expand Down Expand Up @@ -145,22 +131,8 @@ jobs:
part: [1/4, 2/4, 3/4, 4/4]

steps:
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false

- name: Restore build
uses: actions/cache@v3
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
uses: actions/restore-build-cache@v1

- name: E2E Tests
uses: nick-fields/retry@v2
Expand All @@ -182,22 +154,8 @@ jobs:
needs: core-build

steps:
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false

- name: Restore build
uses: actions/cache@v3
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
uses: actions/restore-build-cache@v1

- name: Generate Payload Types
run: pnpm dev:generate-types fields
Expand All @@ -222,22 +180,8 @@ jobs:
- live-preview-react

steps:
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false

- name: Restore build
uses: actions/cache@v3
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
uses: actions/restore-build-cache@v1

- name: Build ${{ matrix.pkg }}
run: pnpm turbo run build --filter=${{ matrix.pkg }}
Expand All @@ -258,22 +202,8 @@ jobs:
- plugin-sentry

steps:
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false

- name: Restore build
uses: actions/cache@v3
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
uses: actions/restore-build-cache@v1

- name: Build ${{ matrix.pkg }}
run: pnpm turbo run build --filter=${{ matrix.pkg }}
Expand Down

0 comments on commit 5671179

Please sign in to comment.