Test Title 3 #24
@ -1,3 +1,15 @@
|
||||
# 全体像
|
||||
# PR と push で 別の処理 が走ります。
|
||||
#NOTE depends_on なし → 並列実行
|
||||
#WARN failure: ignore がないため、Drep が失敗すると パイプライン全体が ❌ になり、マージが止まる可能性があります。
|
||||
# pull_request イベント
|
||||
# ├─ php-lint … PHP 構文チェック(マージ前の CI)
|
||||
# └─ ai-review … Drep による AI コードレビュー
|
||||
# ↑
|
||||
# depends_on なし → 並列実行
|
||||
# push イベント(develop ブランチのみ)
|
||||
# └─ deploy … EC2 へ SSH してデプロイ確認
|
||||
|
||||
steps:
|
||||
# 疎通テスト
|
||||
# hello:
|
||||
@ -5,11 +17,62 @@ steps:
|
||||
# commands:
|
||||
# - echo "Woodpecker is working!"
|
||||
|
||||
# PHP構文チェック
|
||||
# PHP構文チェック(merge前)
|
||||
php-lint:
|
||||
image: php:8.3-cli
|
||||
commands:
|
||||
- find . -name "*.php" -print0 | xargs -0 -n1 php -l
|
||||
when:
|
||||
event:
|
||||
- pull_request
|
||||
|
||||
# AI コードレビュー(skip-ai-review ラベル付き PR はスキップ)
|
||||
ai-review:
|
||||
image: ghcr.io/slb350/drep:latest
|
||||
environment:
|
||||
GITEA_TOKEN:
|
||||
from_secret: gitea_token
|
||||
DREP_LLM_API_KEY:
|
||||
from_secret: drep_llm_api_key
|
||||
OPENAI_API_KEY:
|
||||
from_secret: drep_llm_api_key
|
||||
DREP_LLM_ENDPOINT: https://openrouter.ai/api/v1
|
||||
DREP_LLM_MODEL: nvidia/nemotron-3-ultra-550b-a55b:free
|
||||
commands:
|
||||
- |
|
||||
case ",${CI_COMMIT_PULL_REQUEST_LABELS}," in
|
||||
*",skip-ai-review,"*)
|
||||
echo "skip-ai-review label detected — skipping AI review"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
cat > /tmp/config.yaml <<EOF
|
||||
gitea:
|
||||
url: https://gitea.git.mitchecp.com
|
||||
token: ${GITEA_TOKEN}
|
||||
repositories:
|
||||
- ${CI_REPO_OWNER}/*
|
||||
llm:
|
||||
enabled: true
|
||||
endpoint: ${DREP_LLM_ENDPOINT}
|
||||
api_key: ${DREP_LLM_API_KEY}
|
||||
model: ${DREP_LLM_MODEL}
|
||||
temperature: 0.2
|
||||
timeout: 120
|
||||
max_tokens: 4096
|
||||
database_url: sqlite:////tmp/drep.db
|
||||
documentation:
|
||||
enabled: true
|
||||
markdown_checks: false
|
||||
EOF
|
||||
export DREP_CONFIG=/tmp/config.yaml
|
||||
|
||||
echo "Running drep review for ${CI_REPO} PR #${CI_COMMIT_PULL_REQUEST}"
|
||||
drep review "${CI_REPO}" "${CI_COMMIT_PULL_REQUEST}"
|
||||
when:
|
||||
event:
|
||||
- pull_request
|
||||
|
||||
# 本番デプロイ
|
||||
deploy:
|
||||
@ -25,8 +88,8 @@ steps:
|
||||
- mkdir -p ~/.ssh
|
||||
- echo "$SSH_KEY" > ~/.ssh/mitchecp.pem
|
||||
- chmod 600 ~/.ssh/mitchecp.pem
|
||||
- ssh-keyscan gitea.mitchecp.com >> ~/.ssh/known_hosts
|
||||
- ssh -i ~/.ssh/mitchecp.pem ec2-user@gitea.mitchecp.com "cd /home/ec2-user && touch woodpecker.created.develop.txt"
|
||||
- ssh-keyscan gitea.git.mitchecp.com >> ~/.ssh/known_hosts
|
||||
- ssh -i ~/.ssh/mitchecp.pem ec2-user@gitea.git.mitchecp.com "cd /home/ec2-user && touch woodpecker.created.develop.txt"
|
||||
when:
|
||||
branch:
|
||||
- develop
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user