From d38ccc82a02af218eabc699be530da1eee8bd904 Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 24 Mar 2021 09:25:42 -0700 Subject: [PATCH] Simplify documentation and configuration file CI system Now that the parser tool is moved out of the repository, it makes less sense to use the taskfile-based approach for the CI infrastructure. In order to make the repository more contributor-friendly, the documentation and configuration checking system is now confined to the .github subfolder. --- .github/.markdown-link-check.json | 5 + .github/.markdownlint.yml | 61 +++++ .github/workflows/check-config.yml | 38 --- .github/workflows/check-docs.yml | 37 --- .github/workflows/check-markdown.yml | 67 ++++++ .../workflows/check-prettier-formatting.yml | 224 ++++++++++++++++++ .prettierrc | 12 - Taskfile.yml | 48 ---- 8 files changed, 357 insertions(+), 135 deletions(-) create mode 100644 .github/.markdown-link-check.json create mode 100644 .github/.markdownlint.yml delete mode 100644 .github/workflows/check-config.yml delete mode 100644 .github/workflows/check-docs.yml create mode 100644 .github/workflows/check-markdown.yml create mode 100644 .github/workflows/check-prettier-formatting.yml delete mode 100644 .prettierrc diff --git a/.github/.markdown-link-check.json b/.github/.markdown-link-check.json new file mode 100644 index 00000000..da798797 --- /dev/null +++ b/.github/.markdown-link-check.json @@ -0,0 +1,5 @@ +{ + "retryOn429": true, + "retryCount": 3, + "aliveStatusCodes": [200, 206] +} diff --git a/.github/.markdownlint.yml b/.github/.markdownlint.yml new file mode 100644 index 00000000..141304c4 --- /dev/null +++ b/.github/.markdownlint.yml @@ -0,0 +1,61 @@ +# See: https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md +# The code style defined in this file is the official standardized style to be used in all Arduino projects and should +# not be modified. +# Note: Rules disabled solely because they are redundant to Prettier are marked with a "Prettier" comment. + +default: false +MD001: false +MD002: false +MD003: false # Prettier +MD004: false # Prettier +MD005: false # Prettier +MD006: false # Prettier +MD007: false # Prettier +MD008: false # Prettier +MD009: + br_spaces: 0 + strict: true + list_item_empty_lines: false # Prettier +MD010: false # Prettier +MD011: true +MD012: false # Prettier +MD013: false +MD014: false +MD018: true +MD019: false # Prettier +MD020: true +MD021: false # Prettier +MD022: false # Prettier +MD023: false # Prettier +MD024: false +MD025: + level: 1 + front_matter_title: '^\s*"?title"?\s*[:=]' +MD026: false +MD027: false # Prettier +MD028: false +MD029: + style: one +MD030: + ul_single: 1 + ol_single: 1 + ul_multi: 1 + ol_multi: 1 +MD031: false # Prettier +MD032: false # Prettier +MD033: false +MD034: false +MD035: false # Prettier +MD036: false +MD037: true +MD038: true +MD039: true +MD040: false +MD041: false +MD042: true +MD043: false +MD044: false +MD045: true +MD046: + style: fenced +MD047: false # Prettier diff --git a/.github/workflows/check-config.yml b/.github/workflows/check-config.yml deleted file mode 100644 index 8de9fb94..00000000 --- a/.github/workflows/check-config.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Check configuration files - -on: - push: - paths: - - ".github/workflows/check-config.yml" - - "Taskfile.yml" - - "**.yml" - - "**.yaml" - - "**.json" - pull_request: - paths: - - ".github/workflows/check-config.yml" - - "Taskfile.yml" - - "**.yml" - - "**.yaml" - - "**.json" - # See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch - workflow_dispatch: - # See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#repository_dispatch - repository_dispatch: - -jobs: - check: - runs-on: ubuntu-latest - - steps: - - name: Checkout local repository - uses: actions/checkout@v2 - - - name: Install Taskfile - uses: arduino/actions/setup-taskfile@master - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - version: 3.x - - - name: Check formatting - run: task config:check-formatting diff --git a/.github/workflows/check-docs.yml b/.github/workflows/check-docs.yml deleted file mode 100644 index 581a50a0..00000000 --- a/.github/workflows/check-docs.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Check documentation files - -on: - push: - paths: - - ".github/workflows/check-docs.yml" - - "Taskfile.yml" - - "**.md" - pull_request: - paths: - - ".github/workflows/check-docs.yml" - - "Taskfile.yml" - - "**.md" - # See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch - workflow_dispatch: - # See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#repository_dispatch - repository_dispatch: - -jobs: - check: - runs-on: ubuntu-latest - - steps: - - name: Checkout local repository - uses: actions/checkout@v2 - - - name: Install Taskfile - uses: arduino/actions/setup-taskfile@master - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - version: 3.x - - - name: Check links - run: task docs:check-links - - - name: Check formatting - run: task docs:check-formatting diff --git a/.github/workflows/check-markdown.yml b/.github/workflows/check-markdown.yml new file mode 100644 index 00000000..23d9553f --- /dev/null +++ b/.github/workflows/check-markdown.yml @@ -0,0 +1,67 @@ +name: Check Markdown + +# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows +on: + push: + paths: + - ".github/workflows/check-markdown.yml" + - ".github/.markdown-link-check.json" + - "**/.markdownlint*" + - "**.md" + - "**.mdx" + - "**.mkdn" + - "**.mdown" + - "**.markdown" + pull_request: + paths: + - ".github/workflows/check-markdown.yml" + - ".github/.markdown-link-check.json" + - "**/.markdownlint*" + - "**.md" + - "**.mdx" + - "**.mkdn" + - "**.mdown" + - "**.markdown" + schedule: + # Run every Tuesday at 8 AM UTC to catch breakage caused by changes to markdownlint. + - cron: "0 8 * * TUE" + workflow_dispatch: + repository_dispatch: + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Initialize markdownlint-cli problem matcher + uses: xt0rted/markdownlint-problem-matcher@v1 + + - name: Install markdownlint-cli + run: sudo npm install --global markdownlint-cli + + - name: Run markdownlint + run: markdownlint --config "${{ github.workspace }}/.github/.markdownlint.yml" "**/*.md" + + links: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Determine whether only modified files should be checked + id: check-modified + if: github.event_name == 'pull_request' + run: | + echo "::set-output name=value::yes" + + - name: Check links + uses: gaurav-nelson/github-action-markdown-link-check@v1 + with: + config-file: .github/.markdown-link-check.json + use-quiet-mode: "yes" + check-modified-files-only: ${{ steps.check-modified.outputs.value }} + base-branch: ${{ github.base_ref }} diff --git a/.github/workflows/check-prettier-formatting.yml b/.github/workflows/check-prettier-formatting.yml new file mode 100644 index 00000000..dd29c8b3 --- /dev/null +++ b/.github/workflows/check-prettier-formatting.yml @@ -0,0 +1,224 @@ +name: Check Prettier Formatting + +# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows +on: + push: + paths: + - ".github/workflows/check-prettier-formatting.yml" + - "**/.prettierignore" + - "**/.prettierrc*" + # CSS + - "**.css" + - "**.wxss" + # PostCSS + - "**.pcss" + - "**.postcss" + # Less + - "**.less" + # SCSS + - "**.scss" + # GraphQL + - "**.graphqls?" + - "**.gql" + # handlebars + - "**.handlebars" + - "**.hbs" + # HTML + - "**.mjml" + - "**.html?" + - "**.html.hl" + - "**.st" + - "**.xht" + - "**.xhtml" + # Vue + - "**.vue" + # JavaScript + - "**.flow" + - "**._?jsb?" + - "**.bones" + - "**.cjs" + - "**.es6?" + - "**.frag" + - "**.gs" + - "**.jake" + - "**.jscad" + - "**.jsfl" + - "**.js[ms]" + - "**.[mn]js" + - "**.pac" + - "**.wxs" + - "**.[xs]s?js" + - "**.xsjslib" + # JSX + - "**.jsx" + # TypeScript + - "**.ts" + # TSX + - "**.tsx" + # JSON + - "**/.eslintrc" + - "**.json" + - "**.avsc" + - "**.geojson" + - "**.gltf" + - "**.har" + - "**.ice" + - "**.JSON-tmLanguage" + - "**.mcmeta" + - "**.tfstate" + - "**.topojson" + - "**.webapp" + - "**.webmanifest" + - "**.yyp?" + # JSONC + - "**/.babelrc" + - "**/.jscsrc" + - "**/.js[hl]intrc" + - "**.jsonc" + - "**.sublime-*" + # JSON5 + - "**.json5" + # Markdown + - "**.mdx?" + - "**.markdown" + - "**.mk?down" + - "**.mdwn" + - "**.mkdn?" + - "**.ronn" + - "**.workbook" + # YAML + - "**/.clang-format" + - "**/.clang-tidy" + - "**/.gemrc" + - "**/glide.lock" + - "**.yml" + - "**.mir" + - "**.reek" + - "**.rviz" + - "**.sublime-syntax" + - "**.syntax" + - "**.yaml" + - "**.yaml-tmlanguage" + - "**.yaml.sed" + - "**.yml.mysql" + pull_request: + paths: + - ".github/workflows/check-prettier-formatting.yml" + - "**/.prettierignore" + - "**/.prettierrc*" + # CSS + - "**.css" + - "**.wxss" + # PostCSS + - "**.pcss" + - "**.postcss" + # Less + - "**.less" + # SCSS + - "**.scss" + # GraphQL + - "**.graphqls?" + - "**.gql" + # handlebars + - "**.handlebars" + - "**.hbs" + # HTML + - "**.mjml" + - "**.html?" + - "**.html.hl" + - "**.st" + - "**.xht" + - "**.xhtml" + # Vue + - "**.vue" + # JavaScript + - "**.flow" + - "**._?jsb?" + - "**.bones" + - "**.cjs" + - "**.es6?" + - "**.frag" + - "**.gs" + - "**.jake" + - "**.jscad" + - "**.jsfl" + - "**.js[ms]" + - "**.[mn]js" + - "**.pac" + - "**.wxs" + - "**.[xs]s?js" + - "**.xsjslib" + # JSX + - "**.jsx" + # TypeScript + - "**.ts" + # TSX + - "**.tsx" + # JSON + - "**/.eslintrc" + - "**.json" + - "**.avsc" + - "**.geojson" + - "**.gltf" + - "**.har" + - "**.ice" + - "**.JSON-tmLanguage" + - "**.mcmeta" + - "**.tfstate" + - "**.topojson" + - "**.webapp" + - "**.webmanifest" + - "**.yyp?" + # JSONC + - "**/.babelrc" + - "**/.jscsrc" + - "**/.js[hl]intrc" + - "**.jsonc" + - "**.sublime-*" + # JSON5 + - "**.json5" + # Markdown + - "**.mdx?" + - "**.markdown" + - "**.mk?down" + - "**.mdwn" + - "**.mkdn?" + - "**.ronn" + - "**.workbook" + # YAML + - "**/.clang-format" + - "**/.clang-tidy" + - "**/.gemrc" + - "**/glide.lock" + - "**.yml" + - "**.mir" + - "**.reek" + - "**.rviz" + - "**.sublime-syntax" + - "**.syntax" + - "**.yaml" + - "**.yaml-tmlanguage" + - "**.yaml.sed" + - "**.yml.mysql" + schedule: + # Run every Tuesday at 8 AM UTC to catch breakage caused by changes to Prettier. + - cron: "0 8 * * TUE" + workflow_dispatch: + repository_dispatch: + +jobs: + check: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install Prettier + run: sudo npm install --global prettier + + - name: Format with Prettier + run: prettier --write . + + - name: Check formatting + run: git diff --color --exit-code diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 2703167c..00000000 --- a/.prettierrc +++ /dev/null @@ -1,12 +0,0 @@ -{ - "semi": false, - "printWidth": 120, - "overrides": [ - { - "files": "*.md", - "options": { - "proseWrap": "always" - } - } - ] -} diff --git a/Taskfile.yml b/Taskfile.yml index c5198001..9c0c9f8d 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -1,16 +1,6 @@ version: "3" -vars: - PRETTIER: prettier@2.1.2 - tasks: - docs:check: - desc: Lint and check formatting of documentation files - deps: - - task: docs:check-license - - task: docs:check-links - - task: docs:check-formatting - docs:check-license: desc: Check if the license file is correctly formatted cmds: @@ -35,41 +25,3 @@ tasks: exit 1 fi - docs:check-links: - desc: Check for dead links in documentation - cmds: - - | - npx --package markdown-link-check --call ' - STATUS=0 - for file in $(find -name "*.md"); do - markdown-link-check --quiet "$file" - STATUS=$(( $STATUS + $? )) - done - exit $STATUS' - - docs:check-formatting: - desc: Check formatting of documentation files - cmds: - - npx {{.PRETTIER}} --check "**/*.md" - - - config:check: - desc: Lint and check formatting of configuration files - deps: - - task: config:check-formatting - - config:check-formatting: - desc: Check formatting of configuration files - cmds: - - npx {{.PRETTIER}} --check "**/*.{yml,yaml,json}" - - docs:format: - desc: Format documentation files - cmds: - - npx {{.PRETTIER}} --write "**/*.md" - - config:format: - desc: Format configuration files - cmds: - - npx {{.PRETTIER}} --write "**/*.{yml,yaml,json}" -