138 lines
4.3 KiB
YAML
138 lines
4.3 KiB
YAML
# Refer for explanation to following link:
|
|
# https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md
|
|
#
|
|
|
|
pre-commit:
|
|
parallel: true
|
|
commands:
|
|
build-copilot-instructions:
|
|
glob: "CONTRIBUTING.md"
|
|
run: yarn build:copilot-instructions
|
|
# Report linting warnings and errors, don't output files to stdout
|
|
lint-markdown:
|
|
tags: lint
|
|
glob: "{CONTRIBUTING.md,content/*.md}"
|
|
run: |
|
|
docker compose run --rm --name remark-lint remark-lint '{staged_files}'
|
|
cloud-lint:
|
|
tags: lint,v2
|
|
glob: 'content/influxdb/cloud/*.md'
|
|
run: '.ci/vale/vale.sh
|
|
--config=.vale.ini
|
|
--minAlertLevel=error {staged_files}'
|
|
cloud-dedicated-lint:
|
|
tags: lint,v3
|
|
glob: 'content/influxdb/cloud-dedicated/*.md'
|
|
run: '.ci/vale/vale.sh
|
|
--config=content/influxdb/cloud-dedicated/.vale.ini
|
|
--minAlertLevel=error {staged_files}'
|
|
cloud-serverless-lint:
|
|
tags: lint,v3
|
|
glob: 'content/influxdb/cloud-serverless/*.md'
|
|
run: '.ci/vale/vale.sh
|
|
--config=content/influxdb/cloud-serverless/.vale.ini
|
|
--minAlertLevel=error {staged_files}'
|
|
clustered-lint:
|
|
tags: lint,v3
|
|
glob: 'content/influxdb/clustered/*.md'
|
|
run: '.ci/vale/vale.sh
|
|
--config=content/influxdb/cloud-serverless/.vale.ini
|
|
--minAlertLevel=error {staged_files}'
|
|
telegraf-lint:
|
|
tags: lint,clients
|
|
glob: 'content/telegraf/*.md'
|
|
run: '.ci/vale/vale.sh
|
|
--config=.vale.ini
|
|
--minAlertLevel=error {staged_files}'
|
|
v2-lint:
|
|
tags: lint,v2
|
|
glob: 'content/influxdb/v2/*.md'
|
|
run: '.ci/vale/vale.sh
|
|
--config=content/influxdb/v2/.vale.ini
|
|
--minAlertLevel=error {staged_files}'
|
|
prettier:
|
|
tags: [frontend, style]
|
|
glob: '*.{css,js,ts,jsx,tsx}'
|
|
run: |
|
|
yarn prettier --write --loglevel silent "{staged_files}" > /dev/null 2>&1 ||
|
|
{ echo "⚠️ Prettier found formatting issues. Automatic formatting applied."
|
|
git add {staged_files}
|
|
}
|
|
pre-push:
|
|
commands:
|
|
packages-audit:
|
|
tags: frontend security
|
|
run: yarn audit
|
|
|
|
e2e-shortcode-examples:
|
|
tags: [frontend, test]
|
|
glob:
|
|
- assets/*.{js,mjs,css,scss}
|
|
- layouts/*.html
|
|
- content/example.md
|
|
files: /bin/ls content/example.md
|
|
run: |
|
|
node cypress/support/run-e2e-specs.js --spec "cypress/e2e/content/article-links.cy.js" {files}
|
|
exit $?
|
|
|
|
e2e-links:
|
|
tags: test,links
|
|
glob: 'content/**/*.{md,html}'
|
|
run: |
|
|
echo "Running link checker for: {staged_files}"
|
|
yarn test:links {staged_files}
|
|
exit $?
|
|
|
|
# Manage Docker containers
|
|
prune-legacy-containers:
|
|
priority: 1
|
|
tags: test
|
|
run: '(docker container ls --format "{{.ID}}"
|
|
--filter label=tag=influxdata-docs
|
|
--filter status=exited | xargs docker rm)
|
|
|| true'
|
|
build-pytest-image:
|
|
tags: test
|
|
run: yarn build:pytest:image
|
|
# Test code blocks in markdown files
|
|
cloud-pytest:
|
|
glob: content/influxdb/cloud/**/*.md
|
|
tags: test,codeblocks,v2
|
|
env:
|
|
SERVICE: cloud-pytest
|
|
run: yarn test:codeblocks:cloud '{staged_files}'
|
|
|
|
cloud-dedicated-pytest:
|
|
tags: test,codeblocks,v3
|
|
glob: content/influxdb/cloud-dedicated/**/*.md
|
|
run: |
|
|
yarn test:codeblocks:cloud-dedicated '{staged_files}' &&
|
|
./test/scripts/monitor-tests.sh stop cloud-dedicated-pytest
|
|
|
|
cloud-serverless-pytest:
|
|
tags: test,codeblocks,v3
|
|
glob: content/influxdb/cloud-serverless/**/*.md
|
|
env:
|
|
SERVICE: cloud-serverless-pytest
|
|
run: yarn test:codeblocks:cloud-serverless '{staged_files}'
|
|
|
|
clustered-pytest:
|
|
tags: test,codeblocks,v3
|
|
glob: content/influxdb/clustered/**/*.md
|
|
run: |
|
|
yarn test:codeblocks:clustered '{staged_files}' &&
|
|
./test/scripts/monitor-tests.sh stop clustered-pytest
|
|
|
|
telegraf-pytest:
|
|
tags: test,codeblocks
|
|
glob: content/telegraf/**/*.md
|
|
env:
|
|
SERVICE: telegraf-pytest
|
|
run: yarn test:codeblocks:telegraf '{staged_files}'
|
|
|
|
v2-pytest:
|
|
tags: test,codeblocks,v2
|
|
glob: content/influxdb/v2/**/*.md
|
|
env:
|
|
SERVICE: v2-pytest
|
|
run: yarn test:codeblocks:v2 '{staged_files}' |