更新 php-test.yml

pull/223/head
icret 2024-05-07 14:13:25 +08:00
parent c864d89eb7
commit bc9515dd99
1 changed files with 17 additions and 29 deletions

View File

@ -1,43 +1,31 @@
name: PHP 兼容性测试
name: PHP Unit Tests across Multiple Versions
on: on:
push: push:
branches: branches: [ main ]
- main
pull_request: pull_request:
branches: branches: [ main ]
- main
jobs: jobs:
test: php-compatibility:
strategy: name: PHP 兼容性测试
matrix:
php-version: [5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2] # 指定要测试的PHP版本
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: strategy:
- name: Checkout Code matrix:
uses: actions/checkout@v3 php-version: [5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2]
- name: Setup PHP steps:
- name: 检出代码
uses: actions/checkout@v2
- name: 设置 PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: ${{ matrix.php-version }} php-version: ${{ matrix.php-version }}
tools: composer:v2
coverage: none # 如果不需要覆盖率报告可以设置为none
- name: Install Dependencies - name: 安装依赖
run: composer install --prefer-dist --no-interaction --no-progress --no-suggest run: composer install
- name: Run PHPUnit Tests - name: 运行测试
run: vendor/bin/phpunit run: vendor/bin/phpunit
env:
CI: true
- name: Upload Test Results (if failure)
if: failure()
uses: actions/upload-artifact@v3
with:
name: test-results-${{ matrix.php-version }}
path: build/logs # 假设你的测试结果存储在build/logs目录下