Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] ci: Run ipfs/js-ipfs-http-client & ipfs/interop tests #5053

Closed
wants to merge 7 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 90 additions & 2 deletions ci/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ def build_platforms = [
['freebsd', 'amd64']
]

/* js-* tests */
def js_api_commit = 'v29.1.0'
def interop_commit = 'master'

def js_api_platforms = ['linux', 'macos']
def js_api_node_versions = ['10.4.1']

def yarn_version = '1.5.1'
def yarn_path = './node_modules/.bin/yarn'


/* PIPELINE UTILS */

def setupStep(nodeLabel, f) {
Expand Down Expand Up @@ -69,6 +80,7 @@ def gobuild_step = { list ->
run "go build -i -ldflags=\"-X github.com/ipfs/go-ipfs/repo/config.CurrentCommit=${env.SUBNAME}-${env.BUILD_NUMBER}\" -o cmd/ipfs/ipfs github.com/ipfs/go-ipfs/cmd/ipfs"
run "cp cmd/ipfs/ipfs cmd/ipfs/dist; cd cmd/ipfs/dist; tar -czvf ../go-ipfs_${env.GOOS}-${env.GOARCH}-${env.SUBNAME}-${env.BUILD_NUMBER}.tar.gz ."
archiveArtifacts artifacts: "cmd/ipfs/go-ipfs_${env.GOOS}-${env.GOARCH}-${env.SUBNAME}-${env.BUILD_NUMBER}.tar.gz", fingerprint: true
stash name: "ipfs-${env.GOOS}-${env.GOARCH}", includes: "cmd/ipfs/ipfs"
}
}
}
Expand Down Expand Up @@ -98,10 +110,72 @@ 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]]]

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) {
githubNotify description: "Running ${name}", status: 'PENDING', context: "continuous-integration/jenkins/${name}"

try {
stage(name.capitalize()) {
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}"
throw err
}

}

ansiColor('xterm') { withEnv(['TERM=xterm-color']) {
stage('Checks') {
reportedStage('checks') {
parallel(
'go fmt': {
setupStep('linux') { run ->
Expand Down Expand Up @@ -132,7 +206,8 @@ ansiColor('xterm') { withEnv(['TERM=xterm-color']) {
)
}

stage('Tests') {

reportedStage('tests') {
parallel(
'go build (other platforms)': {
gobuild_step(build_platforms)
Expand Down Expand Up @@ -201,4 +276,17 @@ ansiColor('xterm') { withEnv(['TERM=xterm-color']) {
//},
)
}

reportedStage('interop/apis') {
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)
steps["js-api-${os}-${nodeVer}"] = jsTestStep(os, nodeVer, 'https://github.com/ipfs/js-ipfs-api', js_api_commit)
}
}

parallel steps
}

}}