Skip to content

Commit

Permalink
ci(deno): Cache Deno project dependencies (#79)
Browse files Browse the repository at this point in the history
Separate hard-coded workflows to the composite action.
  • Loading branch information
5ouma authored Oct 9, 2024
1 parent e88621c commit 2bb9e2f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 20 deletions.
20 changes: 20 additions & 0 deletions .github/actions/setup-deno-with-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: πŸ¦• Setup Deno with Cache
description: Install Deno and cache project dependencies

runs:
using: composite

steps:
- name: πŸ¦• Setup Deno
uses: denoland/setup-deno@5e01c016a857a4dbb5afe9d0f9733cd472cba985 # v1.5.1
with:
deno-version: v1.x

- name: πŸ«™ Cache Deno Dependencies
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1
with:
path: |
~/.deno
~/.cache/deno
key: ${{ runner.os }}-deno-${{ hashFiles('./deno.lock') }}
restore-keys: ${{ runner.os }}-deno-
30 changes: 10 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ jobs:
- name: 🚚 Checkout Repository
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: πŸ¦• Setup Deno
uses: denoland/setup-deno@5e01c016a857a4dbb5afe9d0f9733cd472cba985 # v1.5.1
with:
deno-version: v1.x
- name: πŸ¦• Setup Deno with Cache
uses: ./.github/actions/setup-deno-with-cache

- name: 🧹 Lint Check
run: deno lint
Expand All @@ -42,10 +40,8 @@ jobs:
- name: 🚚 Checkout Repository
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: πŸ¦• Setup Deno
uses: denoland/setup-deno@5e01c016a857a4dbb5afe9d0f9733cd472cba985 # v1.5.1
with:
deno-version: v1.x
- name: πŸ¦• Setup Deno with Cache
uses: ./.github/actions/setup-deno-with-cache

- name: πŸ“ Format Check
run: deno fmt --check
Expand All @@ -58,10 +54,8 @@ jobs:
- name: 🚚 Checkout Repository
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: πŸ¦• Setup Deno
uses: denoland/setup-deno@5e01c016a857a4dbb5afe9d0f9733cd472cba985 # v1.5.1
with:
deno-version: v1.x
- name: πŸ¦• Setup Deno with Cache
uses: ./.github/actions/setup-deno-with-cache

- name: πŸ” Type Check
run: deno check ./src
Expand All @@ -74,10 +68,8 @@ jobs:
- name: 🚚 Checkout Repository
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: πŸ¦• Setup Deno
uses: denoland/setup-deno@5e01c016a857a4dbb5afe9d0f9733cd472cba985 # v1.5.1
with:
deno-version: v1.x
- name: πŸ¦• Setup Deno with Cache
uses: ./.github/actions/setup-deno-with-cache

- name: πŸ§ͺ Run Tests
run: deno task cov
Expand All @@ -95,10 +87,8 @@ jobs:
- name: 🚚 Checkout Repository
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: πŸ¦• Setup Deno
uses: denoland/setup-deno@5e01c016a857a4dbb5afe9d0f9733cd472cba985 # v1.5.1
with:
deno-version: v1.x
- name: πŸ¦• Setup Deno with Cache
uses: ./.github/actions/setup-deno-with-cache

- name: πŸ“¦ Dry Run Publish
run: deno publish --dry-run

0 comments on commit 2bb9e2f

Please sign in to comment.