Skip to content

Sync Prettier formatting check CI workflow with template #218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Aug 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 0 additions & 41 deletions .github/workflows/check-formatting.yml

This file was deleted.

219 changes: 219 additions & 0 deletions .github/workflows/check-prettier-formatting-task.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-prettier-formatting-task.md
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-task.ya?ml"
- "Taskfile.ya?ml"
- "**/.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"
- "**.ya?ml*"
- "**.mir"
- "**.reek"
- "**.rviz"
- "**.sublime-syntax"
- "**.syntax"
pull_request:
paths:
- ".github/workflows/check-prettier-formatting-task.ya?ml"
- "Taskfile.ya?ml"
- "**/.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"
- "**.ya?ml*"
- "**.mir"
- "**.reek"
- "**.rviz"
- "**.sublime-syntax"
- "**.syntax"
workflow_dispatch:
repository_dispatch:

jobs:
check:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Task
uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Format with Prettier
run: task general:format-prettier

- name: Check formatting
run: git diff --color --exit-code
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
[![Check Markdown status](https://github.com/arduino/arduino-lint/actions/workflows/check-markdown-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/check-markdown-task.yml)
[![Docs Status](https://github.com/arduino/arduino-lint/workflows/Publish%20documentation/badge.svg)](https://github.com/arduino/arduino-lint/actions?workflow=Publish+documentation)
[![Codecov](https://codecov.io/gh/arduino/arduino-lint/branch/main/graph/badge.svg?token=nprqPQMbdh)](https://codecov.io/gh/arduino/arduino-lint)
[![Check Prettier Formatting status](https://github.com/arduino/arduino-lint/actions/workflows/check-prettier-formatting-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/check-prettier-formatting-task.yml)
[![Check General Formatting status](https://github.com/arduino/arduino-lint/actions/workflows/check-general-formatting-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/check-general-formatting-task.yml)
[![Check Shell Scripts status](https://github.com/arduino/arduino-lint/actions/workflows/check-shell-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/check-shell-task.yml)
[![Check Certificates status](https://github.com/arduino/arduino-lint/actions/workflows/check-certificates.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/check-certificates.yml)
Expand Down
38 changes: 8 additions & 30 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,14 @@ tasks:
check-formatting:
desc: Check formatting of all files
cmds:
- task: docs:check-formatting
- task: config:check-formatting
- task: general:check-formatting

format:
desc: Format all files
cmds:
- task: go:format
- task: python:format
- task: docs:format
- task: config:format
- task: general:format-prettier

# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml
go:check:
Expand Down Expand Up @@ -199,7 +196,7 @@ tasks:
# we invoke `arduino-lint` like this instead of `./arduino-lint` to remove
# the `./` chars from the examples
- PATH=. arduino-lint ../docs/commands
- task: docs:format
- task: general:format-prettier

docs:build:
desc: Build documentation website contents
Expand All @@ -223,7 +220,6 @@ tasks:
docs:check:
desc: Lint and check formatting of documentation files
cmds:
- task: docs:check-formatting
- task: markdown:lint
- task: markdown:fix
- task: markdown:check-links
Expand Down Expand Up @@ -257,16 +253,6 @@ tasks:
exit 1
fi

docs:check-formatting:
desc: Check formatting of documentation files
cmds:
- npx {{ .PRETTIER }} --check "**/*.md"

docs:format:
desc: Format documentation files
cmds:
- npx {{ .PRETTIER }} --write "**/*.md"

# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-shell-task/Taskfile.yml
shell:check:
desc: Check for problems with shell scripts
Expand Down Expand Up @@ -338,7 +324,6 @@ tasks:
config:check:
desc: Lint and check formatting of configuration files
cmds:
- task: config:check-formatting
- task: config:lint

config:lint:
Expand All @@ -352,18 +337,6 @@ tasks:
- wget --output-document={{ .WORKFLOW_SCHEMA_PATH }} https://json.schemastore.org/github-workflow
- npx ajv-cli validate --strict=false -s {{ .WORKFLOW_SCHEMA_PATH }} -d "./.github/workflows/*.{yml,yaml}"

config:check-formatting:
desc: Check formatting of configuration files
cmds:
- npx {{ .PRETTIER }} --check "**/*.{yml,yaml}"
- npx {{ .PRETTIER }} --check "**/*.json"

config:format:
desc: Format configuration files
cmds:
- npx {{ .PRETTIER }} --write "**/*.{yml,yaml}"
- npx {{ .PRETTIER }} --write "**/*.json"

# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-general-formatting-task/Taskfile.yml
general:check-formatting:
desc: Check basic formatting style of all files
Expand All @@ -375,6 +348,12 @@ tasks:
fi
- ec

# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-prettier-formatting-task/Taskfile.yml
general:format-prettier:
desc: Format all supported files with Prettier
cmds:
- npx prettier --write .

check-spelling:
desc: Check for commonly misspelled words
cmds:
Expand Down Expand Up @@ -411,7 +390,6 @@ vars:
-X {{ .CONFIGURATION_PACKAGE }}.buildTimestamp={{.TIMESTAMP}}
'
GOFLAGS: "-timeout 10m -v -coverpkg=./... -covermode=atomic"

DOCS_VERSION: dev
DOCS_ALIAS: ""
DOCS_REMOTE: "origin"
Expand Down
4 changes: 2 additions & 2 deletions docs/css/version-select.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@media only screen and (max-width:76.1875em) {
@media only screen and (max-width: 76.1875em) {
#version-selector {
padding: .6rem .8rem;
padding: 0.6rem 0.8rem;
}
}
Loading