switch to ruby markdownlint and add ci validation

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2022-05-25 12:17:02 +02:00
parent 86d104acd6
commit 9c296afa3e
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7
8 changed files with 60 additions and 17 deletions

View File

@ -28,6 +28,12 @@ jobs:
validate: validate:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
target:
- htmlproofer
- mdl
steps: steps:
- -
name: Checkout name: Checkout
@ -36,14 +42,12 @@ jobs:
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
- -
name: Check for broken links name: Validate
uses: docker/bake-action@v2 uses: docker/bake-action@v2
with: with:
targets: htmlproofer targets: ${{ matrix.target }}
set: | set: |
*.cache-from=type=gha,scope=build *.cache-from=type=gha,scope=build
*.cache-from=type=gha,scope=validate
*.cache-to=type=gha,scope=validate,mode=max
# Disabled netlify-deploy due to flakey 502 http errors # Disabled netlify-deploy due to flakey 502 http errors
# - name: copy static files # - name: copy static files

View File

@ -1,5 +0,0 @@
{
"default": true,
"MD013": { "line_length": -1 },
"MD030": { "ol_multi": 2 }
}

7
.mdlrc.style.rb Normal file
View File

@ -0,0 +1,7 @@
# https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md
# Start with all built-in rules.
all
rule 'MD013', :line_length => -1
rule 'MD030', :ol_multi => 2

View File

@ -77,6 +77,11 @@ RUN --mount=type=bind,from=generate,source=/out,target=_site \
--file-ignore="/^./_site/engine/api/.*$/,./_site/registry/configuration/index.html" \ --file-ignore="/^./_site/engine/api/.*$/,./_site/registry/configuration/index.html" \
--url-ignore="/^/docker-hub/api/latest/.*$/,/^/engine/api/v.+/#.*$/,/^/glossary/.*$/" --url-ignore="/^/docker-hub/api/latest/.*$/,/^/engine/api/v.+/#.*$/,/^/glossary/.*$/"
# mdl is a lint tool for markdown files
FROM gem AS mdl
RUN --mount=type=bind,target=. \
mdl --rules .mdlrc.style.rb .
# Release the generated files in a scratch image # Release the generated files in a scratch image
# Can be output to your host with: # Can be output to your host with:
# > make release # > make release

View File

@ -17,5 +17,6 @@ gem 'rouge', '3.27.0'
gem 'archive-zip', '0.12.0' gem 'archive-zip', '0.12.0'
gem 'html-proofer', '3.19.4' gem 'html-proofer', '3.19.4'
gem 'mdl', '0.11.0'
gem 'octopress-hooks', '2.6.2' gem 'octopress-hooks', '2.6.2'
gem 'rake', '13.0.6' gem 'rake', '13.0.6'

View File

@ -5,6 +5,8 @@ GEM
public_suffix (>= 2.0.2, < 5.0) public_suffix (>= 2.0.2, < 5.0)
archive-zip (0.12.0) archive-zip (0.12.0)
io-like (~> 0.3.0) io-like (~> 0.3.0)
chef-utils (17.10.0)
concurrent-ruby
colorator (1.1.0) colorator (1.1.0)
concurrent-ruby (1.1.10) concurrent-ruby (1.1.10)
em-websocket (0.5.3) em-websocket (0.5.3)
@ -60,8 +62,19 @@ GEM
listen (3.7.1) listen (3.7.1)
rb-fsevent (~> 0.10, >= 0.10.3) rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10) rb-inotify (~> 0.9, >= 0.9.10)
mdl (0.11.0)
kramdown (~> 2.3)
kramdown-parser-gfm (~> 1.1)
mixlib-cli (~> 2.1, >= 2.1.1)
mixlib-config (>= 2.2.1, < 4)
mixlib-shellout
mercenary (0.4.0) mercenary (0.4.0)
mini_portile2 (2.8.0) mini_portile2 (2.8.0)
mixlib-cli (2.1.8)
mixlib-config (3.0.9)
tomlrb
mixlib-shellout (3.2.7)
chef-utils
nokogiri (1.13.6) nokogiri (1.13.6)
mini_portile2 (~> 2.8.0) mini_portile2 (~> 2.8.0)
racc (~> 1.4) racc (~> 1.4)
@ -88,6 +101,7 @@ GEM
ffi (~> 1.9) ffi (~> 1.9)
terminal-table (2.0.0) terminal-table (2.0.0)
unicode-display_width (~> 1.1, >= 1.1.1) unicode-display_width (~> 1.1, >= 1.1.1)
tomlrb (2.0.1)
typhoeus (1.4.0) typhoeus (1.4.0)
ethon (>= 0.9.0) ethon (>= 0.9.0)
unicode-display_width (1.8.0) unicode-display_width (1.8.0)
@ -105,6 +119,7 @@ DEPENDENCIES
jekyll-redirect-from jekyll-redirect-from
jekyll-relative-links jekyll-relative-links
jekyll-sitemap jekyll-sitemap
mdl (= 0.11.0)
octopress-hooks (= 2.6.2) octopress-hooks (= 2.6.2)
rake (= 13.0.6) rake (= 13.0.6)
rouge (= 3.27.0) rouge (= 3.27.0)

View File

@ -33,9 +33,13 @@ vendor:
htmlproofer: htmlproofer:
$(BUILDX_CMD) bake htmlproofer $(BUILDX_CMD) bake htmlproofer
# Lint tool for markdown files
mdl:
$(BUILDX_CMD) bake mdl
# Deploy website and run it through Docker compose # Deploy website and run it through Docker compose
# Available in your browser at http://localhost:4000 # Available in your browser at http://localhost:4000
deploy: deploy:
docker compose up --build docker compose up --build
.PHONY: buildx-yaml release vendor htmlproofer deploy .PHONY: buildx-yaml release vendor htmlproofer mdl deploy

View File

@ -2,16 +2,20 @@ variable "JEKYLL_ENV" {
default = "development" default = "development"
} }
target "_common" {
args = {
JEKYLL_ENV = JEKYLL_ENV
}
no-cache-filter = ["generate"]
}
group "default" { group "default" {
targets = ["release"] targets = ["release"]
} }
target "release" { target "release" {
inherits = ["_common"]
target = "release" target = "release"
args = {
JEKYLL_ENV = JEKYLL_ENV
}
no-cache-filter = ["generate"]
output = ["./_site"] output = ["./_site"]
} }
@ -20,10 +24,18 @@ target "vendor" {
output = ["."] output = ["."]
} }
group "validate" {
targets = ["htmlproofer", "mdl"]
}
target "htmlproofer" { target "htmlproofer" {
inherits = ["_common"]
target = "htmlproofer" target = "htmlproofer"
args = { output = ["type=cacheonly"]
JEKYLL_ENV = JEKYLL_ENV }
}
target "mdl" {
inherits = ["_common"]
target = "mdl"
output = ["type=cacheonly"] output = ["type=cacheonly"]
} }