-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #230 from woocommerce/24-12/php-84-deprecation
Fix PHP 8.4 deprecation
- Loading branch information
Showing
18 changed files
with
1,225 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Restore Docker Image Cache | ||
description: Restores or builds docker image cache for a given PHP version | ||
inputs: | ||
php-version: | ||
description: "PHP version to build/load the docker image for" | ||
required: true | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Restore Docker image cache | ||
uses: actions/cache@v3 | ||
id: cache-docker | ||
with: | ||
path: qit-cli-tests-${{ inputs.php-version }}.tar | ||
key: ${{ runner.os }}-qit-cli-tests-${{ inputs.php-version }}-${{ hashFiles('_build/docker/php/**') }} | ||
|
||
- name: Build Docker image if needed | ||
if: steps.cache-docker.outputs.cache-hit != 'true' | ||
run: | | ||
docker build --build-arg CI=true --build-arg PHP_VERSION=${{ inputs.php-version }} -t qit-cli-tests:${{ inputs.php-version }} ./_build/docker/php | ||
docker save qit-cli-tests:${{ inputs.php-version }} -o qit-cli-tests-${{ inputs.php-version }}.tar | ||
shell: bash | ||
|
||
- name: Load Docker image from cache | ||
if: steps.cache-docker.outputs.cache-hit == 'true' | ||
run: | | ||
docker load -i qit-cli-tests-${{ inputs.php-version }}.tar | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,43 @@ | ||
name: QIT CLI Code tests | ||
on: | ||
workflow_call: | ||
push: | ||
pull_request: | ||
paths: | ||
- 'src/**.php' | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: code-tests-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
code_tests: | ||
name: Code tests | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- uses: actions/cache@v3 | ||
|
||
- name: Restore Docker Cache (default PHP 8.3) | ||
uses: ./.github/actions/restore-docker-cache | ||
with: | ||
php-version: "8.3" | ||
|
||
- name: Cache composer dependencies | ||
uses: actions/cache@v3 | ||
id: cache-composer | ||
with: | ||
path: src/vendor | ||
key: ${{ runner.os }}-${{ hashFiles('src/composer.lock') }} | ||
|
||
- name: Composer install | ||
if: steps.cache-composer.outputs.cache-hit != 'true' | ||
working-directory: src | ||
run: composer install | ||
|
||
- name: Run PHPCS | ||
run: make phpcs | ||
|
||
- name: Run PHPStan | ||
run: make phpstan | ||
|
||
- name: Run Phan | ||
run: make phan | ||
- name: Run PHPUnit | ||
run: make phpunit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Restore Docker Image Cache | ||
on: | ||
workflow_call: | ||
inputs: | ||
php-version: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
restore-docker-cache: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Restore Docker image cache | ||
uses: actions/cache@v3 | ||
id: cache-docker | ||
with: | ||
path: qit-cli-tests-${{ inputs.php-version }}.tar | ||
key: ${{ runner.os }}-qit-cli-tests-${{ inputs.php-version }}-${{ hashFiles('_build/docker/php/**') }} | ||
|
||
- name: Build Docker image if needed | ||
if: steps.cache-docker.outputs.cache-hit != 'true' | ||
run: | | ||
docker build --build-arg CI=true --build-arg PHP_VERSION=${{ inputs.php-version }} -t qit-cli-tests:${{ inputs.php-version }} ./_build/docker/php | ||
docker save qit-cli-tests:${{ inputs.php-version }} -o qit-cli-tests-${{ inputs.php-version }}.tar | ||
- name: Load Docker image from cache | ||
if: steps.cache-docker.outputs.cache-hit == 'true' | ||
run: | | ||
docker load -i qit-cli-tests-${{ inputs.php-version }}.tar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Use an ARG for the PHP version. Default to 8.3 if not provided. | ||
ARG PHP_VERSION=8.3 | ||
FROM php:${PHP_VERSION}-cli | ||
|
||
ARG CI | ||
RUN apt-get update \ | ||
&& apt-get install -y libzip-dev \ | ||
&& docker-php-ext-install zip pcntl \ | ||
&& docker-php-ext-enable zip pcntl | ||
|
||
# Install php-ast | ||
RUN pecl install ast && docker-php-ext-enable ast | ||
|
||
# Install Xdebug only if not in CI environment and PHP major version >= 8 | ||
RUN if [ "$CI" != "true" ] && [ "${PHP_VERSION%%.*}" -ge 8 ]; then \ | ||
pecl install xdebug && docker-php-ext-enable xdebug; \ | ||
fi |
4 changes: 2 additions & 2 deletions
4
_build/docker/php83/ini/xdebug.ini → _build/docker/php/ini/xdebug.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.