Skip to content

Commit

Permalink
Add deno testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Jashepp committed Oct 18, 2024
1 parent 99712d5 commit fdd5419
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 40 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/run-tests-deno.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

name: Deno Tests
on:
workflow_call:

jobs:

tests-deno:
name: Run Tests with Deno ${{ matrix.deno }}
runs-on: ubuntu-latest
strategy:
matrix:
deno: [ vx.x.x, v2 ]
steps:

# https://github.com/actions/checkout/releases
- name: Checkout
uses: actions/[email protected]

# https://github.com/denoland/setup-deno
- name: Setup Deno
uses: denoland/[email protected]
with:
deno-version: ${{ matrix.deno }}

- name: Install Deps
run: deno install

- name: Run Tests
run: deno task test
48 changes: 48 additions & 0 deletions .github/workflows/run-tests-node.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

name: Node Tests
on:
workflow_call:

jobs:

tests:
name: Run Tests with Node.js ${{ matrix.node }}
runs-on: ubuntu-latest
strategy:
matrix:
node: [ lts/*, latest, 16, 18, 20, 22 ]
steps:

# https://github.com/actions/cache/blob/main/examples.md#node---npm
- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}

# https://github.com/actions/cache/releases
- name: Use cache for npm
uses: actions/[email protected]
id: npm-cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: npm-${{ hashFiles('package.json') }}
restore-keys: npm-

# https://github.com/actions/checkout/releases
- name: Checkout
uses: actions/[email protected]

- name: Build package-lock
run: npm i --package-lock-only

# https://github.com/actions/setup-node/releases
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: ${{ matrix.node }}

- name: Clean & Install Deps
run: npm ci

- name: Run Tests
run: npm test
46 changes: 6 additions & 40 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,44 +17,10 @@ on:

jobs:

tests:
name: Run Tests with Node.js ${{ matrix.node }}
runs-on: ubuntu-latest
strategy:
matrix:
node: [ lts/*, latest, 16, 18, 20 ]
steps:
run-tests-node:
name: Node Tests
uses: ./.github/workflows/run-tests-node.yml

# https://github.com/actions/cache/blob/main/examples.md#node---npm
- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}

# https://github.com/actions/cache/releases
- name: Use cache for npm
uses: actions/[email protected]
id: npm-cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: npm-${{ hashFiles('package.json') }}
restore-keys: npm-

# https://github.com/actions/checkout/releases
- name: Checkout
uses: actions/[email protected]

- name: Build package-lock
run: npm i --package-lock-only

# https://github.com/actions/setup-node/releases
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: ${{ matrix.node }}

- name: Clean & Install Deps
run: npm ci

- name: Run Tests
run: npm test
run-tests-deno:
name: Deno Tests
uses: ./.github/workflows/run-tests-deno.yml

0 comments on commit fdd5419

Please sign in to comment.