Skip to content

Commit

Permalink
Merge pull request #1 from alleyinteractive/feature/0.1
Browse files Browse the repository at this point in the history
Add initial functionality
  • Loading branch information
dlh01 authored Oct 18, 2024
2 parents daba7db + ab407c8 commit 6774767
Show file tree
Hide file tree
Showing 19 changed files with 1,015 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

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

[*.{ts,tsx,js,jsx,scss,css,json,yaml,yml,feature,xml}]
indent_style = space
indent_size = 2

# Dotfiles
[.*]
indent_style = space
indent_size = 2
27 changes: 27 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#
# Exclude these files from release archives.
#
# This will also make the files unavailable when using Composer with `--prefer-dist`.
#
# Via WPCS.
#
/.github export-ignore
/.phpcs.xml export-ignore
/.phpcs export-ignore
/phpunit.xml export-ignore
/phpstan.neon export-ignore
/tests export-ignore

#
# Auto detect text files and perform LF normalization.
#
# http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/
#
* text=auto

#
# The above will handle all files not found below.
#
*.md text
*.php text
*.inc text
44 changes: 44 additions & 0 deletions .github/workflows/all-pr-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: "All Pull Request Tests"

on:
pull_request:
branches:
- main
types: [opened, synchronize, reopened, ready_for_review]

jobs:
# We use a single job to ensure that all steps run in the same environment and
# reduce the number of minutes used.
pr-tests:
# Don't run on draft PRs
if: github.event.pull_request.draft == false
# Timeout after 10 minutes
timeout-minutes: 10
# Define a matrix of PHP/WordPress versions to test against
strategy:
matrix:
php: [8.2, 8.3]
wordpress: ["latest"]
runs-on: ubuntu-latest
# Cancel any existing runs of this workflow
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}-P${{ matrix.php }}-WP${{ matrix.wordpress }}
cancel-in-progress: true
# Name the job in the matrix
name: "PR Tests PHP ${{ matrix.php }} WordPress ${{ matrix.wordpress }}"
steps:
- uses: actions/checkout@v4

- name: Run General Tests
# See https://github.com/alleyinteractive/action-test-general for more options
uses: alleyinteractive/action-test-general@develop

- name: Run PHP Tests
# See https://github.com/alleyinteractive/action-test-php for more options
uses: alleyinteractive/action-test-php@develop
with:
php-version: '${{ matrix.php }}'
wordpress-version: '${{ matrix.wordpress }}'
skip-services: 'true'
skip-wordpress-install: 'true'
audit-command: 'composer audit --no-dev --ansi --no-interaction'
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Build files
build
vendor
composer.lock
node_modules

# Log files
*.log

# Cache files
.phpcs/*.json
.phpunit.result.cache

# Ignore temporary OS files
.DS_Store
.DS_Store?
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
.thumbsdb

# IDE files
*.code-workspace
.idea
.vscode
45 changes: 45 additions & 0 deletions .phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="wp-big-pit" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
<description>PHP_CodeSniffer standard for wp-big-pit.</description>

<!-- Include Alley Rules -->
<rule ref="Alley-Interactive" />

<!--
Pass some flags to PHPCS:
p flag: Show progress of the run.
s flag: Show sniff codes in all reports.
n flag: Do not print warnings.
-->
<arg value="ps" />

<!-- Strip the filepaths down to the relevant bit. -->
<arg name="basepath" value="./" />

<!-- Check up to 20 files simultaneously. -->
<arg name="parallel" value="20" />

<!-- Set severity to 1 to see everything that isn't effectively turned off. -->
<arg name="severity" value="1" />

<!-- Exclude a few directories and autogenerated files. -->
<exclude-pattern>vendor/</exclude-pattern>

<!-- The version set here matches the minimum version tested in tests. -->
<config name="minimum_supported_wp_version" value="6.6" />

<!-- Define the prefixes that can be used by the plugin -->
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
<property name="prefixes" type="array">
<element value="alleyinteractive" />
<element value="alley" />
<element value="wp_big_pit" />
</property>
</properties>
</rule>

<rule ref="WordPress.Files.FileName">
<exclude-pattern>tests/*</exclude-pattern>
</rule>
</ruleset>
17 changes: 17 additions & 0 deletions .scaffolder/plugin-feature/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: create-wordpress-plugin@plugin-feature

inputs:
- name: featureName
description: "Feature Name"
type: string
- name: tests
description: "Include Tests?"
type: boolean
default: true

files:
- source: feature.php.hbs
destination: src/features/{{ wpClassFilename inputs.featureName }}
- source: test.php.hbs
if: "{{ inputs.tests }}"
destination: tests/Features/{{ psr4ClassFilename inputs.featureName suffix="Test.php" }}
27 changes: 27 additions & 0 deletions .scaffolder/plugin-feature/feature.php.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
/**
* {{ wpClassName inputs.featureName }} class file
*
* @package wp-big-pit
*/

namespace Alley\WP\Big_Pit\\{{ wpNamespace inputs.featureName prefix="Features" }};

use Alley\WP\Types\Feature;

/**
* {{ replace (wpClassName inputs.featureName) "_" " " }} Feature
*/
final class {{ wpClassName inputs.featureName }} implements Feature {
/**
* Set up the feature.
*/
public function __construct() {}

/**
* Boot the feature.
*/
public function boot(): void {
// Add any actions or filters here.
}
}
25 changes: 25 additions & 0 deletions .scaffolder/plugin-feature/test.php.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
/**
* {{ psr4ClassName name }} test class file
*
* @package create-wordpress-plugin
*/

namespace Alley\WP\Create_WordPress_Plugin\\{{ wpNamespace inputs.featureName prefix="Tests\Features" }};

use Create_WordPress_Plugin\Tests\TestCase;
use Create_WordPress_Plugin\\{{ wpNamespace inputs.featureName prefix="Features" }}\\{{ wpClassName inputs.featureName }};

/**
* {{ replace (psr4ClassName inputs.featureName) "_" " " }} Test for the {{ wpClassName inputs.featureName }} class.
*
* @link https://mantle.alley.com/docs/testing
*/
class {{ psr4ClassName inputs.featureName suffix="Test" }} extends TestCase {
/**
* An example test for the feature.
*/
public function test_example() {
$this->assertTrue( true );
}
}
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

This library adheres to [Semantic Versioning](https://semver.org/) and [Keep a CHANGELOG](https://keepachangelog.com/en/1.0.0/).

## 0.1.0

- Initial release
Loading

0 comments on commit 6774767

Please sign in to comment.