From 1f2931582cf19abc118c0b75bb024d25c637e51f Mon Sep 17 00:00:00 2001 From: markoburcul Date: Mon, 4 Nov 2024 16:46:25 +0100 Subject: [PATCH] ci: add jenkinsfile Define a CI build that will test the build process with system nim compiler on the master branch. Referenced issue: https://github.com/codex-storage/nim-codex/issues/940 Signed-off-by: markoburcul --- .gitignore | 1 + Jenkinsfile | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 1 + 3 files changed, 52 insertions(+) create mode 100644 Jenkinsfile diff --git a/.gitignore b/.gitignore index 1b8885e0..ce7c9f30 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ !LICENSE* !Makefile +!Jenkinsfile nimcache/ diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..6e476f7f --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,50 @@ +#!/usr/bin/env groovy +library 'status-jenkins-lib@v1.9.13' + +pipeline { + agent { label 'linux' } + + options { + disableConcurrentBuilds() + /* manage how many builds we keep */ + buildDiscarder(logRotator( + numToKeepStr: '20', + daysToKeepStr: '30', + )) + } + + parameters { + choice( + name: 'VERBOSE', + description: 'Level of verbosity based on nimbus-build-system setup.', + choices: ['0', '1', '2'] + ) + choice( + name: 'USE_SYSTEM_NIM', + description: 'Decides whether to use system Nim compiler provided with Nix or not.', + choices: ['0', '1'] + ) + } + + environment { + /* Improve make performance */ + NUMPROC = "${sh(script: 'nproc', returnStdout: true).trim()}" + MAKEFLAGS = "-j${env.NUMPROC} V=${params.VERBOSE}" + /* Use system Nim compiler */ + USE_SYSTEM_NIM = "${params.USE_SYSTEM_NIM}" + } + + stages { + stage('Build') { + steps { + script { + nix.develop('make', keepEnv: [ 'MAKEFLAGS', 'USE_SYSTEM_NIM' ]) + } + } + } + } + + post { + cleanup { cleanWs() } + } +} diff --git a/flake.nix b/flake.nix index 8778ca4a..cf4a0ed6 100644 --- a/flake.nix +++ b/flake.nix @@ -24,6 +24,7 @@ git pkg-config openssl lsb-release # Build rustc cargo nimble gcc11 cmake nim-unwrapped-1 + which # Libraries gmp llvmPackages.openmp # Tests