Files
saasshop/.gitee/go.yml

58 lines
2.0 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Gitee Go 流水线配置(模板)
# 目标:代码推送后自动执行“结构变更 SQL 脚本”与基础回归测试。
#
# 注意:该文件为模板,具体 DB/ENV 需要在 Gitee Go 的「变量/密钥」中配置。
# 不要把任何密码/令牌写进仓库。
version: 1.0
name: SaaSShop CI
stages:
- test
jobs:
test:
stage: test
image: php:8.2
steps:
- name: 安装系统依赖
run: |
apt-get update
apt-get install -y git unzip libzip-dev default-mysql-client libsqlite3-dev
docker-php-ext-install pdo pdo_mysql pdo_sqlite
- name: 安装 Composer
run: |
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php --install-dir=/usr/local/bin --filename=composer
composer --version
- name: 安装 PHP 依赖
run: |
composer install --no-interaction --prefer-dist --optimize-autoloader
- name: 准备环境文件CI 默认使用 sqlite避免依赖外部 DB
run: |
[ -f .env ] || cp .env.example .env
# 覆盖为 sqlite可按需在 Gitee Go 变量中替换为 mysql
sed -i 's/^DB_CONNECTION=.*/DB_CONNECTION=sqlite/' .env
sed -i 's%^DB_DATABASE=.*%DB_DATABASE='"$PWD"'/database/database.sqlite%' .env
grep -q '^DB_DATABASE=' .env || echo "DB_DATABASE=$PWD/database/database.sqlite" >> .env
mkdir -p database
touch database/database.sqlite
php artisan key:generate
- name: 运行 Laravel migrations
run: |
php artisan migrate --force
php artisan migrate:status
- name: 运行 SQL 结构迁移脚本V1__xxx.sql
run: |
composer run db:sql-migrate
- name: 运行测试(先跑关键链路,再全量)
run: |
php artisan test --filter='AdminPlanTest|AdminSiteSubscriptionTest|AdminPlatformOrderTest'
php artisan test