Skip to content

Commit

Permalink
ci: Run interop tests
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
  • Loading branch information
magik6k authored and Stebalien committed Feb 8, 2019
1 parent df1fc22 commit ba62255
Showing 1 changed file with 65 additions and 48 deletions.
113 changes: 65 additions & 48 deletions ci/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ def build_platforms = [
['freebsd', 'amd64']
]

// js-ipfs-api tests
def js_api_commit = '7e78ee232bea8e5ea92bcfcff949b4ed671c2d50' // 22.0.1
/* js-* tests */
def js_api_commit = '80452eb62903bf405a9085cd14a233da8a5e31a4' // 22.3.0
def interop_commit = '6593ccdca5d7b4c747787f71f7ac4b5f6f1ab10b'

def js_api_platforms = ['linux', 'macos']
def js_api_node_versions = ['8.11.1', '9.2.0']
def js_api_node_versions = ['8.11.3', '10.4.1']

def yarn_version = '1.5.1'
def yarn_path = './node_modules/.bin/yarn'
Expand Down Expand Up @@ -108,6 +110,55 @@ def sharness_step = { run, osname, makeargs, ignore ->
}
}

/* JS BASED TESTS */

def jsTestStep = { os, nodeVer, repo, commit ->
return { ->
setupStep(os) {
switch (os) {
case "linux":
unstash("ipfs-linux-amd64")
break
case "macos":
unstash("ipfs-darwin-amd64")
break
}

withEnv(['IPFS_GO_EXEC=../cmd/ipfs/ipfs', 'CI=true']) {
dir('.js-test') {
checkout changelog: false, scm: [$class: 'GitSCM', branches: [[name: commit]], userRemoteConfigs: [[url: repo]]]

//todo: deduplicate with https://github.com/ipfs/jenkins-libs/blob/master/vars/javascript.groovy somehow

fileExists 'package.json'
nodejs(nodeVer) {
sh 'rm -rf node_modules/'
sh 'npm install yarn@' + yarn_version
sh yarn_path + ' --mutex network --no-lockfile'
def runTest = { ->
try {
sh yarn_path + ' test'
} catch(_) {
} finally {
junit allowEmptyResults: true, testResults: 'junit-report-*.xml'
cleanWs()
}
}

if (os == "linux") {
wrap([$class: 'Xvfb', parallelBuild: true, autoDisplayName: true]) {
runTest()
}
} else {
runTest()
}
}
}
}
}
}
}

/* PIPELINE */

def reportedStage(name, fn) {
Expand All @@ -119,7 +170,7 @@ def reportedStage(name, fn) {
}
githubNotify description: "${name.capitalize()} passed", status: 'SUCCESS', context: "continuous-integration/jenkins/${name}"
} catch (err) {
githubNotify description: '${name.capitalize()} failed', status: 'FAILURE', context: "continuous-integration/jenkins/${name}"
githubNotify description: "${name.capitalize()} failed", status: 'FAILURE', context: "continuous-integration/jenkins/${name}"
throw err
}

Expand Down Expand Up @@ -228,56 +279,22 @@ ansiColor('xterm') { withEnv(['TERM=xterm-color']) {
)
}

reportedStage('apis') {
def jsApiStep = { os, nodeVer ->
return { ->
setupStep(os) {
switch (os) {
case "linux":
unstash("ipfs-linux-amd64")
break
case "macos":
unstash("ipfs-darwin-amd64")
break
}

withEnv(['IPFS_GO_EXEC=../cmd/ipfs/ipfs', 'CI=true']) {
dir('.js-ipfs-api') {
checkout changelog: false, scm: [$class: 'GitSCM', branches: [[name: "${js_api_commit}"]], userRemoteConfigs: [[url: 'https://github.com/ipfs/js-ipfs-api']]]

//todo: deduplicate with https://github.com/ipfs/jenkins-libs/blob/master/vars/javascript.groovy somehow

fileExists 'package.json'
nodejs(nodeVer) {
sh 'rm -rf node_modules/'
sh 'npm install yarn@' + yarn_version
sh yarn_path + ' --mutex network --no-lockfile'
def runTest = { ->
try {
sh yarn_path + ' test'
} finally {
junit allowEmptyResults: true, testResults: 'junit-report-*.xml'
}
}

if (os == "linux") {
wrap([$class: 'Xvfb', parallelBuild: true, autoDisplayName: true]) {
runTest()
}
} else {
runTest()
}
}
}
}
}
reportedStage('interop') {
def steps = [:]
js_api_platforms.each {os ->
js_api_node_versions.each { nodeVer ->
steps["interop-${os}-${nodeVer}"] = jsTestStep(os, nodeVer, 'https://github.com/ipfs/interop', interop_commit)
}
}

parallel steps
}

reportedStage('apis') {
def steps = [:]
js_api_platforms.each {os ->
js_api_node_versions.each { nodeVer ->
steps["js-api-${os}-${nodeVer}"] = jsApiStep(os, nodeVer)
steps["js-api-${os}-${nodeVer}"] = jsTestStep(os, nodeVer, 'https://github.com/ipfs/js-ipfs-api', js_api_commit)
}
}

Expand Down

0 comments on commit ba62255

Please sign in to comment.