mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
56 lines
1.7 KiB
YAML
56 lines
1.7 KiB
YAML
name: Unit Tests
|
|
|
|
on: [push, pull_request, merge_group]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
unit-test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
|
|
|
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
|
|
# uses version from "packageManager" field in package.json
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
|
|
with:
|
|
cache: pnpm
|
|
node-version-file: '.node-version'
|
|
|
|
- name: Install Packages
|
|
run: |
|
|
pnpm install --frozen-lockfile
|
|
env:
|
|
CYPRESS_CACHE_FOLDER: .cache/Cypress
|
|
|
|
- name: Run Unit Tests
|
|
run: |
|
|
pnpm test:coverage
|
|
|
|
- name: Run ganttDb tests using California timezone
|
|
env:
|
|
# Makes sure that gantt db works even in a timezone that has daylight savings
|
|
# since some days have 25 hours instead of 24.
|
|
TZ: America/Los_Angeles
|
|
run: |
|
|
pnpm exec vitest run ./packages/mermaid/src/diagrams/gantt/ganttDb.spec.ts --coverage
|
|
|
|
- name: Verify out-of-tree build with TypeScript
|
|
run: |
|
|
pnpm test:check:tsc
|
|
|
|
- name: Upload Coverage to Codecov
|
|
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
|
|
# Run step only pushes to develop and pull_requests
|
|
if: ${{ github.event_name == 'pull_request' || github.ref == 'refs/heads/develop' }}
|
|
with:
|
|
files: ./coverage/vitest/lcov.info
|
|
flags: unit
|
|
name: mermaid-codecov
|
|
fail_ci_if_error: false
|
|
verbose: true
|
|
token: 6845cc80-77ee-4e17-85a1-026cd95e0766
|