Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 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
9 changes: 1 addition & 8 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,12 @@ insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab

[*.json]
indent_size = 2

[*.md]
[*.{md,txt}]
trim_trailing_whitespace = false
indent_style = space
indent_size = 2

[*.txt]
trim_trailing_whitespace = false

[*.{yml,yaml}]
insert_final_newline = false
quote_type = single
indent_style = space
indent_size = 2
10 changes: 5 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx"]
"extensions": [ ".js", ".jsx", ".ts", ".tsx" ]
}
}
},
Expand All @@ -33,14 +33,14 @@
},
"overrides": [
{
"files": ["**/*.{ts,tsx}"],
"files": [ "**/*.{ts,tsx}" ],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": { "jsx": true },
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint"],
"plugins": [ "@typescript-eslint" ],
"rules": {
"no-undef": "off",
"no-unused-vars": "off",
Expand All @@ -53,7 +53,7 @@
}
},
{
"files": ["**/*.d.ts"],
"files": [ "**/*.d.ts" ],
"parser": "@typescript-eslint/parser",
"rules": {
"no-undef": "off",
Expand All @@ -68,7 +68,7 @@
"**/?(*.)test.js",
"tests/js/**/*.js"
],
"extends": ["plugin:jest/all"],
"extends": [ "plugin:jest/all" ],
"rules": {
// Add Rules for Jest here
}
Expand Down
33 changes: 33 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Automatically normalize line endings.
* text=auto

# Files and directories to exclude from `composer require`.
/.github export-ignore
/.wordpress-org export-ignore
/src export-ignore
/tests/ export-ignore

# Don't include the dotfiles for distribution.
/.* export-ignore

# Root files that are not needed for distribution.
/babel.config.js export-ignore
/blueprint.json export-ignore
/composer.lock export-ignore
/package-lock.json export-ignore
/package.json export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/playwright.config.ts export-ignore
/release-please-config.json export-ignore
/tsconfig.base.json export-ignore
/tsconfig.json export-ignore
/webpack.config.js export-ignore

# Mark docs as documentation for GitHub Linguist.
/docs/ linguist-documentation export-ignore
/CHANGELOG.md export-ignore

# Keep license and readme files.
/LICENSE.md linguist-documentation
/README.md linguist-documentation
34 changes: 34 additions & 0 deletions .github/.codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Codecov configuration
# https://docs.codecov.com/docs/codecov-yaml

# Fix path prefixes from Docker container paths to repo-relative paths
fixes:
- '/var/www/html/wp-content/plugins/oneaccess/::'

coverage:
status:
project:
default:
target: 70%
threshold: 5%
informational: true
patch:
default:
target: 60%
informational: true

ignore:
- 'tests/**'
- '**/*.test.ts'
- '**/*.test.tsx'
- '**/*.spec.ts'
- '**/*.spec.tsx'
- '**/types.d.ts'
- 'playwright.config.ts'

comment:
layout: 'reach,diff,flags,files'
behavior: default
require_base: false
require_head: true
require_changes: true
30 changes: 19 additions & 11 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,56 @@ Please make sure to review the [Development Guidelines](../docs/DEVELOPMENT.md)
-->

## What
<!-- In a few words, what does this PR actually change -->

<!-- In a few words, what does this PR actually change -->

## Why
<!-- Why is this PR necessary? Please any existing previous issue(s) or PR(s) and include a short summary here, too. -->

<!-- Why is this PR necessary? Please link any existing issue(s) or PR(s) and include a short summary here, too. -->

### Related Issue(s):

<!-- E.g.
- Fixes | Closes | Part of: #123
-->

-

## How

<!-- How does your PR address the issue at hand? What are the implementation details? Please be specific. -->

### AI Disclosure

<!-- How did you use AI to help you write this code? Please be specific - it helps us understand and better review the changes. -->

## Testing Instructions

<!-- Please include step by step instructions on how to test this PR. -->
<!-- 1. Open a Post or Page. -->
<!-- 2. Insert a Heading Block. -->
<!-- 3. etc. -->


## Screenshots
<!-- Include relevant screenshots proving the PR works as intended. -->

<!-- Include relevant screenshots proving the PR works as intended. -->

## Additional Info
<!-- Please include any relevant logs, error output, etc -->

<!-- Please include any relevant logs, error output, etc -->

## Checklist

<!--
We encourage you to complete this checklist to the best of your abilities.
If you can't do everything, that's okay too.
[Development Guidelines](../docs/DEVELOPMENT.md)
-->

- [ ] I have read the [Contribution Guidelines](https://github.com/rtCamp/OneAccess/blob/main/docs/CONTRIBUTING.md).
- [ ] I have read the [Development Guidelines](https://github.com/rtCamp/OneAccess/blob/main/docs/DEVELOPMENT.md).
- [ ] My code is tested to the best of my abilities.
- [ ] My code passes all lints (ESLint etc.).
- [ ] My code has detailed inline documentation.
- [ ] I have updated the project documentation as needed.
- [ ] I have read the [Contribution Guidelines](https://github.com/rtCamp/OneAccess/blob/main/docs/CONTRIBUTING.md).
- [ ] I have read the [Development Guidelines](https://github.com/rtCamp/OneAccess/blob/main/docs/DEVELOPMENT.md).
- [ ] I have added necessary tests to cover my changes.
- [ ] I have updated the project documentation as needed.
- [ ] My code has detailed inline documentation.
- [ ] My code is tested to the best of my abilities.
- [ ] My code passes all lints, tests, and checks.
50 changes: 25 additions & 25 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
version: 2

updates:
# Composer: 1x weekly for minor/patch, 1x monthly for major.
- package-ecosystem: 'composer'
# Update all GitHub Actions together. If CI passes, you know it's working.
- package-ecosystem: github-actions
directory: '/'
schedule:
interval: 'weekly'
interval: weekly
open-pull-requests-limit: 10
labels:
- Dependencies
groups:
github-actions-updates:
patterns: ['*']

- package-ecosystem: composer
directory: '/'
schedule:
interval: weekly
open-pull-requests-limit: 10
cooldown:
semver-major-days: 30
semver-minor-days: 7
semver-patch-days: 7
versioning-strategy: increase
labels:
- Dependencies
groups:
composer-dev-minor-patch:
dependency-type: 'development'
update-types: [minor, patch]
composer-dev-major:
dependency-type: 'development'
update-types: [major]
composer-minor-patch:
dependency-type: 'production'
update-types: [minor, patch]
# We don't bundle minor or major production assets, so they're tested individually.
composer-patch:
dependency-type: 'production'
update-types: [patch]

# NPM: 1x weekly for minor/patch, 1x monthly for major.
- package-ecosystem: 'npm'
directories:
- '/'
# @todo add other plugin directories when their dependency trees are stabilized.
- package-ecosystem: npm
directory: '/'
schedule:
interval: 'weekly'
interval: weekly
open-pull-requests-limit: 10
cooldown:
semver-major-days: 30
semver-minor-days: 7
semver-patch-days: 7
versioning-strategy: increase
labels:
- Dependencies
groups:
npm-dev-minor-patch:
dependency-type: 'development'
update-types: [minor, patch]
npm-prod-minor-patch:
dependency-type: 'production'
update-types: [minor, patch]

# GitHub Actions: 1x weekly.
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'weekly'
groups:
github-actions-updates:
patterns: ['*']
78 changes: 78 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# GitHub Workflows

Workflows are defined to be reusable and modular.

### Code Review: [`ci.yml`](ci.yml)

Main CI pipeline used to validate code. Based on file changes it calls the following reusable workflows:

| Reusable Workflow | What |
| --------------------------------------- | ----------------------------------------- |
| `reusable-phpcs.yml` | PHPCS linting |
| `reusable-phpstan.yml` | PHPStan static analysis |
| `reusable-phpunit.yml` | PHPUnit tests |
| `reusable-lint-css-js.yml` | ESlint, Stylelint, Prettier, tsc linting |
| `reusable-jest.yml` | Jest tests |
| `reusable-e2e.yml` | Playwright end-to-end tests |
| `reusable-build.yml` | Creates a build zip (used by playground) |
| `reusable-wp-playground-pr-preview.yml` | PR preview environment with wp-playground |

### `copilot-setup-steps.yml`

Sets up dev environment for GitHub Copilot coding agent.

### `pr-title.yml`

Triggers on PRs. Validates [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/) format, required for release-please automation.

### `release.yml`

Triggers on push to `main`. Uses [release-please](https://github.com/googleapis/release-please) to automate releases based on conventional commits.

When a release is created, it builds the plugin via `reusable-build.yml` and uploads the zip artifact to the GitHub release.

## Configuration

1. `php-version`
2. `ci.yml:phpunit` matrix.

### Secrets

| Secret | Required By | Notes |
| --------------- | ------------------------------------------- | ---------------------------------------------------- |
| `CODECOV_TOKEN` | `reusable-phpunit.yml`, `reusable-jest.yml` | Optional — coverage uploads fail silently without it |

### PR Previews

WordPress Playground requires a public URL for the plugin zip. By default, the GitHub action will attach release assets to the `ci-artifacts` release; after the first run, a draft release will be created which you must publish (as a pre-release) before PR Previews will work.

For private repositories, you can configure [`WordPress/action-wp-playground-pr-preview/.github/actions/expose-artifact-on-public-url`](https://github.com/WordPress/action-wp-playground-pr-preview) to expose the artifact on a publicly accessible URL without needing to publish a release, e.g. an S3 bucket or temporary server.

### Testing Workflows Locally

You can use [act](https://github.com/nektos/act) to test GitHub workflows locally. The examples below use inline inputs and inline secrets only (no external JSON or .env files).

```bash
# List workflows available in this repo
act -l

# Run the full CI as a push event (map ubuntu-24.04 to an act-compatible image)
act push -P ubuntu-24.04=catthehacker/ubuntu:act-latest

# Run the `detect` job for a pull request event
act pull_request -j detect -P ubuntu-24.04=catthehacker/ubuntu:act-latest

# Trigger `ci.yml` via workflow_dispatch and run the `phpunit` job with specific inputs and secrets
act workflow_dispatch \
--input php-version=8.2 \
--input wp-version=latest \
--input coverage=true \
-j phpunit \
-s CODECOV_TOKEN=your_codecov_token_here \
-s GITHUB_TOKEN=your_github_token_here \
-P ubuntu-24.04=catthehacker/ubuntu:act-latest
```

## Private Runners

@todo
Loading
Loading