ci: add Jenkinsfile for running tests on macos

Also adds a `Makefile` to seaprate out the building of compiler.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2022-12-02 13:00:37 +01:00
parent eb5868e069
commit 72a9c4dd56
No known key found for this signature in database
GPG Key ID: FE65CD384D5BF7B4
3 changed files with 94 additions and 0 deletions

4
.gitignore vendored
View File

@ -3,3 +3,7 @@ build/
nimble.develop
nimble.paths
ci/build_nim.sh
ci/NimBinaries/
ci/nim/

62
ci/Jenkinsfile vendored Normal file
View File

@ -0,0 +1,62 @@
pipeline {
agent { label 'macos && aarch64' }
options {
disableConcurrentBuilds()
/* manage how many builds we keep */
buildDiscarder(logRotator(
numToKeepStr: '20',
daysToKeepStr: '30',
))
}
environment {
/* Nim has to be built in Compiler stage. */
PATH = "${PATH}:${WORKSPACE}/ci/nim/bin"
}
stages {
stage('Modules') {
steps {
sh 'git submodule update --init'
}
}
stage('Compiler') {
steps {
sh 'make -C ci compiler'
}
}
stage('Deps') {
steps {
sh 'nimble install -y --depsOnly'
}
}
stage('Tests') {
parallel {
stage('C') {
environment {
NIMLANG = 'c'
}
steps {
sh 'nimble test'
}
}
stage('C++') {
environment {
NIMLANG = 'cpp'
}
steps {
sh 'nimble test'
}
}
}
}
}
post {
always { cleanWs() }
}
}

28
ci/Makefile Normal file
View File

@ -0,0 +1,28 @@
NIM_BUILD_SCRIPT_URL = https://raw.githubusercontent.com/status-im/nimbus-build-system/master/scripts/build_nim.sh
NIM_BUILD_SCRIPT = build_nim.sh
NPROC ?= $(shell nproc)
MAKEFLAGS ?= -j$(NPROC)
ifeq ($(detected_OS),Darwin)
NCPU = $(shell sysctl -n hw.ncpu)
else ifeq ($(OS),Windows_NT)
NCPU = $(NUMBER_OF_PROCESSORS)
MAKE_CMD = mingw32-make
else ifneq ($(detected_OS),Linux)
NCPU = $(shell nproc)
else
NCPU = 1
MAKE_CMD = make
endif
compiler: NIM_COMMIT ?= version-1-6
compiler: QUICK_AND_DIRTY_COMPILER ?= 1
compiler: QUICK_AND_DIRTY_NIMBLE ?= 1
compiler: CC ?= gcc
compiler: $(NIM_BUILD_SCRIPT)
./build_nim.sh nim csources dist/nimble NimBinaries
$(NIM_BUILD_SCRIPT):
curl -LSs $(NIM_BUILD_SCRIPT_URL) -o $(NIM_BUILD_SCRIPT)
chmod +x $(NIM_BUILD_SCRIPT)