Skip to content

Commit

Permalink
Cache npm dependencies in actions
Browse files Browse the repository at this point in the history
  • Loading branch information
sbutz committed Nov 26, 2023
1 parent 671b289 commit 5aec4ee
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 6 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/cache-firebase-emulators.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
jobs:
cache_firebase_emulators:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache firebase emulators
uses: actions/cache@v3
with:
path: ~/.cache/firebase/emulators
key: ${{ runner.os }}-firebase-emulators-${{ hashFiles('~/.cache/firebase/emulators/**') }}
6 changes: 5 additions & 1 deletion .github/workflows/client-deploy-on-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ jobs:
env:
working-directory: ./client
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: 'npm'
cache-dependency-path: ${{env.working-directory}}/package-lock.json
- run: npm ci && npm run build
working-directory: ${{env.working-directory}}
- uses: FirebaseExtended/action-hosting-deploy@v0
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ jobs:
env:
working-directory: ./client
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: 'npm'
cache-dependency-path: ${{env.working-directory}}/package-lock.json
- name: Install Dependencies
run: npm ci
working-directory: ${{env.working-directory}}
Expand All @@ -32,7 +36,7 @@ jobs:
env:
working-directory: ./client
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: 'Install Dependencies and build'
run: npm ci && npm run build
working-directory: ${{env.working-directory}}
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/firestore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@ jobs:
env:
working-directory: ./firestore
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: 'npm'
cache-dependency-path: ${{env.working-directory}}/package-lock.json
- name: Install Dependencies
run: npm ci
working-directory: ${{env.working-directory}}
- name: Run Lint
run: npm run lint
working-directory: ${{env.working-directory}}
- name: Cache Firebase Emulators
uses: ./.github/workflows/cache-firebase-emulators-workflow.yml@{{github.sha}}
- name: Run Tests
run: npm run test
working-directory: ${{env.working-directory}}
8 changes: 7 additions & 1 deletion .github/workflows/functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ jobs:
env:
working-directory: ./functions
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: 'npm'
cache-dependency-path: ${{env.working-directory}}/package-lock.json
- name: Install Dependencies
run: npm ci
working-directory: ${{env.working-directory}}
Expand All @@ -23,6 +27,8 @@ jobs:
- name: Build
run: npm run build
working-directory: ${{env.working-directory}}
- name: Cache Firebase Emulators
uses: ./.github/workflows/cache-firebase-emulators-workflow.yml@{{github.sha}}
- name: Run Tests
run: npm run test
working-directory: ${{env.working-directory}}
2 changes: 1 addition & 1 deletion .github/workflows/todos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
find_todo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Find ToDos
run: |
if git grep -nEwi "TODO|FIXME|XXX" -- ':!.github/workflows/todos.yml'; then
Expand Down

0 comments on commit 5aec4ee

Please sign in to comment.