Skip to content

Commit 5c1b745

Browse files
authored
feat: Compatible with thinkphp8.0 (#41)
1 parent 59c6a48 commit 5c1b745

File tree

3 files changed

+57
-17
lines changed

3 files changed

+57
-17
lines changed

.github/workflows/default.yml

Lines changed: 50 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
name: Default
22

3-
on:
4-
push:
5-
branches: [ master ]
6-
pull_request:
7-
branches: [ master ]
3+
on: [push, pull_request]
84

95
jobs:
106
test:
@@ -23,10 +19,26 @@ jobs:
2319
strategy:
2420
fail-fast: true
2521
matrix:
26-
php: [ 7.1, 7.2, 7.3, 7.4, 8.0, 8.1 ]
27-
stability: [ prefer-lowest ]
22+
include:
23+
# ThinkPHP 6.*
24+
- php: 7.1
25+
thinkphp: 6.*
26+
- php: 7.2
27+
thinkphp: 6.*
28+
- php: 7.4
29+
thinkphp: 6.*
30+
- php: 8.0
31+
thinkphp: 6.*
32+
- php: 8.1
33+
thinkphp: 6.*
2834

29-
name: PHP ${{ matrix.php }} - ${{ matrix.stability }}
35+
# ThinkPHP 8.*
36+
- php: 8.0
37+
thinkphp: 8.*
38+
- php: 8.1
39+
thinkphp: 8.*
40+
41+
name: ThinkPHP${{ matrix.thinkphp }}-PHP${{ matrix.php }}
3042

3143
steps:
3244
- name: Checkout code
@@ -39,6 +51,10 @@ jobs:
3951
tools: composer:v2
4052
coverage: xdebug
4153

54+
- name: Pre composer
55+
if: matrix.thinkphp == '8.*'
56+
run: composer remove php-coveralls/php-coveralls --dev
57+
4258
- name: Validate composer.json and composer.lock
4359
run: composer validate
4460

@@ -47,17 +63,40 @@ jobs:
4763
uses: actions/cache@v3
4864
with:
4965
path: vendor
50-
key: ${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
66+
key: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.thinkphp }}-${{ hashFiles('**/composer.lock') }}
5167
restore-keys: |
52-
${{ runner.os }}-${{ matrix.php }}-
68+
${{ runner.os }}-${{ matrix.php }}-${{ matrix.thinkphp }}
5369
5470
- name: Install dependencies
5571
if: steps.composer-cache.outputs.cache-hit != 'true'
56-
run: composer install --prefer-dist --no-progress --no-suggest
72+
run: |
73+
composer require topthink/framework:${{ matrix.thinkphp }} --no-update --no-interaction
74+
composer require topthink/think:${{ matrix.thinkphp }} --no-update --no-interaction --dev
75+
composer install --prefer-dist --no-progress --no-suggest
5776
5877
- name: Run test suite
5978
run: ./vendor/bin/phpunit
6079

80+
- name: Run Coveralls
81+
if: matrix.thinkphp != '8.*'
82+
env:
83+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
COVERALLS_PARALLEL: true
85+
COVERALLS_FLAG_NAME: ${{ runner.os }} - ${{ matrix.php }}
86+
run: |
87+
composer global require php-coveralls/php-coveralls:^2.4
88+
php-coveralls --coverage_clover=build/logs/clover.xml -v
89+
90+
upload-coverage:
91+
runs-on: ubuntu-latest
92+
needs: [ test ]
93+
steps:
94+
- name: Coveralls Finished
95+
uses: coverallsapp/github-action@master
96+
with:
97+
github-token: ${{ secrets.GITHUB_TOKEN }}
98+
parallel-finished: true
99+
61100
semantic-release:
62101
runs-on: ubuntu-latest
63102
needs: [ test ]

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
"license": "Apache-2.0",
2222
"require": {
2323
"casbin/casbin": "~3.0",
24-
"topthink/framework": "^6.0.0",
25-
"topthink/think-migration": "^3.0",
24+
"topthink/framework": "~6.0|~8.0",
25+
"topthink/think-migration": "^3.0.6",
2626
"casbin/psr3-bridge": "^1.1"
2727
},
2828
"require-dev": {
2929
"phpunit/phpunit": "~7.0|~8.0|~9.0",
30-
"php-coveralls/php-coveralls": "^2.1",
31-
"topthink/think": "^6.0.0"
30+
"php-coveralls/php-coveralls": "^2.4",
31+
"topthink/think": "~6.0|~8.0"
3232
},
3333
"autoload": {
3434
"psr-4": {
@@ -50,4 +50,4 @@
5050
]
5151
}
5252
}
53-
}
53+
}

phpunit.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
<log type="coverage-html" target="build/html"/>
2424
</logging>
2525
<php>
26-
<env name="PHP_APP_DEBUG " value="true"/>
26+
<env name="PHP_APP_DEBUG" value="true"/>
2727
<env name="PHP_DATABASE_DATABASE" value="tauthz"/>
28+
<env name="PHP_DB_NAME" value="tauthz"/>
2829
</php>
2930
</phpunit>

0 commit comments

Comments
 (0)