diff --git a/.gitignore b/.gitignore index 89927ba..450b587 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,7 @@ build/ nimble.develop nimble.paths + +ci/build_nim.sh +ci/NimBinaries/ +ci/nim/ diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile new file mode 100644 index 0000000..708b09c --- /dev/null +++ b/ci/Jenkinsfile @@ -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() } + } +} diff --git a/ci/Makefile b/ci/Makefile new file mode 100644 index 0000000..9b28870 --- /dev/null +++ b/ci/Makefile @@ -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)