diff --git a/.appveyor.yml b/.appveyor.yml index 18fc957cb3..6bbc973641 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -54,4 +54,9 @@ install: - conan user # It creates the conan data directory test_script: + # - git fetch --unshallow + # - export BITPRIM_BUILD_NUMBER="$(git describe)" + - for /f %%i in ('git describe') do set BITPRIM_BUILD_NUMBER=%%i + - echo %BITPRIM_BUILD_NUMBER% + - python build.py diff --git a/.travis.yml b/.travis.yml index 0cd4d40743..60a048f1d0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,6 +44,9 @@ osx: &osx matrix: include: + - <<: *linux + env: PUSH_TO_REPOS=true + - <<: *linux env: CONAN_GCC_VERSIONS=4.9 CONAN_DOCKER_IMAGE=lasote/conangcc49 @@ -72,12 +75,28 @@ matrix: env: CONAN_APPLE_CLANG_VERSIONS=8.1 install: - - chmod +x .travis/install.sh - - ./.travis/install.sh + - cd ${TRAVIS_BUILD_DIR} + + - | + if [[ "${PUSH_TO_REPOS}" != "true" ]]; then + chmod +x .travis/install.sh + ./.travis/install.sh + fi script: - - chmod +x .travis/run.sh - - ./.travis/run.sh + - git fetch --unshallow + - export BITPRIM_BUILD_NUMBER="$(git describe)" + - echo "${BITPRIM_BUILD_NUMBER}" + + - | + if [[ "${PUSH_TO_REPOS}" == "true" ]]; then + chmod +x .travis/push_other_repo.sh + ./.travis/push_other_repo.sh + else + cd ${TRAVIS_BUILD_DIR} + chmod +x .travis/run.sh + ./.travis/run.sh + fi notifications: email: false diff --git a/.travis/push_other_repo.sh b/.travis/push_other_repo.sh new file mode 100644 index 0000000000..618bb1e178 --- /dev/null +++ b/.travis/push_other_repo.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +function replace_versions { + # echo $1 #project name + # echo $2 #build number + if [ ! -f versions.txt ]; then + echo "$1: $2" >> versions.txt + else + while read p; do + if [[ $p == *"$1:"* ]]; then + echo "$1: $2" >> versions.txt.t + else + echo $p >> versions.txt.t + fi + done /dev/null 2>&1 +git push --quiet --set-upstream origin-commit ${TRAVIS_BRANCH} diff --git a/CMakeLists.txt b/CMakeLists.txt index d24a3ab45a..917d360a8c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,7 +72,10 @@ set(WITH_FIELD "auto" CACHE STRING "Specify Field Implementation (64bit|32bit|au set(WITH_SCALAR "auto" CACHE STRING "Specify scalar implementation (64bit|32bit|auto).") set(WITH_BIGNUM "auto" CACHE STRING "Specify Bignum Implementation (gmp|mpir|no|auto).") -# message(${WITH_BIGNUM}) + +set(BITPRIM_BUILD_NUMBER "-" CACHE STRING "Specify the Bitprim Build Number.") +# message(${BITPRIM_BUILD_NUMBER}) + if (NOT NO_CONAN_AT_ALL) if(EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) diff --git a/build.py b/build.py index dd254f1b6e..5d5a5460ca 100644 --- a/build.py +++ b/build.py @@ -1,3 +1,4 @@ +import os from conan.packager import ConanMultiPackager if __name__ == "__main__": @@ -12,6 +13,9 @@ if settings["build_type"] == "Release" \ and not("secp256k1:shared" in options and options["secp256k1:shared"]) \ and (not "compiler.runtime" in settings or not settings["compiler.runtime"] == "MT"): + + env_vars["BITPRIM_BUILD_NUMBER"] = os.getenv('BITPRIM_BUILD_NUMBER', '-') + filtered_builds.append([settings, options, env_vars, build_requires]) builder.builds = filtered_builds diff --git a/conanfile.py b/conanfile.py index b57a8c0d73..2f731c32ee 100644 --- a/conanfile.py +++ b/conanfile.py @@ -133,6 +133,7 @@ def build(self): # cmake.definitions["WITH_BIGNUM"] = option_on_off(self.options.with_bignum) + cmake.definitions["BITPRIM_BUILD_NUMBER"] = os.getenv('BITPRIM_BUILD_NUMBER', '-') cmake.configure(source_dir=self.conanfile_directory) cmake.build()