Skip to content

Commit

Permalink
Merge pull request #35 from tarosky/issue/34
Browse files Browse the repository at this point in the history
Support PHP 8.3

Close #34.
  • Loading branch information
harai authored May 2, 2024
2 parents ba35926 + 82c8f51 commit 330ed75
Show file tree
Hide file tree
Showing 17 changed files with 879 additions and 710 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ trim_trailing_whitespace = true
indent_style = space
indent_size = 2

[{composer.json,phpcs.ruleset.xml}]
[{composer.json,phpcs.xml}]
indent_size = 4

[*.php]
Expand Down
96 changes: 77 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,65 +10,123 @@ on:
- issue/*

jobs:
build:
test:
runs-on: ubuntu-latest
strategy:
matrix:
php-version:
- '7.4'
# - '8.0'
- '8.0'
- '8.1'
- '8.2'
- '8.3'
wp-multisite:
- '0'
- '1'
wp-version:
- latest
# - trunk
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@main
- name: set PHP_VERSION
run: echo "PHP_VERSION=${{ matrix.php-version }}" >> $GITHUB_ENV
run: echo "PHP_VERSION=${{matrix.php-version}}" >> $GITHUB_ENV
- name: set WP_VERSION
run: echo "WP_VERSION=${{ matrix.wp-version }}" >> $GITHUB_ENV
run: echo "WP_VERSION=${{matrix.wp-version}}" >> $GITHUB_ENV
- name: set WP_MULTISITE
run: echo "WP_MULTISITE=${{ matrix.wp-multisite }}" >> $GITHUB_ENV
run: echo "WP_MULTISITE=${{matrix.wp-multisite}}" >> $GITHUB_ENV
- name: Build docker image
run: scripts/build-test-image
- name: Run PHPUnit inside Docker Compose
run: scripts/run-test
- name: Create package
run: scripts/package
- uses: actions/upload-artifact@v2
- name: Upload Test Logs
if: always()
uses: actions/upload-artifact@main
with:
name: artifact
path: work/cavalcade.zip
name: test-logs-php${{matrix.php-version}}-wp${{matrix.wp-version}}-ms${{matrix.wp-multisite}}
path: work/test-logs
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@main
with:
name: test-result-php${{matrix.php-version}}-wp${{matrix.wp-version}}-ms${{matrix.wp-multisite}}
path: work/test-result.xml

release:
needs: build
if: github.ref == 'refs/heads/forked/master'
publish-test:
name: Publish Unit Tests Results
needs: test
runs-on: ubuntu-latest
if: success() || failure()
steps:
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@main
with:
name: artifact
path: artifacts
- name: Show artifacts
run: ls -laR ./
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@master
with:
check_name: Unit Test Results
github_token: ${{secrets.GITHUB_TOKEN}}
files: ./**/test-result.xml

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: Generate build number
uses: einaregilsson/build-number@v3
uses: onyxmueller/build-tag-number@main
with:
token: ${{secrets.GITHUB_TOKEN}}
prefix: build_number_generator
- name: Print new build number
run: echo "Build number is $BUILD_NUMBER"
- name: Save the build number
run: echo "$BUILD_NUMBER" > work/BUILD_NUMBER
- name: Print new build number
run: echo "build-$BUILD_NUMBER" > ./VERSION
- name: Build docker image
run: scripts/build-test-image
- name: Create package
run: scripts/package
- uses: actions/upload-artifact@main
with:
name: artifact
path: work/cavalcade.zip
- uses: actions/upload-artifact@main
with:
name: build-number
path: work/BUILD_NUMBER

release:
env:
# Hide warning: "Context access might be invalid: BUILD_NUMBER"
BUILD_NUMBER: null
needs:
- test
- build
if: github.ref == 'refs/heads/forked/master'
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@main
with:
name: artifact
- uses: actions/download-artifact@main
with:
name: build-number
- name: Show artifacts
run: ls -laR ./
- name: set BUILD_NUMBER
run: echo "BUILD_NUMBER=$(< ./BUILD_NUMBER)" >> $GITHUB_ENV
- id: create_release
uses: actions/create-release@v1
uses: actions/create-release@main
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
tag_name: build-${{env.BUILD_NUMBER}}
release_name: Build ${{env.BUILD_NUMBER}}
draft: false
prerelease: false
- uses: actions/upload-release-asset@v1
- uses: actions/upload-release-asset@main
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/.phpunit.result.cache
/.vscode/
/work/
/vendor/
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,24 @@
"dealerdirect/phpcodesniffer-composer-installer": "*",
"phpcompatibility/php-compatibility": "*",
"phpcompatibility/phpcompatibility-wp": "*",
"phpunit/phpunit": "~7.5",
"phpunit/phpunit": "^9.6.19",
"squizlabs/php_codesniffer": "*",
"wp-coding-standards/wpcs": "*",
"yoast/phpunit-polyfills": "^2.0"
"yoast/phpunit-polyfills": "*"
},
"config": {
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"composer/installers": true
"composer/installers": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"scripts": {
"lint": [
"phpcs --standard=phpcs.ruleset.xml $(find ./ -name '*.php')"
"vendor/bin/phpcs --standard=phpcs.xml $(find ./ -name '*.php')"
],
"fix": [
"phpcbf -v --standard=phpcs.ruleset.xml $(find ./ -name '*.php')"
"vendor/bin/phpcbf -v --standard=phpcs.xml $(find ./ -name '*.php')"
]
},
"support": {
Expand Down
Loading

0 comments on commit 330ed75

Please sign in to comment.