mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-30 20:07:36 +00:00
Setup automated builds.
This commit is contained in:
1 parent
9ff73e5e63
commit
3da1c4381c
3 files changed
+71
-12
No files matched your search
@@ -188,47 +188,68 @@ task("test-only", function()
|
||||
OS.exit(code);
|
||||
});
|
||||
|
||||
task("push-packages", ["CommonJS", "push-cappuccino", "push-objective-j"]);
|
||||
task("push-packages", ["push-cappuccino", "push-objective-j"]);
|
||||
|
||||
task("push-cappuccino", function() {
|
||||
pushPackage(
|
||||
$BUILD_CJS_CAPPUCCINO,
|
||||
"git@github.com:280north/cappuccino-package.git"
|
||||
"git@github.com:280north/cappuccino-package.git",
|
||||
SYSTEM.env["PACKAGE_BRANCH"]
|
||||
);
|
||||
});
|
||||
|
||||
task("push-objective-j", function() {
|
||||
pushPackage(
|
||||
$BUILD_CJS_OBJECTIVE_J,
|
||||
"git@github.com:280north/objective-j-package.git"
|
||||
"git@github.com:280north/objective-j-package.git",
|
||||
SYSTEM.env["PACKAGE_BRANCH"]
|
||||
);
|
||||
});
|
||||
|
||||
function pushPackage(path, remote)
|
||||
function pushPackage(path, remote, branch)
|
||||
{
|
||||
stream.print("Pushing \0blue(" + path + "\0) to \0blue(" + remote + "\0)");
|
||||
branch = branch || "master";
|
||||
|
||||
stream.print("Pushing \0blue(" + path + "\0) to "+branch+" of \0blue(" + remote + "\0)");
|
||||
|
||||
FILE.mkdirs(".push-package");
|
||||
|
||||
var pushPackageDir = FILE.join(".push-package", remote.replace(/[^\w]/g, "_"));
|
||||
|
||||
if (FILE.exists(pushPackageDir))
|
||||
OS.system(buildCommandString([["cd", pushPackageDir], ["git", "pull"]]));
|
||||
OS.system(buildCmd([["cd", pushPackageDir], ["git", "fetch"]]));
|
||||
else
|
||||
OS.system(["git", "clone", remote, pushPackageDir]);
|
||||
|
||||
OS.system("cd "+OS.enquote(pushPackageDir)+" && git rm --ignore-unmatch -r * && rm -rf *");
|
||||
OS.system("cp -R "+OS.enquote(path)+"/* "+OS.enquote(pushPackageDir)+"/.");
|
||||
if (OS.system(buildCmd([["cd", pushPackageDir], ["git", "checkout", "origin/"+branch]]))) {
|
||||
if (OS.system(buildCmd([
|
||||
["cd", pushPackageDir],
|
||||
["git", "symbolic-ref", "HEAD", "refs/heads/"+branch],
|
||||
["rm", ".git/index"],
|
||||
["git", "clean", "-fdx"]
|
||||
])))
|
||||
throw "pushPackage failed";
|
||||
}
|
||||
|
||||
OS.system(buildCommandString([
|
||||
if (OS.system("cd "+OS.enquote(pushPackageDir)+" && git rm --ignore-unmatch -r * && rm -rf *"))
|
||||
throw "pushPackage failed";
|
||||
if (OS.system("cp -R "+OS.enquote(path)+"/* "+OS.enquote(pushPackageDir)+"/."))
|
||||
throw "pushPackage failed";
|
||||
|
||||
OS.system(buildCmd([
|
||||
["cd", pushPackageDir],
|
||||
["git", "add", "."],
|
||||
["git", "commit", "-m", "Pushed on " + new Date()],
|
||||
["git", "push", "origin", "master"]
|
||||
["git", "commit", "-m", "Pushed on " + new Date()]
|
||||
]));
|
||||
|
||||
if (OS.system(buildCmd([
|
||||
["cd", pushPackageDir],
|
||||
["git", "push", "origin", "HEAD:"+branch]
|
||||
])))
|
||||
throw "pushPackage failed";
|
||||
}
|
||||
|
||||
function buildCommandString(arrayOfCommands)
|
||||
function buildCmd(arrayOfCommands)
|
||||
{
|
||||
return arrayOfCommands.map(function(cmd) {
|
||||
return cmd.map(OS.enquote).join(" ");
|
||||
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
project_home="$(dirname "$PWD")"
|
||||
|
||||
export PATH="$HOME/narwhal/bin:$PATH"
|
||||
|
||||
export CAPP_BUILD=$project_home/build_incremental
|
||||
time jake test
|
||||
code=$?
|
||||
if [ $code -ne 0 ]; then
|
||||
echo "INCREMENTAL BUILD FAILED ($code)"
|
||||
exit $code
|
||||
else
|
||||
echo "INCREMENTAL BUILD SUCCEEDED"
|
||||
fi
|
||||
|
||||
export CAPP_BUILD=$project_home/build_clean
|
||||
rm -rf $CAPP_BUILD
|
||||
|
||||
time jake CommonJS test
|
||||
code=$?
|
||||
if [ $code -ne 0 ]; then
|
||||
echo "CLEAN BUILD FAILED ($code)"
|
||||
exit $code
|
||||
else
|
||||
echo "CLEAN BUILD SUCCEEDED"
|
||||
fi
|
||||
|
||||
PACKAGE_BRANCH="nightly" jake push-packages
|
||||
code=$?
|
||||
if [ $code -ne 0 ]; then
|
||||
echo "NIGHTLY BUILD PUSH FAILED ($code)"
|
||||
exit $code
|
||||
else
|
||||
echo "NIGHTLY BUILD PUSH SUCCEEDED"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
File renamed without changes.
Reference in new issue
Block a user