Skip to content

Commit

Permalink
Merge branch 'trunk' into patch-3
Browse files Browse the repository at this point in the history
# Conflicts:
#	bin/acceptance-tests
#	bin/integration-tests
  • Loading branch information
johnbillion committed Aug 10, 2024
2 parents 47232ad + 91d0c52 commit ac0c932
Show file tree
Hide file tree
Showing 24 changed files with 487 additions and 186 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/actions.yml → .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow

name: Actions
name: Lint
on:
pull_request: null
push:
Expand All @@ -18,11 +18,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Checkout repository
uses: actions/checkout@v3

- name: Run actionlint
uses: docker://rhysd/actionlint:latest
with:
args: "-color -verbose -shellcheck ''"
- name: Run actionlint
uses: docker://rhysd/actionlint:latest
with:
args: "-color -verbose -shellcheck="
24 changes: 15 additions & 9 deletions .github/workflows/reusable-acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ on:
wp:
required: true
type: string
description: WordPress version to use in major.minor format (e.g. 6.4), or "latest" or "nightly"
php:
required: true
type: string
description: PHP version to use in major.minor format (e.g. 8.0)
node:
required: false
required: true
type: boolean
default: true
description: Whether to run the Node build step

jobs:
test:
Expand All @@ -27,10 +29,10 @@ jobs:
LOCAL_WP_DEBUG: ${{ inputs.php < 8.1 && 1 || 0 }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Configure environment variables
run: |
run: | #shell
echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV
echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
Expand All @@ -50,28 +52,32 @@ jobs:
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Composer cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: 8.0-composer-${{ hashFiles('composer.json') }}

- name: Install Composer dependencies
run: |
run: | #shell
if [ "${{ inputs.wp }}" == "latest" ]; then
composer install --dev --prefer-dist
elif [ "${{ inputs.wp }}" == "nightly" ]; then
composer require --dev --update-with-dependencies --prefer-dist roots/wordpress-full="dev-main"
else
elif [[ "${{ inputs.wp }}" =~ ^[0-9]\.[0-9]$ ]]; then
composer require --dev --update-with-dependencies --prefer-dist roots/wordpress-full="~${{ inputs.wp }}.0"
else
composer require --dev --update-with-dependencies --prefer-dist roots/wordpress-full="${{ inputs.wp }}"
fi
- name: Setup node
uses: actions/setup-node@v3
if: ${{ inputs.node }}
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: npm

- name: Install node dependencies
if: ${{ inputs.node }}
run: npm ci

- name: Run the build
Expand All @@ -89,7 +95,7 @@ jobs:

- name: Upload test artifacts
if: failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: acceptance-wp-${{ inputs.wp }}-php-${{ inputs.php }}
path: tests/_output
46 changes: 35 additions & 11 deletions .github/workflows/reusable-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ on:
workflow_call:
inputs:
node:
required: false
required: true
type: boolean
default: true
description: Whether to run the Node build step and add the assets to the commit
vendor:
required: false
required: true
type: boolean
default: true
description: Whether to generate the Composer autoloader files and add them to the commit
tag:
required: true
type: boolean
description: Whether to tag the release

jobs:
build:
Expand All @@ -22,7 +26,7 @@ jobs:
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install PHP
if: ${{ inputs.vendor }}
Expand All @@ -37,39 +41,59 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Setup node
uses: actions/setup-node@v3
if: ${{ inputs.node }}
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: npm

- name: Install Dependencies
if: ${{ inputs.node }}
run: npm ci

- name: Generate autoload file
if: ${{ inputs.vendor }}
run: |
run: | #shell
composer install
composer run build-vendor
git add -f vendor/autoload.php
git add -f vendor/composer/*
- name: Build Assets
if: ${{ inputs.node }}
run: |
run: | #shell
npm run build
git add -f assets/*
- name: Setup version
run: echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV

- name: Tag
run: |
echo "Releasing version $VERSION ..."
- name: Commit
run: | #shell
echo 'Committing ...'
git config user.name github-actions
git config user.email github-actions@github.com
git checkout -b "release-$VERSION"
git commit -m "Release $VERSION"
git push origin -f "release-$VERSION"
- name: Tag
if: ${{ inputs.tag }}
run: | #shell
echo "Releasing version $VERSION ..."
git tag "$VERSION"
git push --tags
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create zip file
if: always()
id: create-zip
run: git archive --format=zip --output=build.zip HEAD

- name: Upload zip
uses: actions/upload-artifact@v4
with:
name: build
path: build.zip
if: always() && steps.create-zip.outcome == 'success'
11 changes: 6 additions & 5 deletions .github/workflows/reusable-coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
php:
required: true
type: string
description: PHP version to use in major.minor format (e.g. 8.0)

jobs:
test:
Expand All @@ -17,10 +18,10 @@ jobs:
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Configure environment variables
run: |
run: | #shell
echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV
echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
Expand All @@ -40,19 +41,19 @@ jobs:
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Composer cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ inputs.php }}-composer-${{ hashFiles('composer.json') }}

- name: PHPCS and PHPStan cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: tests/cache
key: ${{ inputs.php }}-phpcs-${{ hashFiles('composer.json') }}

- name: Debugging
run: |
run: | #shell
php --version
composer --version
Expand Down
31 changes: 17 additions & 14 deletions .github/workflows/reusable-deploy-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@ on:
plugin:
required: true
type: string
description: The plugin slug
readme:
required: true
type: string
description: The plugin readme file name, either readme.md or readme.txt
node:
required: false
required: true
type: boolean
default: true
description: Whether to run the Node build step and add the assets to the commit
vendor:
required: false
required: true
type: boolean
default: true
description: Whether to generate the Composer autoloader files and add them to the commit
secrets:
WPORG_SVN_USERNAME:
required: true
Expand All @@ -33,7 +35,7 @@ jobs:
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install PHP
if: ${{ inputs.vendor }}
Expand All @@ -48,44 +50,45 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: npm

- name: Install Dependencies
- name: Install Node Dependencies
run: npm ci

- name: Install Composer Dependencies
run: composer install

- name: Generate autoload file
if: ${{ inputs.vendor }}
run: |
composer install
run: | #shell
composer run build-vendor
git add -f vendor/autoload.php
git add -f vendor/composer/*
- name: Build Assets
if: ${{ inputs.node }}
run: |
run: | #shell
npm run build
git add -f assets/*
- name: Populate Changelog
run: |
run: | #shell
node vendor/johnbillion/plugin-infrastructure/bin/changelog.js ${{ inputs.readme }}
git add ${{ inputs.readme }}
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Commit
run: |
run: | #shell
git config user.name github-actions
git config user.email github-actions@github.com
git commit -m "Assets"
- name: WordPress Plugin Deploy
uses: 10up/action-wordpress-plugin-asset-update@1.4.1
uses: 10up/action-wordpress-plugin-asset-update@2.1.2
env:
SVN_USERNAME: ${{ secrets.WPORG_SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.WPORG_SVN_PASSWORD }}
README_NAME: ${{ inputs.readme }}
Loading

0 comments on commit ac0c932

Please sign in to comment.