2022-05-10 17:26:08 -07:00
|
|
|
name: Unit Tests
|
|
|
|
|
2023-07-02 10:03:31 +05:30
|
|
|
on: [push, pull_request, merge_group]
|
2022-05-10 17:26:08 -07:00
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
|
|
|
jobs:
|
2023-07-02 10:14:35 +05:30
|
|
|
unit-test:
|
2022-05-10 17:26:08 -07:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-08-24 09:26:49 +00:00
|
|
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
2022-05-10 17:26:08 -07:00
|
|
|
|
2024-08-24 09:26:49 +00:00
|
|
|
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
|
2022-09-25 19:24:40 +01:00
|
|
|
# uses version from "packageManager" field in package.json
|
|
|
|
|
2024-01-30 20:44:39 +05:30
|
|
|
- name: Setup Node.js
|
2024-10-08 09:11:33 +00:00
|
|
|
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
|
2022-09-05 01:00:47 +05:30
|
|
|
with:
|
2022-09-25 19:24:40 +01:00
|
|
|
cache: pnpm
|
2024-01-30 20:44:39 +05:30
|
|
|
node-version-file: '.node-version'
|
2022-05-10 17:26:08 -07:00
|
|
|
|
2022-09-05 01:00:47 +05:30
|
|
|
- name: Install Packages
|
|
|
|
run: |
|
2022-09-25 19:24:40 +01:00
|
|
|
pnpm install --frozen-lockfile
|
2022-09-05 01:00:47 +05:30
|
|
|
env:
|
|
|
|
CYPRESS_CACHE_FOLDER: .cache/Cypress
|
2022-05-10 17:26:08 -07:00
|
|
|
|
2022-09-05 01:00:47 +05:30
|
|
|
- name: Run Unit Tests
|
|
|
|
run: |
|
2023-06-17 17:40:06 +05:30
|
|
|
pnpm test:coverage
|
2022-09-08 03:51:42 +01:00
|
|
|
|
2023-02-25 20:14:09 +00: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 17:40:06 +05:30
|
|
|
pnpm exec vitest run ./packages/mermaid/src/diagrams/gantt/ganttDb.spec.ts --coverage
|
2023-02-25 20:14:09 +00:00
|
|
|
|
2024-09-01 16:40:12 -05:00
|
|
|
- name: Verify out-of-tree build with TypeScript
|
|
|
|
run: |
|
|
|
|
pnpm test:check:tsc
|
|
|
|
|
2023-06-17 17:54:13 +05:30
|
|
|
- name: Upload Coverage to Codecov
|
2024-08-24 09:26:49 +00:00
|
|
|
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
|
2023-07-06 11:32:37 +05:30
|
|
|
# Run step only pushes to develop and pull_requests
|
|
|
|
if: ${{ github.event_name == 'pull_request' || github.ref == 'refs/heads/develop' }}
|
2023-06-17 17:40:06 +05:30
|
|
|
with:
|
|
|
|
files: ./coverage/vitest/lcov.info
|
|
|
|
flags: unit
|
|
|
|
name: mermaid-codecov
|
2023-07-02 13:22:00 +05:30
|
|
|
fail_ci_if_error: false
|
2023-06-17 17:40:06 +05:30
|
|
|
verbose: true
|
2023-07-03 19:19:11 +05:30
|
|
|
token: 6845cc80-77ee-4e17-85a1-026cd95e0766
|