Skip to content

Commit

Permalink
CI: Add more checks to standalone docs pipeline (grafana#46449)
Browse files Browse the repository at this point in the history
* Add build frontend package step

* Reorder dependencies

* Add codespell and prettier checks
  • Loading branch information
dsotirakis committed Mar 11, 2022
1 parent cb0b089 commit 82b436a
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 14 deletions.
74 changes: 65 additions & 9 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -437,12 +437,40 @@ steps:
image: grafana/build-container:1.5.2
name: initialize
- commands:
- yarn packages:build
- yarn packages:docsExtract
- yarn packages:docsToMarkdown
- ./scripts/ci-reference-docs-lint.sh ci
- |-
echo -e "unknwon
referer
errorstring
eror
iam
wan" > words_to_ignore.txt
- codespell -I words_to_ignore.txt docs/
- rm words_to_ignore.txt
depends_on:
- initialize
image: grafana/build-container:1.5.2
name: codespell
- commands:
- yarn run prettier:checkDocs
depends_on:
- initialize
environment:
NODE_OPTIONS: --max_old_space_size=8192
image: grafana/build-container:1.5.2
name: lint-docs
- commands:
- ./bin/grabpl build-frontend-packages --jobs 8 --edition oss --build-id ${DRONE_BUILD_NUMBER}
--no-pull-enterprise
depends_on:
- initialize
environment:
NODE_OPTIONS: --max_old_space_size=8192
image: grafana/build-container:1.5.2
name: build-frontend-packages
- commands:
- ./scripts/ci-reference-docs-lint.sh ci
depends_on:
- build-frontend-packages
image: grafana/build-container:1.5.2
name: build-frontend-docs
- commands:
Expand Down Expand Up @@ -493,12 +521,40 @@ steps:
image: grafana/build-container:1.5.2
name: initialize
- commands:
- yarn packages:build
- yarn packages:docsExtract
- yarn packages:docsToMarkdown
- ./scripts/ci-reference-docs-lint.sh ci
- |-
echo -e "unknwon
referer
errorstring
eror
iam
wan" > words_to_ignore.txt
- codespell -I words_to_ignore.txt docs/
- rm words_to_ignore.txt
depends_on:
- initialize
image: grafana/build-container:1.5.2
name: codespell
- commands:
- yarn run prettier:checkDocs
depends_on:
- initialize
environment:
NODE_OPTIONS: --max_old_space_size=8192
image: grafana/build-container:1.5.2
name: lint-docs
- commands:
- ./bin/grabpl build-frontend-packages --jobs 8 --edition oss --build-id ${DRONE_BUILD_NUMBER}
--no-pull-enterprise
depends_on:
- initialize
environment:
NODE_OPTIONS: --max_old_space_size=8192
image: grafana/build-container:1.5.2
name: build-frontend-packages
- commands:
- ./scripts/ci-reference-docs-lint.sh ci
depends_on:
- build-frontend-packages
image: grafana/build-container:1.5.2
name: build-frontend-docs
- commands:
Expand Down Expand Up @@ -4330,6 +4386,6 @@ kind: secret
name: gcp_upload_artifacts_key
---
kind: signature
hmac: 2d48c15c46e95a72e8fc0715b405f17e770512a68a6526be08ca5e9f21a307f2
hmac: 5436fa85451361525a2d8b9c40b632623bd05ddd89f76095310b359de7993f11

...
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"packages:clean": "lerna run clean",
"precommit": "yarn run lint-staged",
"prettier:check": "prettier --check --list-different=false --loglevel=warn \"**/*.{ts,tsx,scss,md,mdx}\"",
"prettier:checkDocs": "prettier --check --list-different=false --loglevel=warn \"docs/**.md\" \"packages/**.{ts,tsx,scss,md,mdx}\"",
"prettier:write": "prettier --list-different \"**/*.{js,ts,tsx,scss,md,mdx}\" --write",
"start": "yarn themes:generate && yarn dev --watch",
"start:noTsCheck": "yarn start --env noTsCheck=1",
Expand Down
21 changes: 20 additions & 1 deletion scripts/drone/pipelines/docs.star
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
load(
'scripts/drone/steps/lib.star',
'build_image',
'initialize_step',
'download_grabpl_step',
'lint_frontend_step',
'codespell_step',
'shellcheck_step',
'test_frontend_step',
'build_storybook_step',
'build_frontend_docs_step',
'build_frontend_package_step',
'build_docs_website_step',
)

Expand All @@ -28,6 +29,9 @@ def docs_pipelines(edition, ver_mode, trigger):

# Insert remaining steps
steps.extend([
codespell_step(),
lint_docs(),
build_frontend_package_step(edition=edition, ver_mode=ver_mode),
build_frontend_docs_step(edition=edition),
build_docs_website_step(),
])
Expand All @@ -36,6 +40,21 @@ def docs_pipelines(edition, ver_mode, trigger):
name='{}-docs'.format(ver_mode), edition=edition, trigger=trigger, services=[], steps=steps,
)

def lint_docs():
return {
'name': 'lint-docs',
'image': build_image,
'depends_on': [
'initialize',
],
'environment': {
'NODE_OPTIONS': '--max_old_space_size=8192',
},
'commands': [
'yarn run prettier:checkDocs',
],
}


def trigger_docs():
return {
Expand Down
5 changes: 1 addition & 4 deletions scripts/drone/steps/lib.star
Original file line number Diff line number Diff line change
Expand Up @@ -458,12 +458,9 @@ def build_frontend_docs_step(edition):
'name': 'build-frontend-docs',
'image': build_image,
'depends_on': [
'initialize'
'build-frontend-packages'
],
'commands': [
'yarn packages:build',
'yarn packages:docsExtract',
'yarn packages:docsToMarkdown',
'./scripts/ci-reference-docs-lint.sh ci',
]
}
Expand Down

0 comments on commit 82b436a

Please sign in to comment.