1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2024-12-26 01:18:21 +01:00
This commit is contained in:
Xuan Sang LE 2021-03-06 13:09:48 +01:00
parent dcb3803120
commit effcedb94e
5 changed files with 2 additions and 152 deletions

View File

@ -1,5 +1,5 @@
BUILDDIR?=./build
PROJS?=grs info blog os doc ci talk get oob
PROJS?=grs info blog os doc talk get
copyfiles = index.ls mimes.json
main: copy
for f in $(PROJS); do BUILDDIR=$(BUILDDIR)/"$${f}" make -C "$${f}" ; done
@ -19,4 +19,4 @@ ar:
clean:
-for f in $(PROJS); do rm -r $(BUILDDIR)/"$${f}"; done
-for f in $(copyfiles); do rm -r $(BUILDDIR)/"$${f}"; done
-rm -r $(BUILDDIR)/silk
-rm -r $(BUILDDIR)/silk

View File

@ -1,6 +0,0 @@
copyfiles = router.lua scripts
main:
- mkdir -p $(BUILDDIR)
cp -rvf $(copyfiles) $(BUILDDIR)
- mkdir -p $(BUILDDIR)/log

View File

@ -1,82 +0,0 @@
-- the rewrite rule for the framework
-- should be something like this
-- ^\/apps\/+(.*)$ = /apps/router.lua?r=<1>&<query>
-- some global variables
function fail(msg)
std.json()
std.t(JSON.encode({error=msg}))
end
function result(obj)
std.json()
std.t(JSON.encode({result=obj, error=false}))
end
DIR_SEP = "/"
WWW_ROOT = __ROOT__.."/ci"
if HEADER.Host then
HTTP_ROOT= "https://"..HEADER.Host
else
HTTP_ROOT = "https://ci.iohub.dev"
end
-- class path: path.to.class
BASE_FRW = ""
-- class path: path.to.class
CONTROLLER_ROOT = BASE_FRW.."ci.controllers"
MODEL_ROOT = BASE_FRW.."ci.models"
-- file path: path/to/file
VIEW_ROOT = WWW_ROOT..DIR_SEP.."views"
LOG_ROOT = WWW_ROOT..DIR_SEP.."logs"
-- require needed library
require(BASE_FRW.."silk.api")
function NotfoundController:index(...)
local args = {...}
if #args == 0 then
fail("Unknown action")
return false
end
local action = args[1]
if action == "BuildController" then
if REQUEST.json then
local request = JSON.decodeString(REQUEST.json)
if request.ref and request.ref == "refs/heads/ci" then
local branch = "ci"
local repository = request.repository.name
local path = WWW_ROOT..DIR_SEP.."scripts"..DIR_SEP..repository..".sh"
if ulib.exists(path) then
result("Build action triggered, log file will soon be available at: https://ci.iohub.dev/log/"..repository.."_"..branch..".txt")
os.execute("at now -f "..path)
else
fail("No build script found")
end
else
result("This action is ignored by the CI")
end
else
fail("Unknow action parameters")
end
else
fail("Action not supported: "..action)
end
end
-- registry object store global variables
local REGISTRY = {}
-- set logging level
REGISTRY.logger = Logger:new{ levels = {INFO = false, ERROR = false, DEBUG = false}}
REGISTRY.layout = 'default'
REGISTRY.fileaccess = true
local router = Router:new{registry = REGISTRY}
REGISTRY.router = router
router:setPath(CONTROLLER_ROOT)
--router:route('edit', 'post/edit', "ALL" )
router:route('default', default_routes_dependencies )
router:delegate()

View File

@ -1,31 +0,0 @@
#! /bin/bash
BRANCH="ci"
PRJ="antd-web-apps"
DEST="/opt/www/htdocs"
REPO="https://github.com/lxsang/$PRJ.git"
if [ ! -z $1 ]; then
BRANCH="$1"
fi
{
echo "Build date: $(date)"
echo "Building $PRJ using branch $BRANCH..."
if [ -d "/tmp/ci/$PRJ" ]; then
echo "Clean up /tmp/ci/$PRJ"
rm -rf /tmp/ci/$PRJ
else
echo "Creating /tmp/ci/"
mkdir -p "/tmp/ci"
fi
cd /tmp/ci || (echo "Unable to change directory to /tmp/ci" && exit 1)
echo "Cloning $PRJ (branch $BRANCH) to /tmp/ci..."
git clone -b "$BRANCH" --single-branch --depth=1 "$REPO"
cd "$PRJ" || (echo "Unable to change directory to source code folder" && exit 1)
mkdir -p "$DEST"
BUILDDIR="$DEST" make
echo "Done!"
} 2>&1 | tee "/opt/www/htdocs/ci/log/${PRJ}_${BRANCH}.txt"

View File

@ -1,31 +0,0 @@
#! /bin/bash
BRANCH="ci"
PRJ="antos"
DEST="/opt/www/htdocs/"
# /opt/www/htdocs
REPO="https://github.com/lxsang/$PRJ.git"
if [ ! -z $1 ]; then
BRANCH="$1"
fi
{
echo "Build date: $(date)"
echo "Building $PRJ using branch $BRANCH..."
if [ -d "/tmp/ci/$PRJ" ]; then
echo "Clean up /tmp/ci/$PRJ"
rm -rf /tmp/ci/$PRJ
else
echo "Creating /tmp/ci/"
mkdir -p "/tmp/ci"
fi
cd /tmp/ci || (echo "Unable to change directory to /tmp/ci" && exit 1)
echo "Cloning $PRJ (branch $BRANCH) to /tmp/ci..."
git clone -b "$BRANCH" --single-branch --depth=1 "$REPO"
cd "$PRJ" || (echo "Unable to change directory to source code folder" && exit 1)
npm i @types/jquery
mkdir -p "$DEST/os"
BUILDDIR="$DEST/os" make release
mkdir -p "$DEST/grs"
BUILDDIR="$DEST/grs" make standalone_tags
echo "Done!"
} 2>&1 | tee "/opt/www/htdocs/ci/log/${PRJ}_${BRANCH}.txt"