Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX]: composer updates to fix Strauss issues causing tests to fail. #440

Merged
merged 18 commits into from
Feb 20, 2024
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
61 changes: 21 additions & 40 deletions .github/workflows/test-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ run-name: '[Test] ${{ github.event.head_commit.message }}'

on: [push, workflow_dispatch]

env:
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.COMPOSER_TOKEN }}"}}'

jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -19,6 +22,11 @@ jobs:

- uses: actions/checkout@v4

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"

- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
Expand All @@ -30,45 +38,11 @@ jobs:
- name: Build packages
run: bun run build

- name: Install composer
run: sudo composer self-update --stable
- name: Validate composer.json and composer.lock
run: composer validate

# Composer validate doesn't like our type of "wordpress-plugin"
# - name: Validate composer.json and composer.lock
# run: composer validate

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: |
vendor
vendor-prod
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}

- name: Install composer dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
env:
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.COMPOSER_TOKEN }}"}}'
run: |
composer config store-auths false
composer install --no-progress --no-suggest --ignore-platform-reqs

- name: Install composer vendor-prod
if: steps.composer-cache.outputs.cache-hit != 'true'
env:
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.COMPOSER_TOKEN }}"}}'
COMPOSER_VENDOR_DIR: vendor-prod
run: |
composer config store-auths false
composer install --prefer-dist --no-dev --no-ansi --no-interaction
composer du -a --no-dev --no-ansi --no-interaction

- name: Generate autoloader
if: steps.composer-cache.outputs.cache-hit == 'true'
run: composer du
- name: Install Composer dependencies
uses: ramsey/composer-install@v2

- name: Setup environment
run: envsubst < tests/docker-compose.codeception.env > tests/codeception.env
Expand All @@ -88,8 +62,15 @@ jobs:
run: |
sed -i -e 's/WP_VERSION=""/WP_VERSION="nightly"/g' tests/codeception.env

- name: Setup docker
run: ./bin/setup-docker.sh
- name: Set UID and GID for docker
run: |
printf 'UID=%d\nGID=%d\n' $(id -u) $(id -g) > .env.ci

- name: Start project containers
run: docker compose --env-file .env --env-file .env.ci up -d

- name: Wait for project to be ready
run: ./bin/wait-for-it.sh http://localhost:7253

- name: Run tests
run: |
Expand Down
2 changes: 1 addition & 1 deletion bin/test-up.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash
docker-compose -f docker-compose.yml up -d
docker-compose exec -T wordpress chown www-data:www-data wp-content wp-content/plugins
docker-compose exec -T wordpress chown -R www-data:www-data /var/www/html/wp-content/
16 changes: 10 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
{
"name": "kadencewp/kadence-blocks",
"dsecription": "Kadence Blocks - Gutenberg Blocks for Page Building",
"description": "Kadence Blocks - Gutenberg Blocks for Page Building",
"type": "wordpress-plugin",
"homepage": "https://www.kadencewp.com",
"license": "GPL-2.0-or-later",
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true,
"platform": {
"php": "7.2.34"
},
"allow-plugins": {
"composer/installers": true
}
},
"repositories": [
Expand All @@ -28,6 +34,7 @@
}
],
"require": {
"composer/installers": "^2.0",
"psr/container": "^1.0",
"lucatume/di52": "^3.3",
"stellarwp/telemetry": "^2.3",
Expand Down Expand Up @@ -62,7 +69,7 @@
"vendor/bin/stellar-uplink domain=kadence-blocks"
],
"strauss": [
"test -f ./bin/strauss.phar || curl -o bin/strauss.phar -L -C - https://github.com/BrianHenryIE/strauss/releases/download/0.14.1/strauss.phar",
"test -f ./bin/strauss.phar || curl -o bin/strauss.phar -L -C - https://github.com/BrianHenryIE/strauss/releases/download/0.16.0/strauss.phar",
"@php bin/strauss.phar",
"@composer dump-autoload"
],
Expand All @@ -87,13 +94,10 @@
"classmap_prefix": "Kadence_Blocks_",
"constant_prefix": "KADENCE_BLOCKS_",
"namespace_prefix": "KadenceWP\\KadenceBlocks\\",
"delete_vendor_packages": true,
"delete_vendor_packages": false,
"exclude_from_prefix": {
"file_patterns": [
"/symfony\\/polyfill-(.*)/"
],
"packages": [
"symfony/service-contracts"
]
}
}
Expand Down
161 changes: 153 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 16 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,33 @@ services:
restart: always
ports:
- ${WP_PORT}:80
user: "${UID:-1000}:${GID:-1000}"
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: wp
WORDPRESS_DB_USER: wp
WORDPRESS_DB_PASSWORD: pass
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: password
WORDPRESS_SKIP_INSTALL: 'yes'
WORDPRESS_DEBUG: 1
volumes:
- ./:/var/www/html/wp-content/plugins/kadence-blocks
depends_on:
- db
db:
condition: service_healthy

db:
image: mariadb:10.5
image: mariadb:10.7.8
restart: always
healthcheck: # The `wp` db should exist.
test: mysqlshow -u root -ppassword wp
start_period: 5s
interval: 1s
timeout: 3s
retries: 30
ports:
- ${DB_PORT}:3306
environment:
MYSQL_DATABASE: wp
MYSQL_USER: wp
MYSQL_PASSWORD: pass
MYSQL_RANDOM_ROOT_PASSWORD: '1'
MYSQL_ROOT_PASSWORD: password
tmpfs:
- /var/lib/mysql
Loading
Loading