2022-05-11 02:26:08 +02:00
|
|
|
name: Unit Tests
|
|
|
|
|
2023-07-02 06:33:31 +02:00
|
|
|
on: [push, pull_request, merge_group]
|
2022-05-11 02:26:08 +02:00
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
|
|
|
jobs:
|
2023-07-02 06:44:35 +02:00
|
|
|
unit-test:
|
2022-05-11 02:26:08 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-10-10 14:13:50 +02:00
|
|
|
node-version: [18.x]
|
2022-05-11 02:26:08 +02:00
|
|
|
steps:
|
2022-09-04 21:30:47 +02:00
|
|
|
- uses: actions/checkout@v3
|
2022-05-11 02:26:08 +02:00
|
|
|
|
2022-09-25 20:24:40 +02:00
|
|
|
- uses: pnpm/action-setup@v2
|
|
|
|
# uses version from "packageManager" field in package.json
|
|
|
|
|
2022-09-04 21:30:47 +02:00
|
|
|
- name: Setup Node.js ${{ matrix.node-version }}
|
|
|
|
uses: actions/setup-node@v3
|
|
|
|
with:
|
2022-09-25 20:24:40 +02:00
|
|
|
cache: pnpm
|
2022-09-04 21:30:47 +02:00
|
|
|
node-version: ${{ matrix.node-version }}
|
2022-05-11 02:26:08 +02:00
|
|
|
|
2022-09-04 21:30:47 +02:00
|
|
|
- name: Install Packages
|
|
|
|
run: |
|
2022-09-25 20:24:40 +02:00
|
|
|
pnpm install --frozen-lockfile
|
2022-09-04 21:30:47 +02:00
|
|
|
env:
|
|
|
|
CYPRESS_CACHE_FOLDER: .cache/Cypress
|
2022-05-11 02:26:08 +02:00
|
|
|
|
2022-09-04 21:30:47 +02:00
|
|
|
- name: Run Unit Tests
|
|
|
|
run: |
|
2023-06-17 14:10:06 +02:00
|
|
|
pnpm test:coverage
|
2022-09-08 04:51:42 +02:00
|
|
|
|
2023-02-25 21:14:09 +01:00
|
|
|
- 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: |
|
2023-06-17 14:10:06 +02:00
|
|
|
pnpm exec vitest run ./packages/mermaid/src/diagrams/gantt/ganttDb.spec.ts --coverage
|
2023-02-25 21:14:09 +01:00
|
|
|
|
2023-06-17 14:24:13 +02:00
|
|
|
- name: Upload Coverage to Codecov
|
|
|
|
uses: codecov/codecov-action@v3
|
2023-06-17 14:10:06 +02:00
|
|
|
with:
|
|
|
|
files: ./coverage/vitest/lcov.info
|
|
|
|
flags: unit
|
|
|
|
name: mermaid-codecov
|
2023-07-02 09:52:00 +02:00
|
|
|
fail_ci_if_error: false
|
2023-06-17 14:10:06 +02:00
|
|
|
verbose: true
|