Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
abscure committed Jun 5, 2024
0 parents commit 0e4cc24
Show file tree
Hide file tree
Showing 45 changed files with 1,989 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

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

root = true

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

[*.yml]
indent_style = space
indent_size = 2

[*.txt]
end_of_line = crlf

[*.md]
trim_trailing_whitespace = false
30 changes: 30 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Exclude these files from release archives.

# This will also make them unavailable when using Composer with `--prefer-dist`.

# If you develop for this package using Composer, use `--prefer-source`.
# https://www.reddit.com/r/PHP/comments/2jzp6k/i_dont_need_your_tests_in_my_production
# https://blog.madewithlove.be/post/gitattributes/

# They are also used when pushing to WordPress.org SVN using the
# https://github.com/10up/action-wordpress-plugin-deploy GitHub Action.

# Directories
/.github export-ignore
/.wordpress-org export-ignore
/bin export-ignore
/tests export-ignore

# Files
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.phpcs.xml.dist export-ignore
/_config.yml export-ignore
/CHANGELOG.md export-ignore
/CODE_OF_CONDUCT.md export-ignore
/composer.json export-ignore
/composer.lock export-ignore
/infection.json.dist export-ignore
/phpunit.xml.dist export-ignore
/psalm.xml export-ignore
38 changes: 38 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Contribute To ...

Community-made patches, localisations, bug reports and contributions are very welcome and help make ... the best plugin for ....

When contributing please ensure you follow the guidelines below so that we can keep on top of things.

## Getting Started

- Submit a ticket for your issue, assuming one does not already exist.
- Raise it on our [Issue Tracker](https://github.com/GaryJones/.../issues).
- Clearly describe the issue including steps to reproduce the bug.
- Make sure you fill in the earliest version that you know has the issue as well as the version of WordPress you're using.

## Making Changes

- Fork the repository on GitHub.
- Make the changes to your forked repository.
- Add unit / integration tests where necessary.
- Ensure you stick to the [WordPress Coding Standards](http://codex.wordpress.org/WordPress_Coding_Standards) and have properly documented any new functions.
- When committing, reference your issue (if present) and include a note about the fix.
- Push the changes to your fork and submit a pull request to the 'develop' branch of the ... repository.

### Checking You Changes

- Run unit tests: `phpunit`
- Run integration tests: `phpunit --testsuite integration`
- Run mutation tests: `infection` (see `logs/infection.log`)
- Run code standards: `composer phpcs`

## Code Documentation

- Please make sure that every method is documented well and the documentation follows the standards.

At this point you're waiting on us to merge your pull request. We'll review all pull requests, and make suggestions and changes if necessary.

# Additional Resources
- [General GitHub Documentation](http://help.github.com/)
- [GitHub Pull Request documentation](http://help.github.com/send-pull-requests/)
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: Bug report
about: Create a report to help us improve

---

## Describe the bug
<!-- A clear and concise description of what the bug is. -->

## To Reproduce
<!-- Steps to reproduce the behaviour:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error -->

## Expected behaviour
<!-- A clear and concise description of what you expected to happen. -->

## Screenshots
<!-- If applicable, add screenshots to help explain your problem. -->

## Environment

<!-- OS, browser, browser version, PHP version, WordPress version, active plugins, active theme, etc. -->

## Additional context
<!-- Add any other context about the problem here. -->
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project

---

## Is your feature request related to a problem?
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->

## Describe the solution you'd like
<!-- A clear and concise description of what you want to happen. -->

## Describe alternatives you've considered
<!-- A clear and concise description of any alternative solutions or features you've considered. -->

## Additional context
<!-- Add any other context or screenshots about the feature request here. -->
29 changes: 29 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!--- Provide a general summary of your changes in the Title above -->

## Description
<!--- Describe your changes in detail -->

## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->

## How Has This Been Tested?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->

## Screenshots (if appropriate):

## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have read the [CONTRIBUTING] document.
5 changes: 5 additions & 0 deletions .github/SUPPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Support for ...

The best place to get support for this project is on the [Issue Tracker](https://github.com/GaryJones/.../issues).

You can also find Gary on WordPress Slack, and [Twitter](https://twitter.com/GaryJ), though they may not be as easy to communicate the problem compared to the Issue tracker.
20 changes: 20 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "composer" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
# Add assignees
assignees:
- "GaryJones"
# Prefix all commit messages with "Composer"
# include a list of updated dependencies
commit-message:
prefix: "Composer"
include: "scope"
# Specify labels for Composer pull requests
labels:
- "maintenance"
125 changes: 125 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: CI for Easy AI

on: [push]

jobs:
lint:
name: Lint and code standards

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@master

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

- name: Setup PHP 7.4
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
extensions: mbstring # Just enough to keep phpunit happy when installing Composer dependencies.

- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest

# Needed as runs-on: system doesn't have xml-lint by default.
- name: Lint .phpcs.xml.dist
uses: ChristophWurst/xmllint-action@v1
with:
xml-file: ./.phpcs.xml.dist
xml-schema-file: ./vendor/squizlabs/php_codesniffer/phpcs.xsd

# Needed as runs-on: system doesn't have xml-lint by default.
- name: Lint phpunit.xml.dist
uses: ChristophWurst/xmllint-action@v1
with:
xml-file: ./phpunit.xml.dist
xml-schema-file: ./vendor/phpunit/phpunit/phpunit.xsd

- name: Lint PHP files
run: bin/php-lint

- name: Run Psalm
run: composer psalm
continue-on-error: true

- name: Run PHPCS
run: composer phpcs

supported-php-versions:
name: Determine Supported PHP Versions
runs-on: ubuntu-latest
outputs:
extensions: ${{ steps.supported-versions-matrix.outputs.extensions }}
version: ${{ steps.supported-versions-matrix.outputs.version }}
steps:
- uses: actions/checkout@v3
- id: supported-versions-matrix
uses: WyriHaximus/github-action-composer-php-versions-in-range@v1

test:
name: Unit and Integration tests
needs:
- supported-php-versions

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php: ${{ fromJson(needs.supported-php-versions.outputs.version) }}
wordpress: [ 'latest' ]
include:
- php: '8.0'
wordpress: '6.0'
- php: '8.0'
wordpress: '6.1'
- php: '8.2'
wordpress: 'trunk'
experimental: true
- php: '8.3'
wordpress: 'trunk'
experimental: true

steps:
- name: Checkout
uses: actions/checkout@master

- name: Setup PHP
uses: shivammathur/setup-php@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
php-version: ${{ matrix.php }}
coverage: pcov
# https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions
extensions: curl, dom, exif, fileinfo, hash, json, mbstring, mysqli, libsodium, openssl, pcre, imagick, xml, zip

- name: Install dependencies
run: |
composer install --prefer-dist --no-progress --no-suggest
composer require pcov/clobber --dev
vendor/bin/pcov clobber
# See see https://dev.to/swashata/setup-php-pcov-for-5-times-faster-phpunit-code-coverage-3d9c

- name: Setup Problem Matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Run unit tests
run: composer unit

- name: Run infection tests
run: composer infection
continue-on-error: true

- name: Start MySQL Service
run: sudo systemctl start mysql.service

- name: Prepare environment
run: composer prepare

- name: Run integration tests
run: composer integration
25 changes: 25 additions & 0 deletions .github/workflows/plugin-assets-readme-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# https://github.com/10up/action-wordpress-plugin-asset-update

# This Action commits any readme and WordPress.org-specific assets changes in your specified branch to the
# WordPress.org plugin repository if no other changes have been made since the last deployment to WordPress.org.
# This is useful for updating things like screenshots or Tested up to separately from functional changes, provided
# your Git branching methodology avoids changing anything else in the specified branch between functional releases.

name: Plugin asset/readme update
on:
push:
branches:
- master
jobs:
master:
name: Update plugin and assets
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: WordPress.org plugin asset/readme update
uses: 10up/action-wordpress-plugin-asset-update@stable
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} # Set in repo -> Settings -> Secrets
SVN_USERNAME: ${{ secrets.SVN_USERNAME }} # Set in repo -> Settings -> Secrets
README_NAME: README.md
continue-on-error: true # Remove for real plugin
24 changes: 24 additions & 0 deletions .github/workflows/plugin-push-to-wordpress-org.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# https://github.com/10up/action-wordpress-plugin-deploy

# This Action commits the contents of your Git tag to the WordPress.org plugin repository using the same tag name.
# It can exclude files as defined in either .distignore or .gitattributes, and moves anything from a .wordpress-org
# subdirectory to the top-level assets directory in Subversion (plugin banners, icons, and screenshots).

name: Push to WordPress.org
on:
push:
tags:
- "*"
jobs:
tag:
name: New tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: WordPress Plugin Deploy
uses: 10up/action-wordpress-plugin-deploy@stable
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SLUG: my-super-cool-plugin # Change this
continue-on-error: true # Remove for real plugin
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/logs/
/node_modules/
/vendor/
/composer.lock
/.phpcs.xml
/phpcs.xml
/phpunit.xml
/.phpunit.result.cache
Loading

0 comments on commit 0e4cc24

Please sign in to comment.