Skip to content

Instantly share code, notes, and snippets.

@moritzsalla
Created August 2, 2023 16:01
Show Gist options
  • Save moritzsalla/b5ffa4acf49fc7c8c5d515fc971e6b78 to your computer and use it in GitHub Desktop.
Save moritzsalla/b5ffa4acf49fc7c8c5d515fc971e6b78 to your computer and use it in GitHub Desktop.
Github action - Unit test
name: Tests
on:
pull_request:
jobs:
Unit:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v3
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node-version }}-
${{ runner.os }}-node-
${{ runner.os }}-
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
- name: Run tests
run: |
npm run test:ci
env:
CI: true
@moritzsalla
Copy link
Author

Edit caching can actually be detrimental to performance if there's not a ton of dependencies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment