js-waku-lab/ci/Jenkinsfile

88 lines
2.5 KiB
Plaintext
Raw Normal View History

2024-01-08 23:01:53 +00:00
pipeline {
agent {
dockerfile {
label 'linux'
dir 'ci'
2024-04-02 14:28:38 +00:00
args '-v /home/jenkins/.ssh/known_hosts:/home/jenkins/.ssh/known_hosts:ro'
2024-01-08 23:01:53 +00:00
}
}
options {
disableConcurrentBuilds()
/* manage how many builds we keep */
buildDiscarder(logRotator(
numToKeepStr: '20',
daysToKeepStr: '30',
))
}
environment {
SITE_DOMAIN = 'lab.waku.org'
2024-01-08 23:01:53 +00:00
GIT_AUTHOR_NAME = 'status-im-auto'
GIT_AUTHOR_EMAIL = 'auto@status.im'
PUPPETEER_SKIP_DOWNLOAD = 'true'
}
stages {
stage('Pre') {
steps {
sh 'npm install --silent'
/* TODO: Build the main page. */
sh 'mkdir -p build/docs'
sh 'cp index.html build/docs/'
}
}
stage('Examples') {
parallel {
stage('experimental/web-chat') { steps { script { buildExample() } } }
stage('experimental/noise-js') { steps { script { buildExample() } } }
stage('experimental/noise-rtc') { steps { script { buildExample() } } }
stage('experimental/relay-direct-rtc') { steps { script { buildExample() } } }
stage('experimental/rln-js') { steps { script { buildExample() } } }
stage('experimental/rln-identity') { steps { script { buildExample() } } }
2024-07-22 23:40:27 +00:00
stage('dogfooding') { steps { script { buildExample() } } }
2024-10-01 09:43:30 +00:00
stage('message-monitor') { steps { script { buildExample() } } }
2024-10-29 11:13:38 +00:00
stage('flush-notes') { steps { script { buildExample(example='flush-notes', outDir='out') } } }
stage('buddybook') { steps { script { buildExample(example='buddybook', outDir='dist') } } }
2024-01-08 23:01:53 +00:00
}
}
stage('HTML Examples') {
parallel {
stage('experimental/relay-js') { steps { script { copyExample() } } }
stage('experimental/light-js') { steps { script { copyExample() } } }
2024-01-08 23:01:53 +00:00
}
}
stage('Publish') {
steps { script {
sh "echo ${SITE_DOMAIN} > build/docs/CNAME"
sshagent(credentials: ['status-im-auto-ssh']) {
sh 'node ci/deploy.js'
}
} }
}
}
2024-04-02 14:31:25 +00:00
post {
always { cleanWs() }
}
2024-01-08 23:01:53 +00:00
}
2024-10-29 11:17:35 +00:00
def buildExample(example=STAGE_NAME, outDir='build') {
2024-01-08 23:01:53 +00:00
def dest = "${WORKSPACE}/build/docs/${example}"
dir("examples/${example}") {
sh 'npm install --silent'
sh 'npm run build'
sh "mkdir -p ${dest}"
2024-10-29 10:47:55 +00:00
sh "cp -r ${outDir}/. ${dest}"
2024-10-29 10:31:56 +00:00
}
}
2024-01-08 23:01:53 +00:00
def copyExample(example=STAGE_NAME) {
def source = "examples/${example}"
def dest = "build/docs/${example}"
sh "mkdir -p ${dest}"
sh "cp -r ${source}/. ${dest}"
}