2022-05-10 17:26:08 -07:00
|
|
|
name: Lint
|
|
|
|
|
2022-05-10 17:29:50 -07:00
|
|
|
on:
|
2023-07-02 10:03:31 +05:30
|
|
|
push:
|
|
|
|
merge_group:
|
2022-05-10 17:29:50 -07:00
|
|
|
pull_request:
|
2022-12-15 21:50:00 +05:30
|
|
|
workflow_dispatch:
|
2022-05-10 17:26:08 -07:00
|
|
|
|
2024-08-24 15:04:14 +05:30
|
|
|
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
|
2022-05-10 17:26:08 -07:00
|
|
|
permissions:
|
2022-12-07 11:19:44 +05:30
|
|
|
contents: write
|
2022-05-10 17:26:08 -07:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
lint:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-11-09 12:56:57 +01:00
|
|
|
- uses: actions/checkout@v4
|
2022-09-03 13:41:25 +05:30
|
|
|
|
2024-07-04 15:00:09 +08:00
|
|
|
- uses: pnpm/action-setup@v4
|
2022-09-25 19:36:39 +01:00
|
|
|
# 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-03 13:41:25 +05:30
|
|
|
with:
|
2022-09-25 19:36:39 +01:00
|
|
|
cache: pnpm
|
2024-01-30 20:44:39 +05:30
|
|
|
node-version-file: '.node-version'
|
2022-09-03 13:41:25 +05:30
|
|
|
|
|
|
|
- name: Install Packages
|
|
|
|
run: |
|
2022-09-25 19:36:39 +01:00
|
|
|
pnpm install --frozen-lockfile
|
2022-09-03 13:41:25 +05:30
|
|
|
env:
|
|
|
|
CYPRESS_CACHE_FOLDER: .cache/Cypress
|
|
|
|
|
|
|
|
- name: Run Linting
|
2023-01-29 20:27:31 +00:00
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
if ! pnpm run lint; then
|
|
|
|
# print a nice error message on lint failure
|
|
|
|
ERROR_MESSAGE='Running `pnpm run lint` failed.'
|
2023-05-09 10:24:05 +05:30
|
|
|
ERROR_MESSAGE+=' Running `pnpm -w run lint:fix` may fix this issue. '
|
2023-01-29 20:27:31 +00:00
|
|
|
ERROR_MESSAGE+=" If this error doesn't occur on your local machine,"
|
|
|
|
ERROR_MESSAGE+=' make sure your packages are up-to-date by running `pnpm install`.'
|
|
|
|
ERROR_MESSAGE+=' You may also need to delete your prettier cache by running'
|
|
|
|
ERROR_MESSAGE+=' `rm ./node_modules/.cache/prettier/.prettier-cache`.'
|
|
|
|
echo "::error title=Lint failure::${ERROR_MESSAGE}"
|
|
|
|
# make sure to return an error exitcode so that GitHub actions shows a red-cross
|
|
|
|
exit 1
|
|
|
|
fi
|
2022-09-03 13:41:25 +05:30
|
|
|
|
2023-02-20 03:54:59 +00:00
|
|
|
- name: Verify `./src/config.type.ts` is in sync with `./src/schemas/config.schema.yaml`
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
if ! pnpm run --filter mermaid types:verify-config; then
|
|
|
|
ERROR_MESSAGE='Running `pnpm run --filter mermaid types:verify-config` failed.'
|
|
|
|
ERROR_MESSAGE+=' This should be fixed by running'
|
|
|
|
ERROR_MESSAGE+=' `pnpm run --filter mermaid types:build-config`'
|
|
|
|
ERROR_MESSAGE+=' on your local machine.'
|
|
|
|
echo "::error title=Lint failure::${ERROR_MESSAGE}"
|
2023-08-22 11:38:55 +05:30
|
|
|
# make sure to return an error exitcode so that GitHub actions shows a red-cross
|
|
|
|
exit 1
|
2023-02-20 03:54:59 +00:00
|
|
|
fi
|
|
|
|
|
2023-08-22 11:38:55 +05:30
|
|
|
- name: Verify no circular dependencies
|
|
|
|
working-directory: ./packages/mermaid
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
if ! pnpm run --filter mermaid checkCircle; then
|
|
|
|
ERROR_MESSAGE='Circular dependency detected.'
|
|
|
|
ERROR_MESSAGE+=' This should be fixed by removing the circular dependency.'
|
|
|
|
ERROR_MESSAGE+=' Run `pnpm run --filter mermaid checkCircle` on your local machine'
|
|
|
|
ERROR_MESSAGE+=' to see the circular dependency.'
|
|
|
|
echo "::error title=Lint failure::${ERROR_MESSAGE}"
|
|
|
|
# make sure to return an error exitcode so that GitHub actions shows a red-cross
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-09-03 13:41:25 +05:30
|
|
|
- name: Verify Docs
|
2022-12-07 11:19:44 +05:30
|
|
|
id: verifyDocs
|
2022-10-30 21:22:38 -03:00
|
|
|
working-directory: ./packages/mermaid
|
2022-12-07 11:58:09 +05:30
|
|
|
continue-on-error: ${{ github.event_name == 'push' }}
|
2022-10-30 21:22:38 -03:00
|
|
|
run: pnpm run docs:verify
|