go-waku/ci/Jenkinsfile.nix-flake
Jakub Sokołowski 349e22bbe8
nix: add Nix flake to build node and library
This way we can build node or the library locally using:
```sh
nix build
nix build .#node
nix build .#library
```
Or just start a shell with Go `1.19.x` using:
```
nix develop
```
Which simply has the same environment as the build shell for the node.

One known snag is that there is currently no simple way to keep `vendorSha256`
updated to match the contents of `go.mod` and `go.sum`. For more details see:
https://discourse.nixos.org/t/how-should-i-build-a-go-package-from-local-source/19490/8

One way around this would be to have our own `vendor` folder, but that's
also a pretty ugly solution that requires manual updating.

Resolves:
https://github.com/waku-org/go-waku/issues/256

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-03-05 15:04:07 +01:00

71 lines
1.5 KiB
Plaintext

library 'status-jenkins-lib@v1.6.8'
pipeline {
agent {
label 'linux'
}
options {
timestamps()
disableConcurrentBuilds()
/* Prevent Jenkins jobs from running forever */
timeout(time: 30, unit: 'MINUTES')
/* Limit builds retained */
buildDiscarder(logRotator(
numToKeepStr: '10',
daysToKeepStr: '20',
artifactNumToKeepStr: '10',
))
}
environment {
TARGET = 'nix-flake'
}
stages {
stage('Node') {
stages {
stage('Build') {
steps { script {
sh("""#!/usr/bin/env bash
${nix._sourceProfileInline()}
nix build --print-out-paths .#node
""")
} }
}
stage('Check') {
steps {
sh './result/bin/waku --version'
}
}
}
}
stage('Library') {
stages {
stage('Build') {
steps { script {
sh("""#!/usr/bin/env bash
${nix._sourceProfileInline()}
nix build --print-out-paths .#library
""")
} }
}
stage('Check') {
steps {
sh 'ldd ./result/bin/library'
}
}
}
}
}
post {
always { script { /* No artifact but a PKG_URL is necessary. */
env.PKG_URL = "${currentBuild.absoluteUrl}/consoleText"
} }
success { script { github.notifyPR(true) } }
failure { script { github.notifyPR(false) } }
cleanup { cleanWs() }
}
}