Skip to content

Commit a6572a1

Browse files
committed
GH Actions: add basic QA workflow
* Lint markdown for consistent code style. * Lint Yaml files. Includes documenting what is being checked for via configuration files. This also ensures that checks can be run locally by contributors.
1 parent 2f6dd45 commit a6572a1

File tree

4 files changed

+174
-0
lines changed

4 files changed

+174
-0
lines changed

.github/workflows/basic-qa.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: CS
2+
3+
on:
4+
# Run on all pushes and on all pull requests.
5+
push:
6+
pull_request:
7+
# Allow manually triggering the workflow.
8+
workflow_dispatch:
9+
10+
# Do NOT cancels all previous workflow runs for the same branch that have not yet completed.
11+
concurrency:
12+
# The concurrency group contains the workflow name and the branch name.
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: false
15+
16+
jobs:
17+
markdownlint:
18+
name: 'Lint Markdown'
19+
uses: PHPCSStandards/.github/.github/workflows/reusable-markdownlint.yml@main
20+
21+
yamllint:
22+
name: 'Lint Yaml'
23+
uses: PHPCSStandards/.github/.github/workflows/reusable-yamllint.yml@main
24+
with:
25+
strict: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

.markdownlint-cli2.yaml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
#
2+
# Configuration file for MarkdownLint-CLI2.
3+
#
4+
# Example file with all options:
5+
# https://github.com/DavidAnson/markdownlint-cli2/blob/main/test/markdownlint-cli2-yaml-example/.markdownlint-cli2.yaml
6+
# Example file with all rules:
7+
# https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml
8+
#
9+
10+
# Define glob expressions to use (only valid at root).
11+
globs:
12+
- "**/*.md"
13+
14+
# Show found files on stdout (only valid at root).
15+
showFound: true
16+
17+
# Define glob expressions to ignore.
18+
ignores:
19+
20+
# Disable inline config comments.
21+
noInlineConfig: true
22+
23+
# Disable progress on stdout (only valid at root).
24+
noProgress: false
25+
26+
# Adjust the configuration for some built-in rules.
27+
# For full information on the options and defaults, see:
28+
# https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
29+
config:
30+
######################
31+
# Disable a few rules.
32+
######################
33+
# MD014/commands-show-output : Dollar signs used before commands without showing output.
34+
MD014: false
35+
# MD028/no-blanks-blockquote : Blank line inside blockquote.
36+
MD028: false
37+
# MD031/blanks-around-fences - Fenced code blocks should be surrounded by blank lines.
38+
MD031: false
39+
# MD032/blanks-around-lists - Lists should be surrounded by blank lines.
40+
MD032: false
41+
# MD041/first-line-heading/first-line-h1 : First line in a file should be a top-level heading.
42+
MD041: false
43+
44+
##############################
45+
# Customize a few other rules.
46+
##############################
47+
# MD003/heading-style/header-style - Heading style.
48+
MD003:
49+
# Heading style - Always use hashes.
50+
style: "atx"
51+
52+
# MD007/ul-indent - Unordered list indentation.
53+
MD007:
54+
indent: 4
55+
# Whether to indent the first level of the list.
56+
start_indented: false
57+
58+
# MD012/no-multiple-blanks - Multiple consecutive blank lines.
59+
MD012:
60+
maximum: 2
61+
62+
# MD013/line-length - Line length.
63+
MD013:
64+
# Number of characters. No need for being too fussy.
65+
line_length: 1000
66+
# Number of characters for headings.
67+
heading_line_length: 100
68+
# Number of characters for code blocks.
69+
code_block_line_length: 120
70+
# Include code blocks.
71+
code_blocks: false
72+
# Stern length checking (applies to tables, code blocks etc which have their own max line length).
73+
stern: true
74+
75+
# MD022/blanks-around-headings : Headings should be surrounded by blank lines.
76+
MD022:
77+
# Blank lines above heading.
78+
lines_above: [2, 1, 1, 1, 1]
79+
# Blank lines below heading.
80+
lines_below: [1, 1, 1, -1, -1]
81+
82+
# MD024/no-duplicate-heading/no-duplicate-header - Multiple headings with the same content.
83+
MD024:
84+
# Only check sibling headings.
85+
siblings_only: true
86+
87+
# MD026/no-trailing-punctuation : Trailing punctuation in heading.
88+
MD026:
89+
# Punctuation characters
90+
punctuation: ".,;。,;:!"
91+
92+
# MD033/no-inline-html - Inline HTML.
93+
MD033:
94+
# Allowed elements.
95+
allowed_elements:
96+
- div
97+
- p
98+
- a
99+
100+
# MD044/proper-names - Proper names should have the correct capitalization.
101+
MD044:
102+
# List of proper names.
103+
names: ["PHP_CodeSniffer", "CodeSniffer", "PHPCSUtils", "PHPCSExtra", "PHPUnit", "Xdebug"]
104+
# Include code blocks.
105+
code_blocks: false
106+
107+
# MD046/code-block-style - Code block style.
108+
MD046:
109+
style: "fenced"
110+
111+
# MD048/code-fence-style - Code fence style.
112+
MD048:
113+
style: "backtick"
114+
115+
# MD049/emphasis-style - Emphasis style should be consistent.
116+
MD049:
117+
style: "underscore"
118+
119+
# MD050/strong-style - Strong style should be consistent.
120+
MD050:
121+
style: "asterisk"
122+
123+
# MD055/table-pipe-style : Table pipe style.
124+
MD055:
125+
# Table pipe style.
126+
style: "leading_and_trailing"

.yamllint.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Details on the default config:
2+
# https://yamllint.readthedocs.io/en/stable/configuration.html#default-configuration
3+
extends: default
4+
5+
yaml-files:
6+
- '*.yaml'
7+
- '*.yml'
8+
- '.yamllint'
9+
10+
# Rule documentation: https://yamllint.readthedocs.io/en/stable/rules.html
11+
rules:
12+
colons:
13+
max-spaces-after: -1 # Disabled to allow aligning of values.
14+
comments:
15+
min-spaces-from-content: 1
16+
comments-indentation: {}
17+
document-start:
18+
present: false
19+
line-length:
20+
max: 145
21+
truthy:
22+
allowed-values: ["true", "false", "on", "off"]

0 commit comments

Comments
 (0)