77b4501682
.gitea/workflows/ - test.yml:unit / integration / lint / phpcs,外加 A 從未有過的 phpstan job。 env 改 TMDO_TEST_DB_*(bootstrap 仍相容 WPDO_TEST_DB_*),host-mode runner 直連本機 MariaDB,保留 A v3.4.6 的 DB preflight(區分 INFRA 失敗與測試失敗) - anti-eav-lint.yml:TMDO_HOST 指向 dev30、改用 wp tmdo lint、slug 換成 2meet-data-optimizer - release.yml:v* tag 觸發,test-gate 加跑 phpstan scripts/ci-package.sh 依專案規範委派給共用的 scripts/package-plugin.sh(10 項終檢、統一排除清單、 輸出 wp-local-dev/dist/),而不是自帶一份排除邏輯;找不到共用腳本時才走 最小 fallback 並明確警告該路徑跳過終檢。 實測:bash scripts/ci-package.sh → 10 項終檢全 PASS (552 KB / 185 entries、schema drift 34 CREATE vs 34 DROP 對齊) 註:B 目前沒有 git remote,workflow 檔案就緒但要推上 gitea 才會實際執行。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TbG1keQQ7XBa7qMQY16KCY
88 lines
2.6 KiB
YAML
88 lines
2.6 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
test-gate:
|
|
name: Test Gate (lint + phpcs + phpstan + unit + integration)
|
|
runs-on: ubuntu-latest
|
|
# Host-mode runner: no service containers. Uses the host MariaDB, same as
|
|
# the Tests workflow.
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install dependencies
|
|
run: composer install --no-interaction --prefer-dist
|
|
|
|
- name: PHP Lint
|
|
run: |
|
|
find . -name "*.php" \
|
|
! -path "./vendor/*" \
|
|
! -path "./tests/*" \
|
|
-print0 | xargs -0 -n1 php -l
|
|
echo "PHP syntax OK"
|
|
|
|
- name: PHPCS
|
|
run: vendor/bin/phpcs --standard=phpcs.xml --report=checkstyle -q .
|
|
|
|
- name: PHPStan
|
|
run: vendor/bin/phpstan analyse --no-progress --error-format=github
|
|
|
|
- name: Unit Tests
|
|
run: php vendor/bin/phpunit --configuration phpunit.xml --testdox
|
|
|
|
- name: Integration Tests
|
|
env:
|
|
TMDO_TEST_DB_HOST: 127.0.0.1
|
|
TMDO_TEST_DB_USER: dbo
|
|
TMDO_TEST_DB_PASS: ${{ secrets.TMDO_TEST_DB_PASS }}
|
|
TMDO_TEST_DB_NAME: wp_wpdo_test
|
|
run: php vendor/bin/phpunit --configuration phpunit-integration.xml --testdox
|
|
|
|
release:
|
|
needs: [test-gate]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Build ZIP
|
|
run: bash scripts/ci-package.sh
|
|
|
|
- name: Create Gitea Release
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
GITEA_URL: ${{ vars.RELEASE_GITEA_URL }}
|
|
run: |
|
|
set -euo pipefail
|
|
VERSION="${{ gitea.ref_name }}"
|
|
ZIP=$(ls dist/*.zip | head -1)
|
|
ZIP_NAME=$(basename "$ZIP")
|
|
MD5=$(md5sum "$ZIP" | awk '{print $1}')
|
|
|
|
# Create the release
|
|
RELEASE_ID=$(curl -s -X POST \
|
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
-H "Content-Type: application/json" \
|
|
"${GITEA_URL}/api/v1/repos/${{ gitea.repository }}/releases" \
|
|
-d "{
|
|
\"tag_name\": \"${VERSION}\",
|
|
\"name\": \"${VERSION}\",
|
|
\"body\": \"MD5: \`${MD5}\`\",
|
|
\"draft\": false,
|
|
\"prerelease\": false
|
|
}" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*')
|
|
|
|
# Upload ZIP asset
|
|
curl -s -X POST \
|
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
-H "Content-Type: application/zip" \
|
|
"${GITEA_URL}/api/v1/repos/${{ gitea.repository }}/releases/${RELEASE_ID}/assets?name=${ZIP_NAME}" \
|
|
--data-binary "@${ZIP}"
|
|
|
|
echo "Released ${VERSION} — asset: ${ZIP_NAME} (MD5: ${MD5})"
|