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:
|
2023-11-09 12:56:57 +01:00
|
|
|
- uses: actions/checkout@v4
|
2022-05-10 17:26:08 -07:00
|
|
|
|
2022-09-25 19:24:40 +01:00
|
|
|
- uses: pnpm/action-setup@v2
|
|
|
|
# uses version from "packageManager" field in package.json
|
|
|
|
|
2024-01-30 20:44:39 +05:30
|
|
|
- name: Setup Node.js
|
2023-11-09 12:56:57 +01:00
|
|
|
uses: actions/setup-node@v4
|
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
|
|
|
|
2023-06-17 17:54:13 +05:30
|
|
|
- name: Upload Coverage to Codecov
|
2024-03-25 13:46:41 +00:00
|
|
|
uses: codecov/codecov-action@v4
|
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
|