Skip to content

Commit

Permalink
Merge branch 'main' into refactor/default-php-8-2
Browse files Browse the repository at this point in the history
Signed-off-by: Philipp Bammes <[email protected]>
  • Loading branch information
tyrann0us authored Oct 2, 2024
2 parents 4155744 + ea75eb2 commit c6cb1de
Show file tree
Hide file tree
Showing 16 changed files with 661 additions and 494 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/build-and-push-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:
type: string
PACKAGE_MANAGER:
description: Package manager with which the dependencies should be installed (`npm` or `yarn`).
default: 'yarn'
default: 'npm'
required: false
type: string
WORKING_DIRECTORY:
Expand Down Expand Up @@ -146,6 +146,15 @@ jobs:
TAG_BRANCH_NAME: '' # we'll override if the push is for tag
NO_CHANGES: '' # we'll override if no changes to commit
steps:
- name: PACKAGE_MANAGER deprecation warning
if: ${{ inputs.PACKAGE_MANAGER != '' }}
run: |
if [ "${{ inputs.PACKAGE_MANAGER }}" == 'npm' ]; then
echo "::warning::The PACKAGE_MANAGER input is deprecated and will be removed soon. Please remove it. The workflow already uses npm by default."
else
echo "::warning::The PACKAGE_MANAGER input is deprecated and will be removed soon. Please update your workflow to use npm."
fi
- name: Checkout
uses: actions/checkout@v4
with:
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/build-assets-compilation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:
type: string
PACKAGE_MANAGER:
description: Package manager with which the dependencies should be installed (`npm` or `yarn`).
default: 'yarn'
default: 'npm'
required: false
type: string
PHP_VERSION:
Expand Down Expand Up @@ -71,6 +71,15 @@ jobs:
GITHUB_USER_NAME: ${{ secrets.GITHUB_USER_NAME }}
GITHUB_USER_SSH_KEY: ${{ secrets.GITHUB_USER_SSH_KEY }}
steps:
- name: PACKAGE_MANAGER deprecation warning
if: ${{ inputs.PACKAGE_MANAGER != '' }}
run: |
if [ "${{ inputs.PACKAGE_MANAGER }}" == 'npm' ]; then
echo "::warning::The PACKAGE_MANAGER input is deprecated and will be removed soon. Please remove it. The workflow already uses npm by default."
else
echo "::warning::The PACKAGE_MANAGER input is deprecated and will be removed soon. Please update your workflow to use npm."
fi
- name: Checkout
uses: actions/checkout@v4

Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/build-plugin-archive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:
type: string
PACKAGE_MANAGER:
description: Package manager with which the dependencies should be installed (`npm` or `yarn`).
default: 'yarn'
default: 'npm'
required: false
type: string
COMPOSER_ARGS:
Expand Down Expand Up @@ -147,6 +147,15 @@ jobs:
outputs:
artifact: ${{ steps.set-artifact-name.outputs.artifact }}
steps:
- name: PACKAGE_MANAGER deprecation warning
if: ${{ inputs.PACKAGE_MANAGER != '' }}
run: |
if [ "${{ inputs.PACKAGE_MANAGER }}" == 'npm' ]; then
echo "::warning::The PACKAGE_MANAGER input is deprecated and will be removed soon. Please remove it. The workflow already uses npm by default."
else
echo "::warning::The PACKAGE_MANAGER input is deprecated and will be removed soon. Please update your workflow to use npm."
fi
- name: Download Artifact
uses: actions/download-artifact@v4
with:
Expand Down Expand Up @@ -229,7 +238,7 @@ jobs:
if: steps.composer-tools.outputs.rector == '0'
run: |
rector
- name: Run PHP-Scoper
if: steps.composer-tools.outputs.php-scoper == '0'
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ddev-playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ on:
required: false
type: string
PLAYWRIGHT_INSTALL_CMD:
description: The command for installing Playwright and its dependencies, such as `yarn install && yarn playwright install --with-deps` or `ddev pw-install-host` from inpsyde/ddev-wordpress-plugin-template.
description: The command for installing Playwright and its dependencies, such as `npm install && npx playwright install --with-deps` or `ddev pw-install-host` from inpsyde/ddev-wordpress-plugin-template.
required: true
type: string
PLAYWRIGHT_RUN_CMD:
description: The command for running Playwright tests, such as `yarn playwright test` or `ddev pw-host test` from inpsyde/ddev-wordpress-plugin-template.
description: The command for running Playwright tests, such as `npx playwright test` or `ddev pw-host test` from inpsyde/ddev-wordpress-plugin-template.
required: true
type: string
PLAYWRIGHT_DIR:
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/lint-workflows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Lint GitHub Actions workflows

on:
push:
paths:
- '**.yml'
pull_request:
workflow_dispatch:
workflow_call:

jobs:
actionlint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up problem matchers for actionlint
run: |
curl -s -o actionlint-matcher.json https://raw.githubusercontent.com/rhysd/actionlint/main/.github/actionlint-matcher.json
echo "::add-matcher::${GITHUB_WORKSPACE}/actionlint-matcher.json"
- name: Run actionlint
uses: docker://rhysd/actionlint:latest
with:
args: -color -pyflakes= -shellcheck=
11 changes: 10 additions & 1 deletion .github/workflows/tests-unit-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:
type: string
PACKAGE_MANAGER:
description: Package manager with which the dependencies should be installed (`npm` or `yarn`).
default: 'yarn'
default: 'npm'
required: false
type: string
NODE_OPTIONS:
Expand Down Expand Up @@ -57,6 +57,15 @@ jobs:
GITHUB_USER_NAME: ${{ secrets.GITHUB_USER_NAME }}
GITHUB_USER_SSH_KEY: ${{ secrets.GITHUB_USER_SSH_KEY }}
steps:
- name: PACKAGE_MANAGER deprecation warning
if: ${{ inputs.PACKAGE_MANAGER != '' }}
run: |
if [ "${{ inputs.PACKAGE_MANAGER }}" == 'npm' ]; then
echo "::warning::The PACKAGE_MANAGER input is deprecated and will be removed soon. Please remove it. The workflow already uses npm by default."
else
echo "::warning::The PACKAGE_MANAGER input is deprecated and will be removed soon. Please update your workflow to use npm."
fi
- name: Checkout
uses: actions/checkout@v4

Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/wp-scripts-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:
type: string
PACKAGE_MANAGER:
description: Package manager with which the dependencies should be installed (`npm` or `yarn`).
default: 'yarn'
default: 'npm'
required: false
type: string
LINT_TOOLS:
Expand Down Expand Up @@ -78,6 +78,15 @@ jobs:
GITHUB_USER_NAME: ${{ secrets.GITHUB_USER_NAME }}
GITHUB_USER_SSH_KEY: ${{ secrets.GITHUB_USER_SSH_KEY }}
steps:
- name: PACKAGE_MANAGER deprecation warning
if: ${{ inputs.PACKAGE_MANAGER != '' }}
run: |
if [ "${{ inputs.PACKAGE_MANAGER }}" == 'npm' ]; then
echo "::warning::The PACKAGE_MANAGER input is deprecated and will be removed soon. Please remove it. The workflow already uses npm by default."
else
echo "::warning::The PACKAGE_MANAGER input is deprecated and will be removed soon. Please update your workflow to use npm."
fi
- name: Checkout
uses: actions/checkout@v4

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ groups here:

* Assets linting and formatting with [`@wordpress/scripts`](./docs/wp-scripts.md)
* Linting, formatting, and testing tools for [PHP](./docs/php.md)
* [Linting GitHub Actions workflow files](./docs/lint-workflows.md)
* Unit tests for [JavaScript](./docs/js.md)
* Assets compilation with [Composer Asset Compiler](./docs/assets-compilation.md) or
the [Build and push](./docs/build-and-push-assets.md) approach
Expand Down
1 change: 0 additions & 1 deletion docs/archive-creation.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ jobs:
| `NODE_OPTIONS` | `''` | Space-separated list of command-line Node options |
| `NODE_VERSION` | `18` | Node version with which the assets will be compiled |
| `NPM_REGISTRY_DOMAIN` | `'https://npm.pkg.github.com/'` | Domain of the private npm registry |
| `PACKAGE_MANAGER` | `'yarn'` | Package manager with which the dependencies should be installed (`npm` or `yarn`) |
| `COMPOSER_ARGS` | `'--no-dev --no-scripts --prefer-dist --optimize-autoloader'` | Set of arguments passed to Composer when gathering production dependencies |
| `PHP_VERSION` | `'8.2'` | PHP version to use when gathering production dependencies |
| `PHP_VERSION_BUILD` | `'8.2'` | PHP version to use when executing build tools |
Expand Down
17 changes: 8 additions & 9 deletions docs/assets-compilation.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@ jobs:
### Inputs
| Name | Default | Description |
|-----------------------|---------------------------------|-----------------------------------------------------------------------------------|
| `NODE_OPTIONS` | `''` | Space-separated list of command-line Node options |
| `NODE_VERSION` | `18` | Node version with which the assets will be compiled |
| `NPM_REGISTRY_DOMAIN` | `'https://npm.pkg.github.com/'` | Domain of the private npm registry |
| `PACKAGE_MANAGER` | `'yarn'` | Package manager with which the dependencies should be installed (`npm` or `yarn`) |
| `PHP_VERSION` | `'8.2'` | PHP version with which the assets compilation is to be executed |
| `COMPOSER_ARGS` | `'--prefer-dist'` | Set of arguments passed to Composer |
| `COMPILE_ASSETS_ARGS` | `'-v --env=root'` | Set of arguments passed to Composer Asset Compiler |
| Name | Default | Description |
|-----------------------|---------------------------------|-----------------------------------------------------------------|
| `NODE_OPTIONS` | `''` | Space-separated list of command-line Node options |
| `NODE_VERSION` | `18` | Node version with which the assets will be compiled |
| `NPM_REGISTRY_DOMAIN` | `'https://npm.pkg.github.com/'` | Domain of the private npm registry |
| `PHP_VERSION` | `'8.2'` | PHP version with which the assets compilation is to be executed |
| `COMPOSER_ARGS` | `'--prefer-dist'` | Set of arguments passed to Composer |
| `COMPILE_ASSETS_ARGS` | `'-v --env=root'` | Set of arguments passed to Composer Asset Compiler |

### Secrets

Expand Down
1 change: 0 additions & 1 deletion docs/build-and-push-assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ the workflow.
| `NODE_OPTIONS` | `''` | Space-separated list of command-line Node options |
| `NODE_VERSION` | `18` | Node version with which the assets will be compiled |
| `NPM_REGISTRY_DOMAIN` | `'https://npm.pkg.github.com/'` | Domain of the private npm registry |
| `PACKAGE_MANAGER` | `'yarn'` | Package manager with which the dependencies should be installed (`npm` or `yarn`) |
| `WORKING_DIRECTORY` | `'./'` | Working directory path |
| `COMPILE_SCRIPT_PROD` | `'build'` | Script added to `npm run` or `yarn` to build production assets |
| `COMPILE_SCRIPT_DEV` | `'build:dev'` | Script added to `npm run` or `yarn` to build development assets |
Expand Down
11 changes: 5 additions & 6 deletions docs/js.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ jobs:
#### Inputs
| Name | Default | Description |
|-----------------------|----------------------------------------------------|-----------------------------------------------------------------------------------|
| `NPM_REGISTRY_DOMAIN` | `'https://npm.pkg.github.com/'` | Domain of the private npm registry |
| `NODE_VERSION` | `18` | Node version with which the unit tests are to be executed |
| `JEST_ARGS` | `'--reporters=default --reporters=github-actions'` | Set of arguments passed to Jest |
| `PACKAGE_MANAGER` | `'yarn'` | Package manager with which the dependencies should be installed (`npm` or `yarn`) |
| Name | Default | Description |
|-----------------------|----------------------------------------------------|-----------------------------------------------------------|
| `NPM_REGISTRY_DOMAIN` | `'https://npm.pkg.github.com/'` | Domain of the private npm registry |
| `NODE_VERSION` | `18` | Node version with which the unit tests are to be executed |
| `JEST_ARGS` | `'--reporters=default --reporters=github-actions'` | Set of arguments passed to Jest |

**Note**: The default `github-actions` reporter requires Jest 28 or higher.

Expand Down
15 changes: 15 additions & 0 deletions docs/lint-workflows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Lint GitHub Actions workflows

This workflow runs [actionlint](https://github.com/rhysd/actionlint). It does so by executing the
linter inside a Docker container using the official `actionlint` Docker image.

**Example:**

```yml
name: Lint GitHub Actions workflows
on:
pull_request:
jobs:
lint-workflows:
uses: inpsyde/reusable-workflows/.github/workflows/lint-workflows.yml@main
```
21 changes: 10 additions & 11 deletions docs/wp-scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,16 @@ jobs:
#### Inputs
| Name | Default | Description |
|-------------------------|---------------------------------|-----------------------------------------------------------------------------------|
| `NODE_OPTIONS` | `''` | Space-separated list of command-line Node options |
| `NODE_VERSION` | `18` | Node version with which the assets will be compiled |
| `NPM_REGISTRY_DOMAIN` | `'https://npm.pkg.github.com/'` | Domain of the private npm registry |
| `PACKAGE_MANAGER` | `'yarn'` | Package manager with which the dependencies should be installed (`npm` or `yarn`) |
| `LINT_TOOLS` | `'["js", "style", "md-docs"]'` | Array of checks to be executed by @wordpress/scripts |
| `ESLINT_ARGS` | `''` | Set of arguments passed to `wp-script lint-js` |
| `STYLELINT_ARGS` | `''` | Set of arguments passed to `wp-script lint-style` |
| `MARKDOWNLINT_ARGS` | `''` | Set of arguments passed to `wp-script lint-md-docs` |
| `PACKAGE_JSONLINT_ARGS` | `''` | Set of arguments passed to `wp-scripts lint-pkg-json` |
| Name | Default | Description |
|-------------------------|---------------------------------|-------------------------------------------------------|
| `NODE_OPTIONS` | `''` | Space-separated list of command-line Node options |
| `NODE_VERSION` | `18` | Node version with which the assets will be compiled |
| `NPM_REGISTRY_DOMAIN` | `'https://npm.pkg.github.com/'` | Domain of the private npm registry |
| `LINT_TOOLS` | `'["js", "style", "md-docs"]'` | Array of checks to be executed by @wordpress/scripts |
| `ESLINT_ARGS` | `''` | Set of arguments passed to `wp-script lint-js` |
| `STYLELINT_ARGS` | `''` | Set of arguments passed to `wp-script lint-style` |
| `MARKDOWNLINT_ARGS` | `''` | Set of arguments passed to `wp-script lint-md-docs` |
| `PACKAGE_JSONLINT_ARGS` | `''` | Set of arguments passed to `wp-scripts lint-pkg-json` |

> :information_source: **By default, "pkg-json" is not part of the `LINT_TOOLS` input.**
> :information_source: **The `--formatter github` flag is hardcoded into the `wp-script lint-style`
Expand Down
Loading

0 comments on commit c6cb1de

Please sign in to comment.