此包已被废弃,不再维护。未建议替代包。

简单快速的 CI 服务器

维护者

详情

github.com/funivan/ci

源代码

安装: 6

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 2

类型:项目

dev-master 2016-11-24 11:54 UTC

This package is not auto-updated.

Last update: 2020-01-20 23:43:43 UTC


README

  • git clone https://github.com/funivan/ci.git
  • cd ci
  • composer install
  • touch database/database.sqlite
  • php artisan migrate
  • 编辑配置文件 ci.app.php
  • 添加到 cron * * * * * php artisan schedule:run >> /dev/null 2>&1
  • 将您的仓库克隆到 build 目录。您可以在 ci.app.php 中更改位置

手动使用

  • 将提交添加到队列 php artisan ci:add master 0270966ad4a47e73c1ffcd28f5895b74da1b205f dev@funivan.com
  • 检查提交 php artisan ci:check 1

如何自动检查提交?

创建 git 钩子 post-receive

#!/bin/sh
#
# An example hook script for the "post-receive" event.
#
# The "post-receive" script is run after receive-pack has accepted a pack
# and the repository has been updated.  It is passed arguments in through
# stdin in the form
#  <oldrev> <newrev> <refname>
# For example:
#  aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
#

SERVER_URL="ci.yourserver.com";

trigger_hook() {
        NEWREV="$2"
        REFNAME="$3"

        if [ "$NEWREV" = "0000000000000000000000000000000000000000" ]; then
                # Ignore deletion
                return
        fi

        case "$REFNAME" in
                # Triggers only on branches and tags
                refs/heads/*|refs/tags/*) ;;
                # Bail out on other references
                *) return ;;
        esac

        BRANCH=$(git rev-parse --symbolic --abbrev-ref "$REFNAME")
        COMMITTER=$(git log -1 "$NEWREV" --pretty=format:%ce)
        MESSAGE=$(git log -1 "$NEWREV" --pretty=format:%s)

        echo "Sending webhook"
        curl "http://$SERVER_URL/add-commit?hash=$NEWREV$branch=$BRANCH"
}

if [ -n "$1" -a -n "$2" -a -n "$3" ]; then
  PAGER= trigger_hook $1 $2 $3
else
  while read oldrev newrev refname; do
    trigger_hook $oldrev $newrev $refname
  done
fi

为开发者

  • 克隆此仓库
  • 运行 touch database/database.sqlite
  • 创建包含以下代码的 .env 文件
  APP_ENV = dev
  • 运行 php artisan migrate:refresh
  • 启动服务器 ./artisan serve
  • 打开 http://localhost:8000/