mirror of
https://github.com/chenasraf/nextcloud-pantry.git
synced 2026-05-17 17:28:01 +00:00
97 lines
2.3 KiB
YAML
97 lines
2.3 KiB
YAML
# SPDX-FileCopyrightText: Your Name <your@email.com>
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
name: Vitest
|
|
|
|
on: pull_request
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: vitest-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
changes:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
|
|
outputs:
|
|
src: ${{ steps.changes.outputs.src }}
|
|
|
|
steps:
|
|
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
|
id: changes
|
|
continue-on-error: true
|
|
with:
|
|
filters: |
|
|
src:
|
|
- '.github/workflows/**'
|
|
- 'src/**'
|
|
- 'package.json'
|
|
- 'pnpm-lock.yaml'
|
|
- 'tsconfig.json'
|
|
- 'tsconfig.*.json'
|
|
- 'vite.config.ts'
|
|
- 'vitest.config.ts'
|
|
|
|
vitest:
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: changes
|
|
if: needs.changes.outputs.src != 'false'
|
|
|
|
name: Vitest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
with:
|
|
node-version: 22
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
|
|
with:
|
|
run_install: false
|
|
|
|
- name: Get pnpm store directory
|
|
shell: bash
|
|
run: |
|
|
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
|
|
|
- name: Setup pnpm cache
|
|
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
|
with:
|
|
path: ${{ env.STORE_PATH }}
|
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pnpm-store-
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Run tests
|
|
run: pnpm test:run
|
|
|
|
summary:
|
|
permissions:
|
|
contents: none
|
|
runs-on: ubuntu-latest
|
|
needs: [changes, vitest]
|
|
|
|
if: always()
|
|
|
|
name: vitest-summary
|
|
|
|
steps:
|
|
- name: Summary status
|
|
run: if ${{ needs.changes.outputs.src != 'false' && needs.vitest.result != 'success' }}; then exit 1; fi
|