Skip to content

Commit f6e68e7

Browse files
authored
Merge pull request #39 from macocci7/support_php_8.5
Support PHP 8.5
2 parents b4e4114 + abcf50f commit f6e68e7

7 files changed

Lines changed: 43 additions & 202 deletions

File tree

.github/workflows/tag_meged_pull_request.yml

Lines changed: 0 additions & 61 deletions
This file was deleted.

.github/workflows/test_pull_request.yml

Lines changed: 8 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -3,56 +3,12 @@ name: Test and Static Analysis (Pull Request)
33
on: pull_request
44

55
jobs:
6-
check-version-in-composer-json:
7-
name: Check Version
8-
runs-on: ubuntu-latest
9-
10-
steps:
11-
- name: Set up PHP
12-
uses: shivammathur/setup-php@v2
13-
with:
14-
php-version: 8.3
15-
tools: composer:v2
16-
17-
- name: Checkout code
18-
uses: actions/checkout@v4
19-
with:
20-
fetch-depth: 0
21-
22-
- name: PHP Version Check
23-
run: php -v
24-
25-
- name: Validate Composer JSON
26-
run: composer validate
27-
28-
- name: Get Version From Comopser JSON
29-
id: new-version
30-
run: |
31-
echo version=$(cat composer.json | grep version | head -1 | grep -Po '\d+\.\d+\.\d+') >> $GITHUB_OUTPUT
32-
33-
- name: Show New Version
34-
run: echo "version=${{ steps.new-version.outputs.version }}"
35-
36-
- name: Show Tags
37-
run: git tag
38-
39-
- name: Check If The Version Is Not In The Tag List
40-
run: |
41-
for tag in `git tag`
42-
do
43-
if [ $tag = ${{ steps.new-version.outputs.version }} ]; then
44-
echo "version ${{ steps.new-version.outputs.version }} already exists."
45-
exit 1
46-
fi
47-
done
48-
echo "OK."
49-
506
test-and-static-analysis:
517
name: Test and Lint
528
runs-on: ubuntu-latest
539
strategy:
5410
matrix:
55-
php: ['8.1', '8.2', '8.3', '8.4']
11+
php: ['8.1', '8.2', '8.3', '8.4', '8.5']
5612

5713
steps:
5814
- name: Set up PHP
@@ -63,12 +19,12 @@ jobs:
6319
tools: composer:v2
6420

6521
- name: Set up Node
66-
uses: actions/setup-node@v4
22+
uses: actions/setup-node@v6
6723
with:
68-
node-version: '20.x'
24+
node-version: '24.x'
6925

7026
- name: Checkout code
71-
uses: actions/checkout@v4
27+
uses: actions/checkout@v5
7228
with:
7329
fetch-depth: 0
7430

@@ -85,14 +41,6 @@ jobs:
8541
- name: PHP Lint
8642
run: ./vendor/bin/parallel-lint src tests examples
8743

88-
#- name: Neon Lint
89-
# run: ./vendor/nette/neon/bin/neon-lint conf
90-
91-
#- name: PHP MD
92-
# run: |
93-
# ./vendor/bin/phpmd --version
94-
# ./vendor/bin/phpmd ./src/ ./examples/ ./tests/ text phpmd.xml
95-
9644
- name: PHP Code Sniffer
9745
run: |
9846
./vendor/bin/phpcs --version
@@ -115,7 +63,7 @@ jobs:
11563
runs-on: ubuntu-latest
11664
strategy:
11765
matrix:
118-
php: ['8.3']
66+
php: ['8.4']
11967

12068
steps:
12169
- name: Set up PHP
@@ -126,12 +74,12 @@ jobs:
12674
tools: composer:v2
12775

12876
- name: Set up Node
129-
uses: actions/setup-node@v4
77+
uses: actions/setup-node@v6
13078
with:
131-
node-version: '20.x'
79+
node-version: '24.x'
13280

13381
- name: Checkout code
134-
uses: actions/checkout@v4
82+
uses: actions/checkout@v5
13583
with:
13684
fetch-depth: 0
13785

PHP_VERSIONS

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
8.4
2-
8.3
3-
8.2
41
8.1
2+
8.2
3+
8.3
4+
8.4

bin/CheckVersion.sh

Lines changed: 0 additions & 35 deletions
This file was deleted.

bin/TestAndLint.sh

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
# Script to Test and Lint
44
# requirement:
5-
# - https://github.com/jdx/mise installed
5+
# - https://github.com/phpenv/phpenv installed
66
# - PHP versions defined in ../PHP_VERSIONS installed
77

8-
CMD=mise
8+
CMD=phpenv
99
$CMD -v &> /dev/null
1010
if [ $? -ne 0 ]; then
1111
echo "command [${CMD}] not found!"
@@ -19,13 +19,37 @@ if [ $? -ne 0 ]; then
1919
exit 1
2020
fi
2121

22-
switch_version() {
22+
test_and_lint() {
2323
echo "==========================================================="
24-
echo "[PHP $1][Switching PHP version to $1]"
25-
mise x php@$1 -- bash bin/TestAndLintSub.sh $1;
24+
echo "[PHP $1][phpenv global $1]"
25+
phpenv global $1
26+
if [ $? -ne 0 ]; then
27+
echo "Failed to switch version to $1. skipped."
28+
return 1
29+
fi
30+
echo "-----------------------------------------------------------"
31+
echo "[PHP $1][php -v]"
32+
php -v
33+
echo "-----------------------------------------------------------"
34+
echo "[PHP $1][parallel-lint]"
35+
./vendor/bin/parallel-lint src tests examples
36+
echo "-----------------------------------------------------------"
37+
echo "[PHP $1][phpcs]"
38+
./vendor/bin/phpcs --ignore=vendor \
39+
--standard=phpcs.xml \
40+
-p \
41+
-s \
42+
.
43+
echo "-----------------------------------------------------------"
44+
echo "[PHP $1][phpstan]"
45+
./vendor/bin/phpstan analyze -c phpstan.neon
46+
echo "-----------------------------------------------------------"
47+
echo "[PHP $1][phpunit]"
48+
./vendor/bin/phpunit ./tests/
49+
echo "-----------------------------------------------------------"
2650
}
2751

28-
echo "[[TestAndLint.sh]]"
52+
echo "[[TesAndLint.sh]]"
2953

3054
SUPPORTED_PHP_VERSIONS=PHP_VERSIONS
3155
if [ ! -f $SUPPORTED_PHP_VERSIONS ]; then
@@ -40,6 +64,6 @@ if [ ! -r $SUPPORTED_PHP_VERSIONS ]; then
4064
fi
4165
STR_CMD=''
4266
while read version ; do
43-
STR_CMD="$STR_CMD switch_version $version;"
67+
STR_CMD="$STR_CMD test_and_lint $version;"
4468
done < $SUPPORTED_PHP_VERSIONS
4569
eval $STR_CMD

bin/TestAndLintSub.sh

Lines changed: 0 additions & 34 deletions
This file was deleted.

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"name": "macocci7/php-math-integer",
3-
"version": "1.1.4",
43
"description": "PHP Math Library of the subjects of number theory(only natural number).",
54
"type": "library",
65
"license": "MIT",
@@ -20,7 +19,7 @@
2019
"php": ">=8.1"
2120
},
2221
"require-dev": {
23-
"squizlabs/php_codesniffer": "^3.11",
22+
"squizlabs/php_codesniffer": "^4.0",
2423
"phpunit/phpunit": "^10.5",
2524
"phpstan/phpstan": "^2.1",
2625
"php-parallel-lint/php-parallel-lint": "^1.4"

0 commit comments

Comments
 (0)