docs-v2/lefthook.yml

143 lines
4.7 KiB
YAML

# Refer for explanation to following link:
# https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md
#
pre-push:
commands:
packages-audit:
tags: frontend security
run: yarn audit
pre-commit:
parallel: true
commands:
lint-markdown:
tags: lint
glob: "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}'
# Link checking for InfluxDB v2
v2-links:
tags: test,links,v2
glob: "content/influxdb/v2/**/*.{md,html}"
run: 'node cypress/support/map-files-to-urls.mjs {staged_files}'
# Link checking for InfluxDB v3 core
v3-core-links:
tags: test,links,v3
glob: "content/influxdb3/core/**/*.{md,html}"
run: 'node cypress/support/map-files-to-urls.mjs {staged_files}'
# Link checking for InfluxDB v3 enterprise
v3-enterprise-links:
tags: test,links,v3
glob: "content/influxdb3/enterprise/**/*.{md,html}"
run: 'node cypress/support/map-files-to-urls.mjs {staged_files}'
# Link checking for Cloud products
cloud-links:
tags: test,links,cloud
glob: "content/influxdb/{cloud,cloud-dedicated,cloud-serverless}/**/*.{md,html}"
run: 'node cypress/support/map-files-to-urls.mjs {staged_files}'
# Link checking for Telegraf
telegraf-links:
tags: test,links
glob: "content/telegraf/**/*.{md,html}"
run: 'node cypress/support/map-files-to-urls.mjs {staged_files}'
cloud-pytest:
glob: content/influxdb/cloud/**/*.md
tags: test,codeblocks,v2
env:
- SERVICE: cloud-pytest
run: docker compose run --rm --name $SERVICE $SERVICE '{staged_files}'
cloud-dedicated-pytest:
tags: test,codeblocks,v3
glob: content/influxdb/cloud-dedicated/**/*.md
env:
- SERVICE: cloud-dedicated-pytest
run: |
./test/scripts/monitor-tests.sh start $SERVICE ;
docker compose run --name $SERVICE $SERVICE {staged_files} ;
./test/scripts/monitor-tests.sh stop $SERVICE
cloud-serverless-pytest:
tags: test,codeblocks,v3
glob: content/influxdb/cloud-serverless/**/*.md
env:
- SERVICE: cloud-serverless-pytest
run: docker compose run --rm --name $SERVICE $SERVICE '{staged_files}'
clustered-pytest:
tags: test,codeblocks,v3
glob: content/influxdb/clustered/**/*.md
env:
- SERVICE: clustered-pytest
run: |
./test/scripts/monitor-tests.sh start $SERVICE ;
docker compose run --name $SERVICE $SERVICE {staged_files} ;
./test/scripts/monitor-tests.sh stop $SERVICE
telegraf-pytest:
tags: test,codeblocks
glob: content/telegraf/**/*.md
env:
- SERVICE: telegraf-pytest
run: docker compose run --rm --name $SERVICE $SERVICE '{staged_files}'
v2-pytest:
tags: test,codeblocks,v2
glob: content/influxdb/v2/**/*.md
env:
- SERVICE: v2-pytest
run: docker compose run --rm --name $SERVICE $SERVICE '{staged_files}'
prettier:
tags: frontend,style
glob: "*.{css,js,ts,jsx,tsx}"
run: yarn prettier {staged_files}
build:
commands:
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'
rebuild-test-images:
tags: test
run: docker compose build pytest-codeblocks