Skip to content
Open
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
25 changes: 25 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/.git
/.github
/.wordpress-org
/node_modules
/src

.distignore
.gitattributes
.gitignore
.nvmrc
.plugin-data
.wp-env.json
CHANGELOG.md
composer.json
composer.lock
grumphp.yml
LICENSE.md
package.json
package-lock.json
phpcs.xml.dist
phpunit.xml.dist
phpcs.xml
phpunit.xml
psalm.xml
README.md
14 changes: 14 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/.git export-ignore
/.github export-ignore
/vendor/ export-ignore -diff
/node_modules export-ignore

/.distignore export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.plugin-data export-ignore
/composer.json export-ignore
/composer.lock export-ignore -diff
/package.json export-ignore
/package-lock.json export-ignore -diff
/webpack.config.js export-ignore
38 changes: 38 additions & 0 deletions .github/workflows/pull-request-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: "Check plugin version and tags"
on:
pull_request:
branches:
- master

jobs:
version-check:
name: "Check version doesn't not already exists."
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- id: set-vars
name: "Set variables from .plugin-data file"
run: |
# Get all data from .plugin-data file
content=`cat ./.plugin-data`
# the following lines are only required for multi line json
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
# end of optional handling for multi line json
echo "::set-output name=pluginData::$content"

- id: version-check
name: "Check version in .plugin-data is not existing"
run: |
# Check version from .plugin-data
VERSION=${{fromJson(steps.set-vars.outputs.pluginData).version}}

if git rev-parse "$VERSION" >/dev/null 2>&1; then
echo "Tag aleady exists please update the .plugin-data file to good version";
exit 1;
fi
34 changes: 34 additions & 0 deletions .github/workflows/quality-js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Javascript Quality Checks

on:
pull_request:
push:
branches:
- master

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
checks:
name: Lint JS
runs-on: ubuntu-latest

steps:
- name: Checkout project
uses: actions/checkout@v3

- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'

- name: Install npm dependencies
run: npm install

- name: Run wp-script lint:js on src folder
run: npm run lint:js src
38 changes: 38 additions & 0 deletions .github/workflows/quality-php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: PHP Quality Checks

on:
pull_request:
push:
branches:
- master

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
checks:
name: Codesniffer
runs-on: ubuntu-latest

steps:
- name: Checkout project
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 5.6
extensions: mbstring, intl

- name: Validate composer file
run: composer validate

- name: Install composer dependencies
run: composer install

- name: Run codesniffer
run: composer cs
33 changes: 33 additions & 0 deletions .github/workflows/wordpressorg-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: "Publish New Release on WordPress.org"
on:
release:
types: [ published ]

jobs:
wordpress-release:
name: "New release on WordPress.org"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- id: set-vars
name: "Set variables from .plugin-data file"
run: |
# Get all data from .plugin-data file
content=`cat ./.plugin-data`
# the following lines are only required for multi line json
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
# end of optional handling for multi line json
echo "::set-output name=pluginData::$content"

- id: deploy
name: "WordPress.org Plugin Deploy"
if: "! github.event.release.prerelease"
uses: 10up/action-wordpress-plugin-deploy@stable
env:
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SLUG: ${{fromJson(steps.set-vars.outputs.pluginData).slug}}
4 changes: 4 additions & 0 deletions .plugin-data
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"version": "2.1.3",
"slug": "bea-media-analytics"
}
28 changes: 28 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,33 @@
"require":{
"php":">=5.6.0",
"julien731/wp-dismissible-notices-handler":"1.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"humanmade/psalm-plugin-wordpress": "^2.2",
"overtrue/phplint": "^9.0",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpcompatibility/php-compatibility": "^9.3",
"phpro/grumphp-shim": "^2.0",
"vimeo/psalm": "^4.30",
"wp-coding-standards/wpcs": "^3.0"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpro/grumphp-shim": true
}
},
"scripts": {
"cs": "./vendor/bin/phpcs",
"cb": "./vendor/bin/phpcbf",
"psalm": "./vendor/bin/psalm"
},
"scripts-descriptions": {
"cs": "Run PHP CodeSniffer on codebase using custom ruleset.",
"cb": "Run PHP Code Beautifier and Fixer on codebase using custom ruleset.",
"psalm": "Run psalm on codebase using custom ruleset.",
"phpunit": "Run PHP unit tests."
}

}
Loading