Skip to content

Commit

Permalink
Merge branch 'develop' into feature/397
Browse files Browse the repository at this point in the history
  • Loading branch information
faisal-alvi committed Jul 5, 2024
2 parents fab7f9c + defa95a commit d33f096
Show file tree
Hide file tree
Showing 153 changed files with 16,112 additions and 11,927 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ indent_size = 4
[*.{json,yml,md}]
indent_style = space
indent_size = 2

[{*.txt,wp-config-sample.php}]
end_of_line = crlf
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/.github export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.wordpress-version-checker.json export-ignore

# Text files should have LF line endings.
* text eol=lf

# Binary files should not be modified.
*.mo binary
*.png binary
*.jpg binary
37 changes: 36 additions & 1 deletion .github/hookdoc-tmpl/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Welcome to the Distributor Plugin Hook Documentation
# Welcome to the Distributor Developer Documentation

This resource is generated documentation on actions and filters found in the Distributor plugin. Use the sidebar to browse and navigate.

Expand All @@ -10,4 +10,39 @@ Version 2.0 of Distributor contains breaking changes. Please review the <a href=

To report an issue with Distributor or contribute back to the project, please visit the [GitHub repository](https://github.com/10up/distributor/).

## Developers

### Running Locally

If you are compiling Distributor locally, note that the recommended version of Node.js is version 16.x. The minimum version required is Node.js 12.x.

An `.nvmrc` file is included in the plugin repository. It's recommended you install [fnm (fast node manager)](https://github.com/Schniz/fnm/), [nvm (node version manager)](https://github.com/nvm-sh/nvm) or similar when developing locally.

### Testing

The plugin contains a standard test suite compatible with PHPUnit. If you want to test across multiple PHP versions, a [Dockunit](https://github.com/dockunit/dockunit) file is included.

### Debugging

You can define a constant `DISTRIBUTOR_DEBUG` to `true` to increase the ease of debugging in Distributor. This will make all remote requests blocking and expose the subscription post type.

Enabling this will also provide more debugging information in your error log for image side loading issues. The specific logging method may change in the future.

### Application Passwords

Application passwords are only available for live sites running over an HTTPS connection.

For your local development environment, you will need these snippets to enable application passwords without the need for an HTTPS connection. A local development environment is one that "can reach the internet but **is not reachable from the internet**".

```php
// In your local environment's wp-config.php file.
define( 'WP_ENVIRONMENT_TYPE', 'local' );

// In a custom plugin on your local environment.
add_filter( 'wp_is_application_passwords_available', '__return_true' );

add_action( 'wp_authorize_application_password_request_errors', function( $error ) {
$error->remove( 'invalid_redirect_scheme' );
} );
```
<a href="http://10up.com/contact/" class="banner"><img src="https://10updotcom-wpengine.s3.amazonaws.com/uploads/2016/10/10up-Github-Banner.png" width="850"></a>
13 changes: 10 additions & 3 deletions .github/hookdoc-tmpl/layout.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title><?js= title ?> - 10up Distributor Hook Docs</title>
<title><?js= title ?> - 10up Distributor Developer Documentation</title>

<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
Expand Down Expand Up @@ -32,11 +32,18 @@
<a href="https://10up.com/careers">Careers at 10up</a>
</footer>


</div>

<nav>
<?js= this.nav ?>
<?js
// Re-order tutorials to the top of the nav. The nav is hard-coded in wp-hooksdoc.
const indexOfFirstSubHeading = this.nav.indexOf('<h3');
const indexOfTutorial = this.nav.indexOf('<h3>Tutorials');
const headingLink = this.nav.substr(0, indexOfFirstSubHeading);
const hooksSection = this.nav.substr(indexOfFirstSubHeading, indexOfTutorial - indexOfFirstSubHeading);
const tutorialSection = this.nav.substr(indexOfTutorial);
?>
<?js= headingLink + tutorialSection+ hooksSection ?>
</nav>

<br class="clear">
Expand Down
3 changes: 2 additions & 1 deletion .github/release-pull-request-template.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- [x] Branch: Starting from `develop`, create a release branch named `release/X.Y.Z` for your changes.
- [ ] Version bump: Bump the version number in `distributor.php`, `package.json`, `readme.txt` and `tests/php/bootstrap.php` if it does not already reflect the version being released. In `distributor.php` update both the plugin "Version:" property and the plugin `DT_VERSION` constant.
- [ ] Version bump: Bump the version number in `distributor.php`, `package-lock.json`, `package.json`, `readme.txt` and `tests/php/bootstrap.php` if it does not already reflect the version being released. In `distributor.php` update both the plugin "Version:" property and the plugin `DT_VERSION` constant.
- [ ] New files: Ensure any new files, especially in the vendor folder, are correctly included in `webpack.config.release.js`.
- [ ] Changelog: Add/update the changelog in `CHANGELOG.md`.
- [ ] Props: Update `CREDITS.md` file with any new contributors, confirm maintainers are accurate.
Expand All @@ -10,6 +10,7 @@
- [ ] Update this pull request's status from `draft` to `ready to merge`.
- [ ] Review: Do a review of the commit to the `stable` branch to ensure the contents of the diffs are as expected.
- [ ] Test: Check out the `stable` branch and test it locally to ensure everything works as expected. It is recommended that you rename the existing `distributor` directory and check out `stable` fresh because switching branches does not delete files. This can be done with `git clone --single-branch --branch stable [email protected]:10up/distributor.git`
- [ ] Either perform a regression testing utilizing the available [Critical Flows](https://10up.github.io/Open-Source-Best-Practices/testing/#critical-flows) and Test Cases or if [end-to-end tests](https://10up.github.io/Open-Source-Best-Practices/testing/#e2e-testing) cover a significant portion of those Critical Flows then run e2e tests. Only proceed if everything tests successfully.
- [ ] Release: Create a [new release](https://github.com/10up/distributor/releases/new), naming the tag and the release with the new version number, and **targeting the `stable` branch**. Paste the changelog from `CHANGELOG.md` into the body of the release and include a link to the [closed issues on the milestone](https://github.com/10up/distributor/milestone/#?closed=1). The release should now appear under [releases](https://github.com/10up/distributor/releases).
- [ ] Check release: Wait for the [Publish Release Action](https://github.com/10up/distributor/actions?query=workflow%3A%22Publish+Release%22) to complete, and then check the latest release to ensure that the ZIP has been attached as an asset. Download the ZIP and inspect the contents to be sure they match the contents of the `stable` branch.
- [ ] Close milestone: Edit the [milestone](https://github.com/10up/distributor/milestone/#) with release date (in the `Due date (optional)` field) and link to GitHub release (in the `Description` field), then close the milestone.
Expand Down
24 changes: 19 additions & 5 deletions .github/workflows/build-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,27 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.4.0
uses: actions/checkout@v3.5.3
- name: Use desired version of NodeJS
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Set PHP version
uses: shivammathur/setup-php@2.17.0
uses: shivammathur/setup-php@2.25.4
with:
php-version: 7.4
tools: composer:v2
tools: composer:v2, wp

- name: Clone stable branch to the release folder
env:
GITHUB_REPOSITORY: ${{ github.event.repository.name }}
run: |
git clone --depth 1 --branch stable https://github.com/$GITHUB_REPOSITORY.git release
cd release
git branch --show-current
mv .git $RUNNER_TEMP/.git
cd ..
- name: Check versions
run: |
npm -v
Expand All @@ -37,11 +48,14 @@ jobs:
GITHUB_SHA: ${{ github.event.commits[0].sha }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd release
mv $RUNNER_TEMP/.git .git
git branch --show-current
git config --global user.email "[email protected]"
git config --global user.name "10upbot on GitHub"
git remote set-url origin "https://x-access-token:[email protected]/$GITHUB_REPOSITORY.git"
cd release
git add .
git commit -m "Committing built version of $GITHUB_SHA"
git push origin stable
git push origin HEAD:stable
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
name: No Response
name: 'Close stale issues'

# **What it does**: Closes issues where the original author doesn't respond to a request for information.
# **Why we have it**: To remove the need for maintainers to remember to check back on issues periodically to see if contributors have responded.
# **Who does it impact**: Everyone that works on docs or docs-internal.

on:
issue_comment:
types: [created]
schedule:
# Schedule for five minutes after the hour, every hour
- cron: '5 * * * *'
# Schedule for every day at 1:30am UTC
- cron: '30 1 * * *'

permissions:
issues: write

jobs:
noResponse:
stale:
runs-on: ubuntu-latest
steps:
- uses: lee-dohm/[email protected]
- uses: actions/stale@v9
with:
token: ${{ github.token }}
daysUntilClose: 14 # Number of days of inactivity before an Issue is closed for lack of response
responseRequiredLabel: "Reporter Feedback" # Label indicating that a response from the original author is required
closeComment: >
days-before-stale: 7
days-before-close: 7
stale-issue-message: >
It has been 7 days since more information was requested from you in this issue and we have not heard back. This issue is now marked as stale and will be closed in 7 days, but if you have more information to add then please comment and the issue will stay open.
close-issue-message: >
This issue has been automatically closed because there has been no response
to our request for more information. With only the
information that is currently in the issue, we don't have enough information
to take action. Please reach out if you have or find the answers we need so
that we can investigate further. See [this blog post on bug reports and the
importance of repro steps](https://www.lee-dohm.com/2015/01/04/writing-good-bug-reports/)
for more information about the kind of information that may be helpful.
stale-issue-label: 'stale'
close-issue-reason: 'not_planned'
any-of-labels: 'Reporter Feedback'
remove-stale-when-updated: true
28 changes: 17 additions & 11 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ on:
push:
branches:
- develop
- develop-v1
- trunk
pull_request:
branches:
- develop
- develop-v1

jobs:
build:
name: NPM Install
Expand Down Expand Up @@ -48,11 +47,11 @@ jobs:
- {name: 'PHP Default', version: null}
core:
- {name: 'WP stable', version: 'latest'}
- {name: 'WP 5.7', version: 'WordPress/WordPress#5.7'}
- {name: 'WP 6.3', version: 'WordPress/WordPress#6.3'}
- {name: 'WP trunk', version: 'WordPress/WordPress#master'}
include:
- php: {name: 'PHP 7.4', version: '7.4'}
core: {name: 'WP 5.7', version: 'WordPress/WordPress#5.7'}
core: {name: 'WP 6.3', version: 'WordPress/WordPress#6.3'}
- php: {name: 'PHP 8.1', version: '8.1'}
core: {name: 'WP stable', version: 'latest'}
steps:
Expand Down Expand Up @@ -97,18 +96,25 @@ jobs:
npx wp-env run cli "wp core version"
npx wp-env run cli "php --version"
- name: Copy .htaccess
run: npm run copy-htaccess

- name: Test
run: npm run cypress:run

- name: Upload artifacts
uses: actions/upload-artifact@v2
- name: Update summary
if: always()
run: |
npx mochawesome-merge ./tests/cypress/reports/*.json -o tests/cypress/reports/mochawesome.json
rm -rf ./tests/cypress/reports/mochawesome-*.json
npx mochawesome-json-to-md -p ./tests/cypress/reports/mochawesome.json -o ./tests/cypress/reports/mochawesome.md
npx mochawesome-report-generator tests/cypress/reports/mochawesome.json -o tests/cypress/reports/
cat ./tests/cypress/reports/mochawesome.md >> $GITHUB_STEP_SUMMARY
- name: Make artifacts available
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-artifact
retention-days: 2
path: |
${{ github.workspace }}/tests/cypress/screenshots/
${{ github.workspace }}/tests/cypress/videos/
${{ github.workspace }}/tests/cypress/screenshots/
${{ github.workspace }}/tests/cypress/videos/
${{ github.workspace }}/tests/cypress/logs/
${{ github.workspace }}/tests/cypress/reports/
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Dependency Review Action
#
# This Action will scan dependency manifest files that change as part of a Pull Reqest, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging.
# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging.
#
# Source repository: https://github.com/actions/dependency-review-action
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generate-zip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
rm -rf ./release && unzip ${{ github.event.repository.name }}.zip -d ./release
- name: Upload the ZIP file as an artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}
path: release
Expand Down
62 changes: 25 additions & 37 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ on:
push:
branches:
- develop
- develop-v1
- trunk
pull_request:
branches:
- develop
- develop-v1

jobs:
eslint:
Expand Down Expand Up @@ -50,46 +48,36 @@ jobs:
npm_config_yes=true npx github:10up/eslint-json-to-md --path ./eslint-report.json --output ./eslint-report.md
cat eslint-report.md >> $GITHUB_STEP_SUMMARY
if: ${{ failure() }}

phpcs:
name: phpcs
runs-on: ubuntu-latest

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

- name: Set standard 10up cache directories
run: |
composer config -g cache-dir "${{ env.COMPOSER_CACHE }}"
- name: Prepare composer cache
uses: actions/cache@v2
with:
path: ${{ env.COMPOSER_CACHE }}
key: composer-${{ env.COMPOSER_VERSION }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
composer-${{ env.COMPOSER_VERSION }}-
- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: composer:v2, cs2pr
- name: Checkout
uses: actions/checkout@v2
- id: changed-files
uses: tj-actions/changed-files@v41
with:
files: |
**/*.php
- name: Install dependencies
run: composer install --ignore-platform-reqs
- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
tools: composer:v2, cs2pr
coverage: none

- name: Check PHPCS standard
run: ./vendor/bin/phpcs -i
- name: Install dependencies
run: composer install

- name: Check Compatibility of main plugin file.
run: ./vendor/bin/phpcs ./distributor.php --runtime-set testVersion 5.6- --standard=PHPCompatibilityWP
- name: Test all files
if: ${{ github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/trunk' }}
run: ./vendor/bin/phpcs . --report-full --report-checkstyle=./.github/phpcs-report.xml

- name: PHPCS check
id: phpcs-sniffs
run: ./vendor/bin/phpcs . --report-full --report-checkstyle=./.github/phpcs-report.xml
- name: Test changed files
if: ${{ steps.changed-files.outputs.any_changed == 'true' && github.ref != 'refs/heads/develop' && github.ref != 'refs/heads/trunk' }}
run: ./vendor/bin/phpcs ${{ steps.changed-files.outputs.all_changed_files }} --report-full --report-checkstyle=./.github/phpcs-report.xml --runtime-set testVersion 7.4-

- name: Show PHPCS results in PR
if: ${{ always() }}
run: cs2pr ./.github/phpcs-report.xml
- name: Show PHPCS results in PR
if: ${{ always() }}
run: cs2pr ./.github/phpcs-report.xml
2 changes: 1 addition & 1 deletion .github/workflows/release-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
BRANCH=${GITHUB_REF##*/}
echo $BRANCH
VERSION=${BRANCH#'release/'}
echo ::set-output name=result::"Release: ${VERSION}"
echo "result="Release: ${VERSION}"" >> $GITHUB_OUTPUT
id: title
- name: Create Pull Request
run: gh pr create --draft --title "${{ steps.title.outputs.result }}" --body-file ./.github/release-pull-request-template.md
Expand Down
Loading

0 comments on commit d33f096

Please sign in to comment.