From efb7d1b7734a8f6c103e3e7284c4d93cf5619553 Mon Sep 17 00:00:00 2001 From: Hank Date: Sat, 17 Oct 2026 23:06:53 +0800 Subject: [PATCH] =?UTF-8?q?ci(github):=20=E6=96=B0=E5=A2=9E=20GitHub=20?= =?UTF-8?q?=E9=8F=A1=E5=83=8F=E5=B0=88=E7=94=A8=E7=9A=84=E6=B8=AC=E8=A9=A6?= =?UTF-8?q?=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gitea 讀 .gitea/workflows,GitHub 讀 .github/workflows,兩者互不影響。 GitHub 版改用 ubuntu-latest + setup-php(PHP 8.2 對齊正式環境); 不含 deploy,部署只走 Gitea。 Co-Authored-By: Claude Opus 5.5 --- .github/workflows/test.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..7626b58 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,37 @@ +name: Run Tests + +# 只供 GitHub 鏡像使用;Gitea 有 .gitea/workflows 時不會讀取本目錄。 +# 部署只走 Gitea 的 deploy.yml,這裡刻意不放 deploy。 +on: + push: + branches: + - master + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + # 版本對齊正式環境 Dockerfile 的 php:8.2-fpm(Gitea runner 受限於 Alpine 只能用 php84) + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.2' + extensions: mbstring, dom, fileinfo, gd, pdo_sqlite, sqlite3, xml, simplexml, curl, openssl + coverage: none + + - name: Copy .env + run: cp .env.example .env + + - name: Install Composer dependencies + run: composer install --prefer-dist --no-interaction --no-progress + + - name: Generate application key + run: php artisan key:generate + + - name: Run tests + run: php artisan test