Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixarntz committed Oct 29, 2023
0 parents commit c9e2dff
Show file tree
Hide file tree
Showing 29 changed files with 37,891 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/

root = true

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

[*.md]
trim_trailing_whitespace = false
indent_style = space
indent_size = 2

[*.txt]
trim_trailing_whitespace = false

[*.json]
insert_final_newline = false
indent_style = space
indent_size = 2

[.*rc]
insert_final_newline = false
indent_style = space
indent_size = 2

[*.yml]
insert_final_newline = false
indent_style = space
indent_size = 2
14 changes: 14 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* External dependencies
*/
const wpConfig = require( '@wordpress/scripts/config/.eslintrc.js' );

const config = {
...wpConfig,
rules: {
...( wpConfig?.rules || {} ),
'no-var': 'off',
},
};

module.exports = config;
31 changes: 31 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/.git export-ignore
/.github export-ignore
/.wordpress-org export-ignore
/build-cs export-ignore
/node_modules export-ignore
/tests export-ignore
/vendor export-ignore

/*.DS_store export-ignore
/.DS_store? export-ignore

/.editorconfig export-ignore
/.eslintrc.js export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.nvmrc export-ignore
/.prettierignore export-ignore
/.wp-env.json export-ignore
/composer.json export-ignore
/composer.lock export-ignore
/package-lock.json export-ignore
/package.json export-ignore
/phpcs.xml.dist export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/webpack.config.js export-ignore

/CODE_OF_CONDUCT.md export-ignore
/CONTRIBUTING.md export-ignore
/SECURITY.md export-ignore
/README.md export-ignore
46 changes: 46 additions & 0 deletions .github/workflows/deploy-dotorg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Deploy to WordPress.org

on:
release:
types:
- published
workflow_dispatch:

jobs:
release:
name: New Release${{ github.event_name == 'workflow_dispatch' && ' (dry run)' || '' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Get plugin version
id: get-version
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo "version=$(awk '/Stable tag: /{print $NF}' readme.txt)" >> $GITHUB_OUTPUT
- name: WordPress plugin deploy
uses: 10up/action-wordpress-plugin-deploy@stable
if: ${{ github.event_name == 'workflow_dispatch' }}
with:
dry-run: true
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SLUG: fast-smooth-scroll
VERSION: ${{ steps.get-version.outputs.version }}

- name: WordPress plugin deploy
uses: 10up/action-wordpress-plugin-deploy@stable
if: ${{ github.event_name != 'workflow_dispatch' }}
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SLUG: fast-smooth-scroll

- name: Upload release assets
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{github.workspace}}/${{ github.event.repository.name }}.zip
58 changes: 58 additions & 0 deletions .github/workflows/js-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: JS Code Linting

on:
push:
branches:
- main
# Only run if JS/JSON/Lint/NVM files changed.
paths:
- '.github/workflows/js-lint.yml'
- '**.js'
- '**.json'
- '.eslint*'
- '.nvmrc'
- '.prettierignore'
- '.wp-env.json'
- '**/package.json'
- 'package-lock.json'
pull_request:
branches:
- main
- 'feature/**'
# Only run if JS/JSON/Lint/NVM files changed.
paths:
- '.github/workflows/js-lint.yml'
- '**.js'
- '**.json'
- '.eslint*'
- '.nvmrc'
- '.prettierignore'
- '.wp-env.json'
- '**/package.json'
- 'package-lock.json'
types:
- opened
- reopened
- synchronize

jobs:
js-lint:
name: JS Lint
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: styfle/cancel-workflow-action@0.11.0

- uses: actions/checkout@v3

- name: Setup Node.js (via .nvmrc)
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: npm

- name: npm install
run: npm ci

- name: JS Lint
run: npm run lint-js
57 changes: 57 additions & 0 deletions .github/workflows/php-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: PHP Code Linting

on:
push:
branches:
- main
# Only run if PHP-related files changed.
paths:
- '.github/workflows/php-lint.yml'
- '**.php'
- 'phpcs.xml.dist'
- 'phpstan.neon.dist'
- 'composer.json'
- 'composer.lock'
pull_request:
branches:
- main
- 'feature/**'
# Only run if PHP-related files changed.
paths:
- '.github/workflows/php-lint.yml'
- '**.php'
- 'phpcs.xml.dist'
- 'phpstan.neon.dist'
- 'composer.json'
- 'composer.lock'
types:
- opened
- reopened
- synchronize

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
php-lint:
name: PHP
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: styfle/cancel-workflow-action@0.11.0

- uses: actions/checkout@v3

- uses: shivammathur/setup-php@v2
with:
php-version: '8.0'

- name: Validate Composer configuration
run: composer validate

- name: PHP Lint
run: composer lint

- name: PHPStan
run: composer phpstan
93 changes: 93 additions & 0 deletions .github/workflows/php-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: PHP Unit Testing

on:
push:
branches:
- main
# Only run if PHP-related files changed.
paths:
- '.github/workflows/php-test.yml'
- '**.php'
- '.wp-env.json'
- '**/package.json'
- 'package-lock.json'
- 'phpunit.xml.dist'
- 'composer.json'
- 'composer.lock'
pull_request:
branches:
- main
- 'feature/**'
# Only run if PHP-related files changed.
paths:
- '.github/workflows/php-test.yml'
- '**.php'
- '.wp-env.json'
- '**/package.json'
- 'package-lock.json'
- 'phpunit.xml.dist'
- 'composer.json'
- 'composer.lock'
types:
- opened
- reopened
- synchronize

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
php-test:
name: PHP ${{ matrix.php }} - WP ${{ matrix.wordpress }}${{ matrix.experimental && ' (experimental)' || '' }}
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: true
matrix:
php:
- '7.0'
- '7.4'
- '8.0'
- '8.1'
- '8.2'
wordpress: [ 'latest' ]
experimental: [false]
include:
- php: '5.2'
wordpress: '5.0'
- php: '5.6'
wordpress: '5.2'
- php: '8.2'
wordpress: 'trunk'
experimental: true
env:
WP_ENV_PHP_VERSION: ${{ matrix.php }}
WP_ENV_CORE: ${{ matrix.wordpress == 'trunk' && 'WordPress/WordPress' || format( 'https://wordpress.org/wordpress-{0}.zip', matrix.wordpress ) }}
continue-on-error: ${{ matrix.experimental == true }}
steps:
- uses: styfle/cancel-workflow-action@0.11.0

- uses: actions/checkout@v3

- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}

- name: Setup Node.js (.nvmrc)
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: npm

- name: npm install
run: npm ci

- name: Install WordPress
run: npm run wp-env start

- name: Running PHPUnit tests
run: npm run test-php

- name: Running PHPUnit tests for multisite
run: npm run test-php-multisite
Loading

0 comments on commit c9e2dff

Please sign in to comment.