Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pedro-mendonca committed Dec 13, 2023
0 parents commit da0539d
Show file tree
Hide file tree
Showing 42 changed files with 24,465 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Exclude directories from WP.org
.git
.github
.wordpress-org
node_modules
tests

# Exclude files from WP.org
.distignore
.editorconfig
.eslintignore
.eslintrc.json
.gitattributes
.gitignore
.markdownlint.json
.markdownlintignore
.stylelintignore
.stylelintrc.json
composer.json
composer.lock
package-lock.json
package.json
phpcompat.xml.dist
phpcs.xml.dist
phpmd.xml.dist
phpstan.neon
postcss.config.js
README.md
25 changes: 25 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/

root = true

[*]
charset = utf-8
indent_style = tab
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[{*.json,*.yml}]
indent_style = space
indent_size = 2

[*.txt]
end_of_line = crlf
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.min.js
/node_modules/
/vendor/
/*.js
12 changes: 12 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": [
"plugin:@wordpress/eslint-plugin/es5"
],
"globals": {
"jQuery": true,
"console": true
},
"rules": {
"no-console": "off"
}
}
27 changes: 27 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Exclude directories from export
/.github/ export-ignore
/.wordpress-org/ export-ignore
/node_modules/ export-ignore
/tests/ export-ignore

# Exclude files from export
/.distignore export-ignore
/.editorconfig export-ignore
/.eslintignore export-ignore
/.eslintrc.json export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.markdownlint.json export-ignore
/.markdownlintignore export-ignore
/.stylelintignore export-ignore
/.stylelintrc.json export-ignore
/composer.json export-ignore
/composer.lock export-ignore
/package-lock.json export-ignore
/package.json export-ignore
/phpcompat.xml.dist export-ignore
/phpcs.xml.dist export-ignore
/phpmd.xml.dist export-ignore
/phpstan.neon export-ignore
/postcss.config.js export-ignore
/README.md export-ignore
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [pedro-mendonca]
33 changes: 33 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Dependabot set up for three package managers: GitHub Actions, npm and Composer.
# Documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:

# Maintain dependencies for GitHub Actions.
- package-ecosystem: "github-actions"
# Files stored in repository root.
directory: "/"
schedule:
# Check for updates every weekday.
interval: "daily"
open-pull-requests-limit: 10

# Maintain dependencies for npm.
- package-ecosystem: "npm"
# Files stored in repository root.
directory: "/"
schedule:
# Check for updates every weekday.
interval: "daily"
open-pull-requests-limit: 10

# Maintain dependencies for Composer.
- package-ecosystem: "composer"
# Files stored in repository root.
directory: "/"
schedule:
# Check for updates every weekday.
interval: "daily"
open-pull-requests-limit: 10
155 changes: 155 additions & 0 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
name: Coding Standards

on:
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]
paths:
# Any change to a PHP or Markdown file should run checks.
- '**.php'
- '**.*css'
- '**.md'
# These files configure NPM. Changes could affect the outcome.
- 'package*.json'
# These files configure Composer. Changes could affect the outcome.
- 'composer.*'
# This file configures Stylelint. Changes could affect the outcome.
- '.stylelintrc.json'
# This file configures Markdownlint. Changes could affect the outcome.
- '.markdownlint.json'
# This file configures PHPCS. Changes could affect the outcome.
- 'phpcs.xml.dist'
# Changes to workflow files should always verify all workflows are successful.
- '.github/workflows/*.yml'
# Allows you to run this workflow manually from the Actions tab.
workflow_dispatch:

jobs:
# Runs PHP coding standards checks.
#
# Violations are reported inline with annotations.
#
# Performs the following steps:
# - Checks out the repository.
# - Sets up PHP.
# - Logs debug information.
# - Installs Composer dependencies (use cache if possible).
# - Make Composer packages available globally.
# - Logs PHP_CodeSniffer debug information.
# - Runs PHPCS on the full codebase.
phpcs:
name: PHP coding standards
runs-on: ubuntu-latest

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

- name: Set up PHP
uses: shivammathur/setup-php@2.28.0
with:
php-version: '7.4' # Results are the same across all versions, check only in the last stable version.
coverage: none
tools: cs2pr
env:
fail-fast: false

- name: Log debug information
run: |
php --version
composer --version
- name: Check syntax error in sources
run: find -L . -path ./vendor -prune -o -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Install Composer dependencies
uses: ramsey/composer-install@v2

- name: Make Composer packages available globally
run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH

- name: Log PHPCS debug information
run: composer phpcs-i

- name: Run the PHP code sniffer
continue-on-error: true
run: phpcs --report-full --report-checkstyle=./phpcs-report.xml

- name: Show PHPCS results in PR
run: cs2pr ./phpcs-report.xml

# Runs the CSS/SCSS coding standards checks.
#
# CSS violations are not currently reported inline with annotations.
#
# Performs the following steps:
# - Checks out the repository.
# - Installs NodeJS 16 with caching for NPM.
# - Logs updated debug information.
# - Installs NPM dependencies using install-changed to hash the `package.json` file.
# - Run the WordPress Stylelint checks.
css-cs:
name: CSS/SCSS coding standards
runs-on: ubuntu-latest

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

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 16
cache: npm

- name: Log debug information
run: |
npm --version
node --version
- name: Install Dependencies
run: npm ci

- name: Run CSS/SCSS Lint
run: npm run lint:css

# Runs the JavaScript and Markdown coding standards checks.
#
# JS violations are not currently reported inline with annotations.
#
# Performs the following steps:
# - Checks out the repository.
# - Installs NodeJS 16 with caching for NPM.
# - Logs updated debug information.
# _ Installs NPM dependencies using install-changed to hash the `package.json` file.
# - Run the WordPress ESLint and Markdownlint checks.
js-md-cs:
name: JS and MD coding standards
runs-on: ubuntu-latest

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

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 16
cache: npm

- name: Log debug information
run: |
npm --version
node --version
- name: Install Dependencies
run: npm ci

- name: Run JavaScript Lint
run: npm run lint:js

- name: Run Markdown Lint
run: npm run lint:md:docs
63 changes: 63 additions & 0 deletions .github/workflows/php-compatibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: PHP Compatibility

on:
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]
paths:
# Any change to a PHP file should run checks.
- '**.php'
# These files configure Composer. Changes could affect the outcome.
- 'composer.*'
# This file configures PHP Compatibility. Changes could affect the outcome.
- 'phpcompat.xml.dist'
# Changes to workflow files should always verify all workflows are successful.
- '.github/workflows/*.yml'
# Allows you to run this workflow manually from the Actions tab.
workflow_dispatch:

jobs:
# Runs PHP compatibility check.
#
# Violations are reported inline with annotations.
#
# Performs the following steps:
# - Checks out the repository.
# - Sets up PHP.
# - Logs debug information about the runner container.
# - Installs Composer dependencies (use cache if possible).
# - Logs PHP_CodeSniffer debug information.
# - Runs the PHP compatibility tests.
php-compatibility:
name: Check PHP compatibility
runs-on: ubuntu-latest

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

- name: Set up PHP
uses: shivammathur/setup-php@2.28.0
with:
php-version: '7.4' # Results are the same across all versions, check only in the last stable version.
coverage: none
env:
fail-fast: false

- name: Log debug information
run: |
php --version
composer --version
- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Install Composer dependencies
uses: ramsey/composer-install@v2

- name: Log PHPCS debug information
run: composer phpcs-i

- name: Run PHP compatibility tests
run: composer compat:php
Loading

0 comments on commit da0539d

Please sign in to comment.