diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d00ac86..e83d5a1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -81,3 +81,34 @@ jobs: - name: Run e2e tests run: npm run test:e2e + + unit: + runs-on: ubuntu-latest + + if: ${{ !startsWith(github.event.head_commit.message, 'docs') }} + needs: format # Ensures the format job completes before e2e job starts + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: Cache Node modules + uses: actions/cache@v4 + id: cache-node-modules + with: + path: | + node_modules + ~/.npm + key: ${{ runner.os }}-node-modules-${{ env.NODE_VERSION }}-${{ hashFiles('package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node-modules-${{ env.NODE_VERSION }}- + + - name: Install dependencies + run: npm ci + + - name: Run unit tests + run: npm run test