Skip to content

Commit

Permalink
chore: add remote turbo cache and simplified gh actions cache (#5326)…
Browse files Browse the repository at this point in the history
…Co-authored-by: Aymen Naghmouchi <aymenadvance@gmail.com>

* chore: add remote turbo cache and simplified gh actions cache

* chore: updated cache rules

* chore: more cache rules

---------

Co-authored-by: Aymen Naghmouchi <aymenadvance@gmail.com>
  • Loading branch information
ovflowd and aymen94 committed May 3, 2023
1 parent acb9794 commit c6b75f3
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 8 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,16 @@ jobs:
path: |
.next/cache
node_modules/.cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
key: build-${{ hashFiles('**/package-lock.json') }}-
restore-keys: |
build-${{ hashFiles('**/package-lock.json') }}-
enableCrossOsArchive: true

- name: Build Next.js
run: npx turbo build
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
NODE_OPTIONS: '--max_old_space_size=4096'
NEXT_BASE_PATH: /nodejs.org

Expand All @@ -58,7 +63,8 @@ jobs:
path: |
.next/cache
node_modules/.cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('node_modules/.cache/turbo') }}
key: build-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('node_modules/.cache') }}
enableCrossOsArchive: true

- name: Export Next.js static files
run: npx turbo export
Expand Down
32 changes: 26 additions & 6 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,24 @@ jobs:
with:
path: |
node_modules/.cache
key: ${{ runner.os }}-tests-${{ hashFiles('**/package-lock.json') }}-
key: tests-${{ hashFiles('**/package-lock.json') }}-
restore-keys: |
tests-${{ hashFiles('**/package-lock.json') }}-
enableCrossOsArchive: true

- name: Run Linting
run: npx turbo lint
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}

- name: Save Cache
uses: actions/cache/save@v3
with:
path: |
node_modules/.cache
key: ${{ runner.os }}-tests-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('node_modules/.cache') }}
key: tests-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('node_modules/.cache') }}
enableCrossOsArchive: true

unit-tests:
name: Tests on ${{ matrix.os }}
Expand Down Expand Up @@ -70,17 +77,24 @@ jobs:
with:
path: |
node_modules/.cache
key: ${{ runner.os }}-tests-${{ hashFiles('**/package-lock.json') }}-
key: tests-${{ hashFiles('**/package-lock.json') }}-
restore-keys: |
tests-${{ hashFiles('**/package-lock.json') }}-
enableCrossOsArchive: true

- name: Run Unit Tests
run: npx turbo test:ci
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}

- name: Save Cache
uses: actions/cache/save@v3
with:
path: |
node_modules/.cache
key: ${{ runner.os }}-tests-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('node_modules/.cache') }}
key: tests-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('node_modules/.cache') }}
enableCrossOsArchive: true

build:
name: Build on ${{ matrix.os }}
Expand Down Expand Up @@ -112,11 +126,16 @@ jobs:
path: |
.next/cache
node_modules/.cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
key: build-${{ hashFiles('**/package-lock.json') }}-
restore-keys: |
build-${{ hashFiles('**/package-lock.json') }}-
enableCrossOsArchive: true

- name: Build Next.js
run: npx turbo build
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
NODE_OPTIONS: '--max_old_space_size=4096'

- name: Save Cache
Expand All @@ -125,4 +144,5 @@ jobs:
path: |
.next/cache
node_modules/.cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('node_modules/.cache/turbo') }}
key: build-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('node_modules/.cache') }}
enableCrossOsArchive: true

0 comments on commit c6b75f3

Please sign in to comment.