- test.yml / ci.yml: 使用 composer:latest 镜像 (含 PHP) - deploy.yml: 使用 alpine:latest 镜像 + SSH 密钥配置 - 解决 runner 默认环境缺少 PHP 的问题
This commit is contained in:
@@ -11,21 +11,23 @@ jobs:
|
||||
quick-test:
|
||||
name: 快速测试
|
||||
runs-on: linux
|
||||
container:
|
||||
image: composer:latest
|
||||
steps:
|
||||
- name: 检出代码
|
||||
run: |
|
||||
apk add --no-cache git
|
||||
git clone -b ${{ github.ref_name }} ${{ github.server_url }}/${{ github.repository }}.git .
|
||||
git checkout ${{ github.sha }}
|
||||
|
||||
- name: 检查环境
|
||||
run: |
|
||||
echo "PHP: $(php -v | head -1)"
|
||||
echo "Composer: $(composer --version 2>/dev/null || echo 'not found')"
|
||||
echo "Composer: $(composer --version)"
|
||||
|
||||
- name: PHP 语法检查
|
||||
run: |
|
||||
echo "📝 PHP 语法检查..."
|
||||
echo "PHP 版本: $(php -v | head -1)"
|
||||
errors=0
|
||||
for file in $(find . -name "*.php" -not -path "./vendor/*"); do
|
||||
output=$(php -l "$file" 2>&1)
|
||||
@@ -43,10 +45,7 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: 安装依赖
|
||||
run: |
|
||||
if [ -f composer.json ]; then
|
||||
composer install --prefer-dist --no-progress --no-interaction
|
||||
fi
|
||||
run: composer install --prefer-dist --no-progress --no-interaction
|
||||
|
||||
- name: 运行测试
|
||||
run: |
|
||||
|
||||
Reference in New Issue
Block a user