Skip to content

Commit

Permalink
Merge branch 'master' into feature/issue-948
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/Repository/Booking.php
#	tests/php/Repository/BookingTest.php
  • Loading branch information
hansmorb committed Nov 8, 2023
2 parents db9d2ab + 9821289 commit 14ab861
Show file tree
Hide file tree
Showing 96 changed files with 9,989 additions and 6,164 deletions.
42 changes: 42 additions & 0 deletions .github/actions/build-plugin/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: 'Build Plugin'
description: 'Builds plugin into ./build/commonsbooking'

runs:
using: "composite"
steps:

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

- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0.6' # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- run: gem install compass
shell: bash

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: |
composer install --no-dev --prefer-dist --no-progress
shell: bash

- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci --legacy-peer-deps --include=dev
shell: bash

- name: Run build script
run: bin/build-zip.sh --skip-zip
shell: bash
21 changes: 21 additions & 0 deletions .github/workflows/build-rc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Build zip from release branch
on:
push:
branches:
- 'release/**'

jobs:
zip-rc:
runs-on: ubuntu-20.04
steps:

- uses: actions/checkout@v3

- uses: ./.github/actions/build-plugin

- name: Generate zip
uses: 10up/action-wordpress-plugin-build-zip@stable
env:
SLUG: commonsbooking
BUILD_DIR: ./build/commonsbooking

37 changes: 0 additions & 37 deletions .github/workflows/build-release.yml

This file was deleted.

80 changes: 80 additions & 0 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Compile changes
on:
push:
branches:
- master
- 'release/**'
paths-ignore:
- '**.md'
- '**.txt'

jobs:
i18n-coverage:
runs-on: ubuntu-20.04
name: Check i18n coverage
steps:
- uses: actions/checkout@v3

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

- name: Install WP-CLI
run: |
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
- name: Generate pot files
run: bin/update-pot.sh

- name: Commit changes
uses: elstudio/actions-js-build/commit@v4
with:
commitMessage: Ran wp i18n make-pot

- name: Check i18n coverage
uses: alexkiro/i18n-coverage@v1.0.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
translations-path: 'languages/*.po'
ignore-languages: 'en'

grunt:
runs-on: ubuntu-20.04
name: Run grunt and commit changes
needs: i18n-coverage
steps:

- uses: actions/checkout@v3

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

- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0.6' # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- run: gem install compass

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

- run: npm ci --legacy-peer-deps --include=dev

- name: Validate composer.json and composer.lock
run: composer validate


- name: Compile with Grunt
uses: elstudio/actions-js-build/build@v4
with:
args: build

- name: Commit changes
uses: elstudio/actions-js-build/commit@v4
with:
commitMessage: Ran grunt
57 changes: 31 additions & 26 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,52 @@ name: E2E Tests

on:
push:
branches:
- 'master'
- 'release/**'
paths-ignore:
- '**.md'
- '**.txt'
pull_request:
branches:
- 'master'


env:
DB_DATABASE: wordpress_test
DB_USER: root
DB_PASSWORD: ''

jobs:
build:

e2e:
name: 'WP ${{ matrix.core.name }} on PHP ${{ matrix.php }}'
runs-on: ubuntu-20.04

strategy:
fail-fast: false
matrix:
php:
- '7.4'
- '8.2'
core:
- {name: 'tested', version: 'null'}
- {name: 'minimum', version: 'WordPress/WordPress#5.6'}
- {name: 'trunk', version: 'WordPress/WordPress#master'}

steps:
- uses: actions/checkout@v3

- uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- uses: ./.github/actions/build-plugin

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: |
composer install --no-dev --prefer-dist --no-progress
- name: Overwrite PHP versions & core for wp-env
if: matrix.core.version != 'null'
run: jq '. + {"phpVersion":"${{ matrix.php }}","core":"${{ matrix.core.version }}"}' tests/cypress/wordpress-files/e2e-override.json > .wp-env.override.json
- name: setup wp env
run: npm run env:start

- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci --legacy-peer-deps --include=dev
- run: docker-compose -v
- name: Overwrite PHP version for wp-env
if: matrix.core.version == 'null'
run: jq '. + {"phpVersion":"${{ matrix.php }}"}' tests/cypress/wordpress-files/e2e-override.json > .wp-env.override.json
- name: setup wp env
run: npm run env:start

Expand All @@ -57,7 +60,9 @@ jobs:
install: false
config-file: tests/cypress/cypress.config.js

- uses: actions/upload-artifact@v3
- name: Upload Cypress screenshots
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: cypress-screenshots
path: ${{ github.workspace }}/tests/cypress/screenshots/
name: cypress-screenshots-${{ matrix.php }}_${{ matrix.core.name }}
path: ${{ github.workspace }}/tests/cypress/screenshots/
28 changes: 22 additions & 6 deletions .github/workflows/php.yml → .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
name: PHP Unit Tests

on:
on:
push:
branches:
- 'master'
- 'release/**'
paths-ignore:
- '**.md'
- '**.txt'
pull_request:
branches:
- 'master'


env:
DB_DATABASE: wordpress_test
DB_USER: root
DB_PASSWORD: ''

jobs:
build:
phpunit:

runs-on: ubuntu-20.04

strategy:
matrix:
php:
- '7.4'
- '8.2'

steps:
- uses: actions/checkout@v3

Expand All @@ -28,7 +38,7 @@ jobs:
- uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: ${{ matrix.php }}
extensions: uopz

- name: Validate composer.json and composer.lock
Expand All @@ -43,18 +53,24 @@ jobs:
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
- name: Install dependencies (PHP 7.4)
if: matrix.php == '7.4'
run: |
bash bin/install-wp-tests.sh wordpress_test root root localhost latest
composer install --prefer-dist --no-progress
- name: Install dependencies (other PHP versions)
if: matrix.php != '7.4'
run: |
bash bin/install-wp-tests.sh wordpress_test root root localhost latest
composer install --prefer-dist --no-progress --ignore-platform-reqs
- name: Run test suite
run: |
composer dump-autoload -o
curl -ksSfL -o ~/phpunit-9.phar https://phar.phpunit.de/phpunit-9.phar
php ~/phpunit-9.phar --version
php ~/phpunit-9.phar
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Deploy to WordPress.org

on:
release:
types: [published]

jobs:
publish:
name: New Release
runs-on: ubuntu-20.04
steps:

- uses: actions/checkout@v3

- uses: ./.github/actions/build-plugin

- name: Check i18n coverage before release
uses: alexkiro/i18n-coverage@v1.0.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
translations-path: 'languages/*.po'
ignore-languages: 'en'
min-coverage: 100

- name: WordPress Plugin Deploy
uses: 10up/action-wordpress-plugin-deploy@stable
with:
dry-run: false
generate-zip: true
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
BUILD_DIR: build/commonsbooking
SLUG: commonsbooking # optional, remove if GitHub repo name matches SVN slug, including capitalization

- name: Upload release assets
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ steps.deploy.outputs.zip-path }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit 14ab861

Please sign in to comment.