Files
ComfyUI_frontend/.github/workflows/vitest-tests.yaml

66 lines
1.9 KiB
YAML

name: Vitest Tests
on:
push:
branches: [main, master, dev*, core/*, desktop/*, sno-deploy-ghpage]
pull_request:
branches-ignore: [wip/*, draft/*, temp/*]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: "pnpm"
- name: Cache tool outputs
uses: actions/cache@v4
with:
path: |
.cache
coverage
.vitest-cache
key: vitest-cache-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('src/**/*.{ts,vue,js}', 'vitest.config.*', 'tsconfig.json') }}
restore-keys: |
vitest-cache-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-
vitest-cache-${{ runner.os }}-
test-tools-cache-${{ runner.os }}-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run Vitest tests
run: pnpm test:unit
- name: Generate test reports (on main or debug branch)
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/sno-deploy-ghpage'
run: |
mkdir -p ./vitest-reports
pnpm exec vitest \
--reporter=json --outputFile.json="./vitest-reports/results.json" \
--reporter=html --outputFile.html="./vitest-reports/index.html" \
--run
- name: Upload Vitest reports artifact (on main or debug branch)
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/sno-deploy-ghpage'
uses: actions/upload-artifact@v4
with:
name: vitest-reports
path: vitest-reports/
retention-days: 7