added jenkins
This commit is contained in:
parent
7a741622a9
commit
b31d6188f9
32
jenkins.groovy
Normal file
32
jenkins.groovy
Normal file
@ -0,0 +1,32 @@
|
||||
import jobs.generation.Utilities;
|
||||
import jobs.generation.InternalUtilities;
|
||||
|
||||
def project = GithubProject
|
||||
def branch = GithubBranchName
|
||||
|
||||
[true, false].each { isPR ->
|
||||
def newJobName = InternalUtilities.getFullJobName(project, "Default", isPR)
|
||||
def newJob = job(newJobName) {
|
||||
steps {
|
||||
shell("./jenkins.sh ${isPR}")
|
||||
}
|
||||
|
||||
if (!isPR) {
|
||||
wrappers {
|
||||
credentialsBinding {
|
||||
string('PXT_ACCESS_TOKEN', 'pxt_access_token')
|
||||
string('PXT_RELEASE_REPO', 'pxt_release_repo_calliope')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Utilities.setMachineAffinity(newJob, 'Ubuntu', '20161020')
|
||||
InternalUtilities.standardJobSetup(newJob, project, isPR, "*/*")
|
||||
|
||||
if (isPR) {
|
||||
Utilities.addGithubPRTrigger(newJob, "Default Testing")
|
||||
} else {
|
||||
Utilities.addGithubPushTrigger(newJob)
|
||||
}
|
||||
}
|
55
jenkins.sh
Normal file
55
jenkins.sh
Normal file
@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Set up NVM
|
||||
export NVM_DIR="/home/dotnet-bot/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
|
||||
|
||||
nvm install 5
|
||||
|
||||
# Set up build environment variables
|
||||
echo ---------- Setting build environment variables
|
||||
echo Git branch: $GIT_BRANCH
|
||||
echo isPR: $1
|
||||
|
||||
originRegex="^origin/.*"
|
||||
branchRegex="^origin/\K.*(?=$)"
|
||||
|
||||
if [[ "$GIT_BRANCH" =~ $originRegex ]]; then
|
||||
branchName=$(echo ${GIT_BRANCH} | grep -oP $branchRegex)
|
||||
echo Setting TRAVIS_BRANCH to ${branchName}
|
||||
export TRAVIS_BRANCH=${branchName}
|
||||
else
|
||||
echo Setting TRAVIS_BRANCH to $GIT_BRANCH
|
||||
export TRAVIS_BRANCH=$GIT_BRANCH
|
||||
fi
|
||||
|
||||
if [ "$1" == "false" ]; then
|
||||
echo Setting TRAVIS_PULL_REQUEST to false
|
||||
export TRAVIS_PULL_REQUEST=false
|
||||
|
||||
if [ $TRAVIS_BRANCH == "master" ]; then
|
||||
if [[ -z $PXT_RELEASE_REPO ]]; then
|
||||
echo Cannot find release repo; skipping tag checks
|
||||
else
|
||||
gitTag=$(git describe --tags --exact-match 2> /dev/null)
|
||||
builtTag=$(git ls-remote --tags $PXT_RELEASE_REPO | grep -o "refs/tags/$gitTag$")
|
||||
|
||||
echo Current tag: $gitTag
|
||||
echo Built tag: $builtTag
|
||||
|
||||
if [[ ! -z $gitTag && -z $builtTag ]]; then
|
||||
echo Built tag not found; building tag
|
||||
echo Setting TRAVIS_BRANCH to $gitTag
|
||||
export TRAVIS_BRANCH=$gitTag
|
||||
echo Setting TRAVIS_TAG to $gitTag
|
||||
export TRAVIS_TAG=$gitTag
|
||||
else
|
||||
echo Not a tag build
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Perform build
|
||||
npm install
|
||||
npm test
|
@ -35,5 +35,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"pxt-core": "0.11.13"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node node_modules/pxt-core/built/pxt.js travis"
|
||||
}
|
||||
}
|
||||
|
@ -7,4 +7,3 @@ export KS_FORCE_CLOUD=yes
|
||||
(cd libs/lang-test0; node ../../node_modules/pxt-core/built/pxt.js test)
|
||||
(cd libs/lang-test1; node ../../node_modules/pxt-core/built/pxt.js test)
|
||||
node node_modules/pxt-core/built/pxt.js testdir tests
|
||||
(cd libs/hello; node ../../node_modules/pxt-core/built/pxt.js testconv https://az851932.vo.msecnd.net/files/td-converter-tests-v1.json)
|
||||
|
Loading…
Reference in New Issue
Block a user