-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update dependencies for PHP >= 8.0. Add dev dependencies for GitHub Actions and linting. * Version 0.7.0. * Update README. * Add new GitHub Actions workflows. * Code updates for PHP 8.0 * Disable install shell. * Add phpcs-ruleset
- Loading branch information
Showing
9 changed files
with
249 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: composer | ||
directory: "/" | ||
schedule: | ||
interval: weekly | ||
target-branch: "develop" | ||
open-pull-requests-limit: 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: Main PHP Version(s) CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
pull_request: | ||
|
||
# Cancels all previous workflow runs for the same branch that have not yet completed. | ||
concurrency: | ||
# The concurrency group contains the workflow name and the branch name. | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
Test: | ||
runs-on: ${{ matrix.operating-system }} | ||
strategy: | ||
matrix: | ||
operating-system: [ ubuntu-latest ] | ||
php-versions: [ '8.0', '8.1', '8.2' ] | ||
wp-versions: [ 'latest' ] | ||
coverage: [ true ] | ||
services: | ||
mysql: | ||
image: mysql:8.0 | ||
env: | ||
MYSQL_DATABASE: wordpress_test | ||
MYSQL_PASSWORD: password | ||
MYSQL_USER: wp | ||
MYSQL_ROOT_PASSWORD: root | ||
ports: | ||
- 3306:3306 | ||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10 | ||
|
||
name: WP ${{ matrix.wp-versions }} on PHP ${{ matrix.php-versions }} | ||
env: | ||
WORDPRESS_DB_NAME: wordpress_test | ||
WORDPRESS_DB_PASS: password | ||
WORDPRESS_DB_USER: wp | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # No shallow clone, we need all history! | ||
|
||
- name: Setup PHP ${{ matrix.php-versions }} | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
extensions: mysql, mysqli | ||
coverage: xdebug | ||
tools: composer, cs2pr, phpunit | ||
|
||
# - name: Setup WordPress ${{ matrix.wp-versions }} | ||
# run: bash bin/install-wp-tests.sh wordpress_test wp password localhost ${{ matrix.wp-versions }} true | ||
|
||
- name: Install dependencies | ||
run: composer update --prefer-dist --no-interaction | ||
|
||
- name: Create all branches | ||
run: source ./vendor/thefrosty/wp-utilities/bin/create-all-branches.sh | ||
|
||
- name: Run composer tests | ||
run: composer tests | ||
env: | ||
DB_PORT: ${{ job.services.mysql.ports[3306] }} | ||
|
||
- name: Show PHPCS results in PR | ||
run: cs2pr ./phpcs-report.xml | ||
|
||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
fail_ci_if_error: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#################################################################################### | ||
# GitHub Action: | ||
# Whenever creating a new release of the source code. | ||
#################################################################################### | ||
# Steps to execute: | ||
# - Checkout the source code | ||
# - Run "composer install" for production (required dependencies are already under vendor/) | ||
# - Create a .zip file, excluding: | ||
# - All hidden files (.git, .gitignore, etc) | ||
# - All development files, ending in .dist or .xml | ||
# - All composer files <= after installing dependencies, no need for them anymore | ||
# - Markdown files concerning development | ||
# - JS Package files. | ||
# - Folder build/ <= created only to store the .zip file | ||
# - Folder bin/ <= not needed for the plugin | ||
# - Folder tests/ <= not needed for the plugin | ||
# - Upload the .zip file as an artifact to the action (this step is possibly optional) | ||
# - Upload the .zip file as a release, for download | ||
#################################################################################### | ||
name: Generate Installable Plugin and Upload as Release Asset | ||
|
||
on: | ||
release: | ||
types: [ published ] | ||
|
||
jobs: | ||
Build: | ||
name: Build and Upload Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set Release Version env | ||
run: | | ||
VERSION=${{ github.event.release.tag_name }} | ||
echo "Release Version: ${VERSION//v}" | ||
echo "RELEASE_VERSION=${VERSION//v}" >> $GITHUB_ENV | ||
# see https://github.com/shivammathur/setup-php | ||
- name: Use PHP 8.0 | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.0 | ||
coverage: none | ||
env: | ||
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build project for production | ||
run: | | ||
echo "Release Version: ${{ github.event.release.tag_name }}" | ||
composer update --no-dev --optimize-autoloader | ||
mkdir build | ||
- name: Create artifact | ||
uses: montudor/action-zip@v0.1.1 | ||
with: | ||
args: zip -X -r build/wp-email-download.zip . -x *.git* bin** node_modules/\* .* "*/\.*" *.dist *.xml composer.* package*.json tests** build** | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: wp-email-download | ||
path: build/wp-email-download.zip | ||
|
||
- name: Upload to release | ||
uses: JasonEtco/upload-to-release@master | ||
with: | ||
args: build/wp-email-download.zip application/zip | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | ||
|
||
- name: Duplicate asset for GitHub Updater | ||
# @see https://github.com/afragen/github-updater/wiki/Settings#release-assets | ||
uses: montudor/action-zip@v0.1.1 | ||
with: | ||
args: zip -X -r build/wp-email-download-${{ env.RELEASE_VERSION }}.zip . -x *.git* bin** node_modules/\* .* "*/\.*" *.dist *.xml composer.* package*.json tests** build** | ||
|
||
- name: Upload duplicate to release | ||
uses: JasonEtco/upload-to-release@master | ||
with: | ||
args: build/wp-email-download-${{ env.RELEASE_VERSION }}.zip application/zip | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="WP-Email-Download" namespace="Dwnload\WpEmailDownload"> | ||
|
||
<description>Coding Standards for the WP Email Download codebase.</description> | ||
|
||
<!-- What to scan --> | ||
<file>src</file> | ||
<!-- Exclude the tests directory. --> | ||
<exclude-pattern>*/tests/*</exclude-pattern> | ||
<!-- Third-party code --> | ||
<exclude-pattern>*/bower-components/*</exclude-pattern> | ||
<exclude-pattern>*/node_modules/*</exclude-pattern> | ||
<exclude-pattern>*/vendor/*</exclude-pattern> | ||
<!-- Ensure certain file types aren't sniffed --> | ||
<exclude-pattern>*.js</exclude-pattern> | ||
<exclude-pattern>*.css</exclude-pattern> | ||
|
||
<!-- How to scan --> | ||
<arg value="sp"/> <!-- Show sniff and progress --> | ||
<arg name="basepath" value="."/><!-- Strip the file paths down to the relevant bit --> | ||
<arg name="colors"/> | ||
<arg name="extensions" value="php"/> | ||
<arg name="tab-width" value="4"/> | ||
<!-- For CI, don't fail on warnings --> | ||
<config name="ignore_warnings_on_exit" value="1"/> | ||
<config name="minimum_supported_wp_version" value="6.2" /> | ||
|
||
<rule ref="PSR12"> | ||
<exclude name="PSR12.Classes.OpeningBraceSpace.Found"/> | ||
<exclude name="PSR12.Files.FileHeader.IncorrectOrder"/> | ||
<exclude name="PSR12.Files.FileHeader.SpacingAfterBlock"/> | ||
<exclude name="PSR12.Files.OpenTag.NotAlone"/> | ||
<exclude name="PSR12.Traits.UseDeclaration.MultipleImport"/> | ||
<exclude name="PSR12.Traits.UseDeclaration.UseAfterBrace"/> | ||
</rule> | ||
|
||
<!-- Loads the PHP Compatibility ruleset. --> | ||
<rule ref="PHPCompatibility" /> | ||
<!-- Check for cross-version support for PHP 8.0 and higher. --> | ||
<config name="testVersion" value="8.0-"/> | ||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters