Skip to content

Commit 83f7ca5

Browse files
committed
Add Jenkins CI job for Postject
Fixes: nodejs/postject#62 Signed-off-by: Darshan Sen <[email protected]>
1 parent c35bdd2 commit 83f7ca5

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#!/usr/bin/env groovy
2+
3+
pipeline {
4+
agent { label 'postject' }
5+
parameters{
6+
string(name: 'GITHUB_ORG', defaultValue: 'nodejs', description: 'The user/org of the GitHub repo')
7+
string(name: 'REPO_NAME', defaultValue: 'postject', description: 'The name of the repo')
8+
string(name: 'GIT_REMOTE_REF', defaultValue: 'refs/heads/main', description: 'The remote portion of the Git refspec to fetch and test')
9+
}
10+
11+
stages {
12+
stage("Setup repository") {
13+
steps {
14+
checkout(changelog: false, poll: false, scm: [
15+
$class: 'GitSCM',
16+
branches: [[
17+
name: 'refs/heads/_jenkins_local_branch'
18+
]],
19+
userRemoteConfigs: [[
20+
credentialsId: "96d5f81c-e9ad-45f7-ba5d-bc8107c0ae2c",
21+
url: "[email protected]:${params.GITHUB_ORG}/${params.REPO_NAME}",
22+
]]
23+
])
24+
}
25+
}
26+
27+
stage('Pre-flight') {
28+
steps {
29+
// Make sure we have these binaries in the path
30+
sh 'node --version'
31+
sh 'npm --version'
32+
sh 'git --version'
33+
sh 'cmake --version'
34+
sh 'ninja --version'
35+
}
36+
}
37+
38+
39+
stage('Build postject') {
40+
steps {
41+
// Calling with `returnStatus` suppresses automatic failures
42+
sh(script: "npm install", returnStatus: true)
43+
sh(script: "git clone https://github.com/emscripten-core/emsdk.git", returnStatus: true)
44+
sh(script: "(cd emsdk && ./emsdk install latest)", returnStatus: true)
45+
sh(script: "(cd emsdk && ./emsdk activate latest)", returnStatus: true)
46+
sh(script: "(cd emsdk && source ./emsdk_env.sh && cd .. && npm run build -- --jobs=3)", returnStatus: true)
47+
}
48+
}
49+
50+
stage('Lint') {
51+
steps {
52+
sh(script: "npm run lint", returnStatus: true)
53+
}
54+
}
55+
56+
stage('Run tests') {
57+
steps {
58+
sh(script: "npm test -- --reporter mocha-junit-reporter", returnStatus: true)
59+
}
60+
}
61+
}
62+
63+
post {
64+
success {
65+
sendBuildStatus("success", env)
66+
}
67+
68+
failure {
69+
sendBuildStatus("failure", env)
70+
}
71+
}
72+
}
73+
74+
def sendBuildStatus(status, env) {
75+
build job: 'post-build-status-update', parameters: [
76+
string(name: 'REPO', value: 'postject'),
77+
string(name: 'IDENTIFIER', value: 'linter'),
78+
string(name: 'URL', value: env.BUILD_URL),
79+
string(name: 'COMMIT', value: sh(script: 'git rev-parse HEAD', returnStdout: true).trim()),
80+
string(name: 'REF', value: env.GIT_REMOTE_REF),
81+
string(name: 'STATUS', value: status)
82+
]
83+
}

0 commit comments

Comments
 (0)