Skip to content

Commit

Permalink
CI/CD: Run tests against php8.2+mysql8.0 (wpengine#133)
Browse files Browse the repository at this point in the history
* CI/CD: Run tests against php8.2+mysql8.0

* CI/CD: exclude invalid php and wordpress combination

* Build: Fix schema download uri

---------

Co-authored-by: John Parris <[email protected]>
  • Loading branch information
theodesp and mindctrl authored Jul 20, 2023
1 parent c403264 commit 7789be5
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
10 changes: 5 additions & 5 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
ARG WP_VERSION=latest

FROM wordpress:${WP_VERSION}

# Needed to specify the build args again after the FROM command.
ARG WP_VERSION
ARG PHP_VERSION

FROM wordpress:${WP_VERSION}-php${PHP_VERSION}

# Save the build args for use by the runtime environment
ENV WP_VERSION=${WP_VERSION}
ENV PHP_VERSION=${PHP_VERSION}


# Needed for Codeception WPDB test integration.
RUN docker-php-ext-install pdo pdo_mysql
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/schema-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
echo "Previous tagged schema ${{ steps.get-latest-tag.outputs.tag }}"
- name: Get Previous Released Schema
run: curl 'https://github.com/wp-graphql-content-blocks/releases/download/${{ steps.get-latest-tag.outputs.tag }}/schema.graphql' -L --output /tmp/${{ steps.get-latest-tag.outputs.tag }}.graphql
run: curl 'https://github.com/wpengine/wp-graphql-content-blocks/releases/download/${{ steps.get-latest-tag.outputs.tag }}/schema.graphql' -L --output /tmp/${{ steps.get-latest-tag.outputs.tag }}.graphql

# https://github.com/marketplace/actions/graphql-inspector
- name: Install Schema Inspector
Expand Down
20 changes: 19 additions & 1 deletion .github/workflows/test-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,31 @@ on:
jobs:
test_plugin:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ '8.2', '7.4' ]
wordpress: [ '6.1', '6.2', '5.9' ]
exclude:
- php: 8.2
wordpress: 5.9
- php: 7.4
wordpress: 6.2
fail-fast: false
name: WordPress ${{ matrix.wordpress }}, PHP ${{ matrix.php }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Create Docker Containers
env:
PHP_VERSION: ${{ matrix.php }}
WP_VERSION: ${{ matrix.wordpress }}
working-directory: ./
run: docker-compose up -d
run: |
docker-compose build \
--build-arg WP_VERSION=${{ matrix.wordpress }} \
--build-arg PHP_VERSION=${{ matrix.php }}
docker-compose up -d
- name: Wait for db
run: |
Expand Down
6 changes: 4 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ services:
wordpress:
build:
context: ./.docker
image: wp-graphql-content-blocks:latest-wp-${WP_VERSION-latest}
image: wp-graphql-content-blocks:latest-wp-${WP_VERSION-latest}-php${PHP_VERSION}
restart: always
ports:
- 8080:80
links:
- db
environment:
PHP_VERSION: ${PHP_VERSION:-8.2}
WP_VERSION: ${WP_VERSION:-6.2}
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: wordpress
WORDPRESS_DB_USER: root
Expand All @@ -24,7 +26,7 @@ services:
- ./:/var/www/html/wp-content/plugins/wp-graphql-content-blocks

db:
image: mysql:5.7
image: mysql:8
restart: always
ports:
- 33066:3306
Expand Down

0 comments on commit 7789be5

Please sign in to comment.