Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions .docker/.env
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Docker only
PROJECT_NAME="theme-json-generator"
PHP_VERSION="7.4"
WP_VERSION="6.0"
PHP_VERSION="8.2"
WP_VERSION="6"

WP_PORT=8888
DB_PORT=8889
Expand Down
11 changes: 9 additions & 2 deletions .docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ services:
- ../tests/_output/:/var/www/html/wp-content/plugins/${PROJECT_NAME:-wordpress}/tests/_output/
- ./mu-plugins/:/var/www/html/wp-content/mu-plugins/
depends_on:
- mysql
mysql:
condition: service_healthy
networks:
integration_test_networks:

Expand All @@ -37,12 +38,18 @@ services:
MYSQL_PASSWORD: ${DB_PASSWORD:-root}
#MYSQL_RANDOM_ROOT_PASSWORD: '1'
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD:-root}
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-p${DB_PASSWORD:-root}"]
interval: 5s
timeout: 5s
retries: 30
networks:
- integration_test_networks

phpmyadmin:
depends_on:
- mysql
mysql:
condition: service_healthy
image: phpmyadmin/phpmyadmin:${PMA_VERSION:-latest}
container_name: ${PROJECT_NAME}_phpmyadmin_test
restart: always
Expand Down
9 changes: 7 additions & 2 deletions .docker/wordpress/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ RUN set -eux; \
apt-get update && apt-get install -y \
git \
nano \
less # Needed for the WP-CLI \
less \
unzip \
zip \
; \
rm -rf /var/lib/apt/lists/*

# Git add safe directory for the working directory
Expand All @@ -32,7 +35,9 @@ RUN set -eux; \
RUN docker-php-ext-install \
pdo_mysql

COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
RUN curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php && \
php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer && \
rm /tmp/composer-setup.php

RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && \
chmod +x wp-cli.phar && \
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: '8.2'

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

- name: Validate php files
run: find ./src/ ./tests/ -type f -name '*.php' -print0 | xargs -0 -L 1 -P 4 -- php -l

- uses: ramsey/composer-install@v2
- uses: ramsey/composer-install@v3

- name: Coding standard
run: composer run cs
run: composer run cs
12 changes: 6 additions & 6 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
paths:
- '**workflows/static-analysis.yml'
- '**.php'
- '**psalm.xml'
- '**phpstan.neon'
- '**composer.json'

jobs:
Expand All @@ -18,14 +18,14 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: '8.2'

- uses: ramsey/composer-install@v2
- uses: ramsey/composer-install@v3

- name: Psalm
run: vendor/bin/psalm
- name: PHPStan
run: composer stan
19 changes: 11 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: CI
name: Test

env:
PROJECT_KIND: plugins
DB_HOST: localhost
DB_HOST: 127.0.0.1
DB_NAME: test
DB_USER: root
DB_PASSWORD: root
Expand All @@ -28,19 +28,18 @@ on:

jobs:
tests:
name: 🐘 Tests on PHP ${{matrix.php_versions}} & APP version ${{matrix.app_versions}}
name: Tests on PHP ${{ matrix.php_versions }} & WordPress ${{ matrix.app_versions }}

strategy:
matrix:
php_versions: ['7.4', '8.0']
app_versions: ['6.0']
php_versions: ['8.2']
app_versions: ['6.9']

runs-on: ubuntu-latest
continue-on-error: ${{ matrix.php_versions == '8.0' }}
if: "!contains(github.event.head_commit.message, '--skip ci') && !github.event.pull_request.draft"

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down Expand Up @@ -74,7 +73,7 @@ jobs:
pwd
ls -la ${{env.APP_FOLDER_PATH}}/wp-includes

- uses: "ramsey/composer-install@v2"
- uses: "ramsey/composer-install@v3"
with:
working-directory: "${{env.APP_FOLDER_PATH}}/wp-content/${{env.PROJECT_KIND}}/${{ github.event.repository.name }}"

Expand All @@ -92,6 +91,10 @@ jobs:
- name: Verify MySQL is Running
run: sudo systemctl status mysql.service

- name: Configure Codeception database host
working-directory: ${{env.APP_FOLDER_PATH}}/wp-content/${{env.PROJECT_KIND}}/${{ github.event.repository.name }}
run: sed -i 's/DB_HOST="mysql"/DB_HOST="${{ env.DB_HOST }}"/' tests/.env

- name: Build codeception
working-directory: ${{env.APP_FOLDER_PATH}}/wp-content/${{env.PROJECT_KIND}}/${{ github.event.repository.name }}
run: ./vendor/bin/codecept build
Expand Down
22 changes: 11 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ cs/fix: up ### Run the code sniffer and fix the errors
@$(DOCKER_DIR) ./composer cs:fix
@$(FILES_OWNERSHIP)

# Psalm commands
.PHONY: psalm
psalm: up ### Run the psalm
@echo "Running the psalm"
@$(DOCKER_DIR) ./composer psalm
# PHPStan commands

.PHONY: stan
stan: up ### Run PHPStan
@echo "Running PHPStan"
@$(DOCKER_DIR) ./composer stan

# Codeception commands

Expand Down Expand Up @@ -137,8 +137,8 @@ acceptance: up ### Run the acceptance tests
.PHONY: tests
tests: unit integration functional ### Run unit and integration tests

.PHONY: qa
qa: cs psalm unit integration functional ### Run all the tests
.PHONY: qa
qa: cs stan unit integration functional ### Run all the tests

# Infection commands

Expand Down Expand Up @@ -180,9 +180,9 @@ docker/metrics: ### Run the phpmetrics
# PhpMetrics commands from composer

.PHONY: metrics
metrics: up ### Run the composer/metrics
@echo "Running the psalm"
@$(DOCKER_DIR) ./composer metrics
metrics: up ### Run the composer/metrics
@echo "Running phpmetrics"
@$(DOCKER_DIR) ./composer metrics

# Generate commands

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ This package adheres to the [SemVer](http://semver.org/) specification and will

Until the first stable version is released, BC breaks may occur.

`ItalyStrap\ThemeJsonGenerator\Application\Config\ThemeJson` to `\ItalyStrap\ThemeJsonGenerator\Domain\ThemeJson\ThemeJson`

[🆙](#table-of-contents)

## Contributing
Expand Down
1 change: 0 additions & 1 deletion bin/theme-json.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace ItalyStrap\ThemeJsonGenerator;

/** @psalm-suppress UnresolvableInclude */
require $_composer_autoload_path ?? __DIR__ . '/../vendor/autoload.php';

$bootstrap = new Bootstrap();
Expand Down
45 changes: 0 additions & 45 deletions bus/Bus.php

This file was deleted.

25 changes: 0 additions & 25 deletions bus/DecorateBus.php

This file was deleted.

13 changes: 0 additions & 13 deletions bus/HandlerInterface.php

This file was deleted.

13 changes: 0 additions & 13 deletions bus/MiddlewareInterface.php

This file was deleted.

20 changes: 13 additions & 7 deletions codeception.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@ extensions:
enabled:
- Codeception\Extension\RunFailed
commands:
- Codeception\Command\GenerateWPUnit
- Codeception\Command\GenerateWPRestApi
- Codeception\Command\GenerateWPRestController
- Codeception\Command\GenerateWPRestPostTypeController
- Codeception\Command\GenerateWPAjax
- Codeception\Command\GenerateWPCanonical
- Codeception\Command\GenerateWPXMLRPC
- lucatume\WPBrowser\Command\RunOriginal
- lucatume\WPBrowser\Command\RunAll
- lucatume\WPBrowser\Command\DbExport
- lucatume\WPBrowser\Command\DbImport
- lucatume\WPBrowser\Command\MonkeyCachePath
- lucatume\WPBrowser\Command\MonkeyCacheClear
- lucatume\WPBrowser\Command\GenerateWPUnit
- lucatume\WPBrowser\Command\GenerateWPRestApi
- lucatume\WPBrowser\Command\GenerateWPRestController
- lucatume\WPBrowser\Command\GenerateWPRestPostTypeController
- lucatume\WPBrowser\Command\GenerateWPAjax
- lucatume\WPBrowser\Command\GenerateWPCanonical
- lucatume\WPBrowser\Command\GenerateWPXMLRPC
params:
- tests/.env
coverage:
Expand Down
Loading
Loading