Skip to content

Commit

Permalink
ci: add code standard workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
johnhooks committed Dec 13, 2023
1 parent f6430e6 commit 6db87ef
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 14 deletions.
13 changes: 11 additions & 2 deletions .distignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
.git
.github
.idea
.husky
.vscode
bin
node_modules
client
tests
node_modules
vendor
.composer
.distignore
.editorconfig
.env
.env.example
.eslintignore
.eslintrc.json
.gitattributes
.gitignore
.npmrc
.nvmrc
.php-cs-fixer.cache
.php-cs-fixer.php
.php-cs-fixer.dist.php
.prettierignore
.prettierrc.js
.stylelintignore
babel.config.cjs
codeception.yml
codeception.dist.yml
Expand All @@ -30,5 +40,4 @@ README.md
tsconfig.eslint.json
tsconfig.json
webpack.config.cjs
vendor
$GITHUB_WORKSPACE
40 changes: 40 additions & 0 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Coding Standards

on:
pull_request:
branches: [main, epic/*]
workflow_dispatch:

jobs:
lint:
name: Check Coding Standards
runs-on: ubuntu-latest
environment: testing
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install dependenices
uses: ./.github/actions/install

- name: Generate testing files
shell: bash
run: |
envsubst < tests/.env.example > tests/.env
php vendor/bin/codecept build
- name: Lint PHP
shell: bash
run: |
composer run-script lint
composer run-script analyze
- name: Lint JavaScript
shell: bash
run: |
npm run lint:js
npm run check
- name: Lint Styles
shell: bash
run: npm run lint:css
3 changes: 1 addition & 2 deletions .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ jobs:

- name: Setup environment
shell: bash
run: |
envsubst < tests/.env.example > tests/.env
run: envsubst < tests/.env.example > tests/.env

- name: Cache Docker images.
uses: ScribeMD/[email protected]
Expand Down
13 changes: 13 additions & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.cache
build
build-module
build-types

tests
coverage

vendor
vendor-prod
node_modules

tests/_wordpress
1 change: 0 additions & 1 deletion bin/init-pipeline.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env bash

./bin/test-up.sh
./bin/wait-for-it.sh http://localhost:$WORDPRESS_LOCALHOST_PORT
15 changes: 9 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,19 @@
"@strauss"
],
"strauss": [
"vendor/bin/strauss"
"@php vendor/bin/strauss"
],
"test": [
"vendor/bin/codecept run acceptance,unit"
"test:acceptance": [
"@php vendor/bin/codecept run acceptance"
],
"test:analyze": [
"vendor/bin/phpstan analyze --memory-limit=4G --ansi"
"analyze": [
"@php vendor/bin/phpstan analyse --memory-limit=4G --no-progress --no-interaction --ansi"
],
"lint": [
"@php vendor/bin/php-cs-fixer check --config=.php-cs-fixer.dist.php --ansi"
],
"lint:fix": [
"vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --ansi"
"@php vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --ansi"
]
},
"scripts-descriptions": {
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"start": "wp-scripts start",
"format": "wp-scripts format ./client/src",
"lint:css": "wp-scripts lint-style",
"lint:js": "eslint --ext .js,.jsx,.ts,.tsx .",
"lint:js": "eslint --ext .js,.jsx,.cjs,.mjs,.ts,.tsx .",
"check": "tsc -b",
"test": "jest --silent=false --coverage",
"prepare": "husky install"
},
Expand Down Expand Up @@ -65,6 +66,9 @@
"extends": [
"@wordpress/stylelint-config",
"@wordpress/stylelint-config/scss"
]
],
"rules": {
"indentation": 2
}
}
}
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"outDir": "./build-types",

"strict": true,
"declarationMap": true,
"resolveJsonModule": true,
"forceConsistentCasingInFileNames": true,
"pretty": true,
Expand Down

0 comments on commit 6db87ef

Please sign in to comment.