diff --git a/.appveyor.yml b/.appveyor.yml index 161e73fee5..d27694e6c4 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -25,6 +25,8 @@ branches: - /^release-\d+\.\d+\.\d+$/ - /^feature-ci-.+$/ - /^feature_ci_.+$/ + - /^feature-appveyor-.+$/ + - /^feature_appveyor_.+$/ build: false diff --git a/.travis.yml b/.travis.yml index 92e6c5b6b1..12e8e02a27 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,11 +20,14 @@ branches: only: # - master + # - /^v\d+\.\d+\.\d+$/ - dev - - /^v\d+\.\d+\.\d+$/ - /^release-\d+\.\d+\.\d+$/ + - /^hotfix-\d+\.\d+\.\d+$/ - /^feature-ci-.+$/ - /^feature_ci_.+$/ + - /^feature-travis-.+$/ + - /^feature_travis_.+$/ linux: &linux os: linux @@ -38,55 +41,6 @@ osx: &osx os: osx language: generic -matrix: - include: - # - <<: *linux - # env: PUSH_TO_REPOS=true - - # Linux, GCC, libstdc++ ------------------------------------------------------ - - <<: *linux - env: CONAN_GCC_VERSIONS=8 CONAN_DOCKER_IMAGE=lasote/conangcc8 - BITPRIM_RUN_TESTS=true - - - <<: *linux - env: CONAN_GCC_VERSIONS=7 CONAN_DOCKER_IMAGE=lasote/conangcc7 - - - <<: *linux - env: CONAN_GCC_VERSIONS=6 CONAN_DOCKER_IMAGE=lasote/conangcc6 - - - <<: *linux - env: CONAN_GCC_VERSIONS=5 CONAN_DOCKER_IMAGE=lasote/conangcc5 - - # - <<: *linux - # env: CONAN_GCC_VERSIONS=4.9 CONAN_DOCKER_IMAGE=lasote/conangcc49 - - # Linux, Clang, libstdc++ ---------------------------------------------------- - - <<: *linux - env: CONAN_CLANG_VERSIONS=6.0 CONAN_DOCKER_IMAGE=lasote/conanclang60 - - - <<: *linux - env: CONAN_CLANG_VERSIONS=5.0 CONAN_DOCKER_IMAGE=lasote/conanclang50 - - - <<: *linux - env: CONAN_CLANG_VERSIONS=4.0 CONAN_DOCKER_IMAGE=lasote/conanclang40 - - # - <<: *linux - # env: CONAN_CLANG_VERSIONS=3.9 CONAN_DOCKER_IMAGE=lasote/conanclang39 - - # macOS, apple-Clang, libc++ ------------------------------------------------- - - <<: *osx - osx_image: xcode9 - env: CONAN_APPLE_CLANG_VERSIONS=9.0 - BITPRIM_RUN_TESTS=true - - - <<: *osx - osx_image: xcode8.3 - env: CONAN_APPLE_CLANG_VERSIONS=8.1 - - - <<: *osx - osx_image: xcode7.3 - env: CONAN_APPLE_CLANG_VERSIONS=7.3 - before_install: - | if [[ "${TRAVIS_COMMIT_MESSAGE}" = *"[skip travis]"* ]]; then @@ -104,26 +58,40 @@ install: fi script: + # - python ci_utils/print_version.py + - export BITPRIM_BRANCH="${TRAVIS_BRANCH}" - git fetch --unshallow - - export BITPRIM_BUILD_NUMBER="$(git describe)" - - echo "${BITPRIM_BUILD_NUMBER}" + # - export BITPRIM_BUILD_NUMBER="$(git describe)" + # - export BITPRIM_BUILD_NUMBER="$(python ci_utils/print_version.py)" + # - export BITPRIM_CONAN_VERSION="${BITPRIM_BUILD_NUMBER}" + # - echo "${BITPRIM_BUILD_NUMBER}" + # - echo "${BITPRIM_CONAN_VERSION}" + - | echo "${TRAVIS_BRANCH}" if [[ "${TRAVIS_BRANCH}" = "dev" ]]; then export BITPRIM_CONAN_CHANNEL="testing" + export BITPRIM_FULL_BUILD=0 elif [[ "${TRAVIS_BRANCH}" = "release"* ]]; then export BITPRIM_CONAN_CHANNEL="stable" + export BITPRIM_FULL_BUILD=1 + elif [[ "${TRAVIS_BRANCH}" = "hotfix"* ]]; then + export BITPRIM_CONAN_CHANNEL="stable" + export BITPRIM_FULL_BUILD=1 elif [[ "${TRAVIS_BRANCH}" = "feature"* ]]; then export BITPRIM_CONAN_CHANNEL="${TRAVIS_BRANCH}" + export BITPRIM_FULL_BUILD=0 else export BITPRIM_CONAN_CHANNEL="stable" + export BITPRIM_FULL_BUILD=1 fi - echo "${BITPRIM_CONAN_CHANNEL}" + # echo "${BITPRIM_CONAN_CHANNEL}" + # echo "${BITPRIM_FULL_BUILD}" - # if [ -e conan_channel ] then - # echo "Creating conan_channel file" - # printf "${BITPRIM_CONAN_CHANNEL}" > conan_channel + # if [ ! -f conan_version ]; then + # echo "Creating conan_version file" + # printf "${BITPRIM_BUILD_NUMBER}" > conan_version # fi @@ -137,6 +105,178 @@ script: ./ci_utils/.travis/run.sh fi +jobs: + include: + +# Static Checks ------------------------------------------------------ + - stage: static checks + install: skip + # script: + # - chmod +x .travis/push_other_repo.sh + # - ./.travis/push_other_repo.sh + + script: echo "Running checks (1)" + # script: + # - export BITPRIM_BRANCH="${TRAVIS_BRANCH}" + # - git fetch --unshallow + # # - export BITPRIM_BUILD_NUMBER="$(git describe)" + # - export BITPRIM_BUILD_NUMBER="$(python ci_utils/print_version.py)" + # - echo "${BITPRIM_BUILD_NUMBER}" + +# Unit Tests ------------------------------------------------------ + - stage: unit tests + os: linux + sudo: required + language: python + python: "3.6" + services: + - docker + env: CONAN_GCC_VERSIONS=7 CONAN_DOCKER_IMAGE=lasote/conangcc7 CONAN_UPLOAD="" + BITPRIM_RUN_TESTS=true + +# Builds ------------------------------------------------------ + # Linux, GCC, libstdc++ ------------------------------------------------------ + - stage: build and upload binaries + os: linux + sudo: required + language: python + python: "3.6" + services: + - docker + env: CONAN_GCC_VERSIONS=8 CONAN_DOCKER_IMAGE=lasote/conangcc8 + if: branch =~ /^(release|hotfix).+$/ + + - stage: build and upload binaries + os: linux + sudo: required + language: python + python: "3.6" + services: + - docker + env: CONAN_GCC_VERSIONS=7 CONAN_DOCKER_IMAGE=lasote/conangcc7 + + - stage: build and upload binaries + os: linux + sudo: required + language: python + python: "3.6" + services: + - docker + env: CONAN_GCC_VERSIONS=6 CONAN_DOCKER_IMAGE=lasote/conangcc6 + if: branch =~ /^(release|hotfix).+$/ + + - stage: build and upload binaries + os: linux + sudo: required + language: python + python: "3.6" + services: + - docker + env: CONAN_GCC_VERSIONS=5 CONAN_DOCKER_IMAGE=lasote/conangcc5 + if: branch =~ /^(release|hotfix).+$/ + + + # - stage: build and upload binaries + # os: linux + # sudo: required + # language: python + # python: "3.6" + # services: + # - docker + # env: CONAN_GCC_VERSIONS=4.9 CONAN_DOCKER_IMAGE=lasote/conangcc49 + # if: branch =~ /^(release|hotfix).+$/ + + + # Linux, Clang, libstdc++ ---------------------------------------------------- + - stage: build and upload binaries + os: linux + sudo: required + language: python + python: "3.6" + services: + - docker + env: CONAN_CLANG_VERSIONS=6.0 CONAN_DOCKER_IMAGE=lasote/conanclang60 + + - stage: build and upload binaries + os: linux + sudo: required + language: python + python: "3.6" + services: + - docker + env: CONAN_CLANG_VERSIONS=5.0 CONAN_DOCKER_IMAGE=lasote/conanclang50 + if: branch =~ /^(release|hotfix).+$/ + + - stage: build and upload binaries + os: linux + sudo: required + language: python + python: "3.6" + services: + - docker + env: CONAN_CLANG_VERSIONS=4.0 CONAN_DOCKER_IMAGE=lasote/conanclang40 + if: branch =~ /^(release|hotfix).+$/ + + # - stage: build and upload binaries + # os: linux + # sudo: required + # language: python + # python: "3.6" + # services: + # - docker + # env: CONAN_CLANG_VERSIONS=3.9 CONAN_DOCKER_IMAGE=lasote/conanclang39 + + # macOS, apple-Clang, libc++ ------------------------------------------------- + - stage: build and upload binaries + os: osx + language: generic + osx_image: xcode9 + env: CONAN_APPLE_CLANG_VERSIONS=9.0 BITPRIM_RUN_TESTS=true + + - stage: build and upload binaries + os: osx + language: generic + osx_image: xcode8.3 + env: CONAN_APPLE_CLANG_VERSIONS=8.1 + if: branch =~ /^(release|hotfix).+$/ + + - stage: build and upload binaries + os: osx + language: generic + osx_image: xcode7.3 + env: CONAN_APPLE_CLANG_VERSIONS=7.3 + if: branch =~ /^(release|hotfix).+$/ + + +# Push to repos ------------------------------------------------------ + - stage: push to repos + install: skip + # script: echo "Running push to repos" + script: + - chmod +x .travis/push_other_repo.sh + - ./.travis/push_other_repo.sh + + +# # Integration Tests ------------------------------------------------------ +# - stage: integration tests +# install: skip +# script: echo "Running integration tests (Guille)" + + + # - stage: deploy to staging + # install: skip + # script: skip + # - stage: test staging + # install: skip + # script: 'curl http://sf-stages-staging.herokuapp.com' + # - stage: deploy to production + # install: skip + # script: skip + # - stage: test production + # install: skip + # script: 'curl http://sf-stages-production.herokuapp.com' + + notifications: email: false webhooks: diff --git a/.travis/push_other_repo.sh b/.travis/push_other_repo.sh index 4bdf94d877..939cd03e07 100644 --- a/.travis/push_other_repo.sh +++ b/.travis/push_other_repo.sh @@ -1,109 +1,60 @@ #!/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 > version.py.t - # echo "__version__ = '1.1.9'" | perl -pe 's/\b(\d+)(?=\D*$)/$1+1/e' - echo $p | perl -pe 's/\b(\d+)(?=\D*$)/$1+1/e' >> version.py.t - else - echo $p >> version.py.t - fi - done /dev/null 2>&1 -git push --quiet --set-upstream origin-commit ${TRAVIS_BRANCH} || true -cd .. +# TODO(fernando): put in another place +export BITPRIM_PUSH_ACCOUNT=bitprim +export BITPRIM_PUSH_PROJECT=bitprim-core +# body="{ +# \"accountName\": \"bitprim\", +# \"projectSlug\": \"bitprim-core\", +# \"branch\": \"${BITPRIM_PUSH_BRANCH}\", +# \"environmentVariables\": { +# \"SKIP_NUGET\": \"true\" +# } +# }" -# -------------------------------------------------------------------------------------------------------------------- -# bitprim-node-cint -# -------------------------------------------------------------------------------------------------------------------- -git clone https://github.com/bitprim/bitprim-node-cint.git -cd bitprim-node-cint -echo "Travis branch: ${TRAVIS_BRANCH}" -git checkout ${TRAVIS_BRANCH} - -replace_versions secp256k1 $BITPRIM_BUILD_NUMBER - -cat versions.txt -git add . versions.txt -git commit --message "Travis secp256k1 build: $BITPRIM_BUILD_NUMBER, $TRAVIS_BUILD_NUMBER" || true -git remote add origin-commit https://${GH_TOKEN}@github.com/bitprim/bitprim-node-cint.git > /dev/null 2>&1 -git push --quiet --set-upstream origin-commit ${TRAVIS_BRANCH} || true +body="{ + \"accountName\": \"${BITPRIM_PUSH_ACCOUNT}\", + \"projectSlug\": \"${BITPRIM_PUSH_PROJECT}\", + \"branch\": \"${BITPRIM_PUSH_BRANCH}\" +}" -cd .. +curl -s -d "$body" -X POST -H "Authorization: Bearer ${APPVEYOR_TOKEN}" -H "Content-Type: application/json" https://ci.appveyor.com/api/builds +body="{ + \"request\": { + \"branch\":\"${BITPRIM_PUSH_BRANCH}\" +}}" -# # -------------------------------------------------------------------------------------------------------------------- -# # bitprim-py-native -# # -------------------------------------------------------------------------------------------------------------------- -# git clone https://github.com/bitprim/bitprim-py-native.git +# curl -s -X POST \ +# -H "Content-Type: application/json" \ +# -H "Accept: application/json" \ +# -H "Travis-API-Version: 3" \ +# -H "Authorization: token ${TRAVIS_TOKEN}" \ +# -d "$body" \ +# https://api.travis-ci.org/repo/bitprim%2Fbitprim-core/requests -# cd bitprim-py-native -# echo "Travis branch: ${TRAVIS_BRANCH}" -# git checkout ${TRAVIS_BRANCH} +curl -s -X POST \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + -H "Travis-API-Version: 3" \ + -H "Authorization: token ${TRAVIS_TOKEN}" \ + -d "$body" \ + https://api.travis-ci.org/repo/${BITPRIM_PUSH_ACCOUNT}%2F${BITPRIM_PUSH_PROJECT}/requests -# replace_versions secp256k1 $BITPRIM_BUILD_NUMBER -# increment_py_version -# cat versions.txt -# cat version.py -# git add . versions.txt -# git add . version.py -# git commit --message "Travis secp256k1 build: $BITPRIM_BUILD_NUMBER, $TRAVIS_BUILD_NUMBER" || true -# git remote add origin-commit https://${GH_TOKEN}@github.com/bitprim/bitprim-py-native.git > /dev/null 2>&1 -# git push --quiet --set-upstream origin-commit ${TRAVIS_BRANCH} || true -# cd .. -# # -------------------------------------------------------------------------------------------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index dfac6d2825..d8580ef43e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ cmake_minimum_required(VERSION 3.4) # secp256k1 #============================================================================== project(secp256k1 - VERSION 0.4 + VERSION 0.4.0 LANGUAGES C) set_property(GLOBAL PROPERTY USE_FOLDERS ON) diff --git a/conan_version b/_conan_version similarity index 100% rename from conan_version rename to _conan_version diff --git a/build.py b/build.py index a5da398d0f..f9c3732d3b 100644 --- a/build.py +++ b/build.py @@ -1,30 +1,39 @@ -# from conan.packager import ConanMultiPackager -# import copy -# import re -# import platform +# >> sudo -E docker run -e CONAN_GCC_VERSIONS="7" -e CONAN_DOCKER_IMAGE="lasote/conangcc7" -e CONAN_LOGIN_USERNAME="[secure]" -e CONAN_PASSWORD="[secure]" -e CONAN_CHANNEL="feature_ci_test_travis_stages" -e CONAN_REMOTES="https://api.bintray.com/conan/bitprim/bitprim@True@remote0" -e CONAN_REFERENCE="secp256k1/0.4.0@bitprim/feature_ci_test_travis_stages" -e CPT_PROFILE="@@include(default)@@@@[settings]@@arch=x86_64@@build_type=Release@@compiler=gcc@@compiler.version=7@@[options]@@secp256k1:shared=False@@secp256k1:with_tests=True@@secp256k1:microarchitecture=x86_64@@[env]@@BITPRIM_BUILD_NUMBER=------------------------------------------------------@@None@@None@@None@@describe@@v0.3.0-112-g54f9eda@@0.4.0@@------------------------------------------------------@@0.4.0@@BITPRIM_BRANCH=feature_ci_test_travis_stages@@BITPRIM_CONAN_CHANNEL=feature_ci_test_travis_stages@@BITPRIM_FULL_BUILD=0@@[build_requires]@@@@" -e CONAN_USERNAME="bitprim" -e CONAN_TEMP_TEST_FOLDER="1" -e PIP_DISABLE_PIP_VERSION_CHECK="1" --name conan_runner lasote/conangcc7 /bin/sh -c "sudo -E pip install conan_package_tools==0.18.2 --upgrade --no-cache && sudo -E pip install conan==1.5.0 --no-cache" + + +# BITPRIM_BUILD_NUMBER=------------------------------------------------------@@None@@None@@None@@describe@@v0.3.0-112-g54f9eda@@0.4.0@@------------------------------------------------------@@0.4.0@@BITPRIM_BRANCH=feature_ci_test_travis_stages@@BITPRIM_CONAN_CHANNEL=feature_ci_test_travis_stages@@BITPRIM_FULL_BUILD=0@@[build_requires]@@@@" -e CONAN_USERNAME="bitprim" -e CONAN_TEMP_TEST_FOLDER="1" -e PIP_DISABLE_PIP_VERSION_CHECK="1" --name conan_runner lasote/conangcc7 /bin/sh -c "sudo -E pip install conan_package_tools==0.18.2 --upgrade --no-cache && sudo -E pip install conan==1.5.0 --no-cache" + import os import cpuid -from ci_utils.utils import get_builder, handle_microarchs +from ci_utils.utils import get_builder, handle_microarchs, copy_env_vars if __name__ == "__main__": + + # full_build_str = os.getenv('BITPRIM_FULL_BUILD', '0') + full_build = os.getenv('BITPRIM_FULL_BUILD', '0') == '1' + builder, name = get_builder() builder.add_common_builds(shared_option_name="%s:shared" % name, pure_c=True) filtered_builds = [] - # for settings, options, env_vars, build_requires in builder.builds: for settings, options, env_vars, build_requires, reference in builder.items: if settings["build_type"] == "Release" \ and not("%s:shared" % name in options and options["%s:shared" % name]): - env_vars["BITPRIM_BUILD_NUMBER"] = os.getenv('BITPRIM_BUILD_NUMBER', '-') + copy_env_vars(env_vars) if os.getenv('BITPRIM_RUN_TESTS', 'false') == 'true': # options["%s:with_benchmark" % name] = "True" options["%s:with_tests" % name] = "True" # options["%s:with_openssl_tests" % name] = "True" + marchs = ["x86_64"] + else: + if full_build: + marchs = ["x86_64", ''.join(cpuid.cpu_microarchitecture()), "haswell", "skylake", "skylake-avx512"] + else: + marchs = ["x86_64"] - marchs = ["x86_64", ''.join(cpuid.cpu_microarchitecture()), "haswell", "skylake", "skylake-avx512"] handle_microarchs("%s:microarchitecture" % name, marchs, filtered_builds, settings, options, env_vars, build_requires) # filtered_builds.append([settings, options, env_vars, build_requires]) diff --git a/ci_utils b/ci_utils index 39522e2b19..ee229f3f5c 160000 --- a/ci_utils +++ b/ci_utils @@ -1 +1 @@ -Subproject commit 39522e2b1924027c3781d2db1f15eb99225dcdd8 +Subproject commit ee229f3f5c678152963fba8ea613232c607b3f4a diff --git a/conan_req_version b/conan_req_version index 03e5161d2c..3e1ad720b1 100644 --- a/conan_req_version +++ b/conan_req_version @@ -1 +1 @@ -1.4.5 \ No newline at end of file +1.5.0 \ No newline at end of file diff --git a/conanfile.py b/conanfile.py index 8a1c483f76..1a28b1891b 100644 --- a/conanfile.py +++ b/conanfile.py @@ -25,7 +25,11 @@ class Secp256k1Conan(ConanFile): name = "secp256k1" + version = get_version() + # version = "0.4.0" + # myversion = get_version() + license = "http://www.boost.org/users/license.html" url = "https://github.com/bitprim/secp256k1" description = "Optimized C library for EC operations on curve secp256k1" @@ -88,7 +92,7 @@ class Secp256k1Conan(ConanFile): generators = "cmake" build_policy = "missing" - exports = "conan_version", "conan_req_version", "ci_utils/*" #"conan_channel", "conan_user" + exports = "conan_*", "ci_utils/*" #"conan_channel", "conan_user", "conan_version", "conan_req_version" exports_sources = "src/*", "include/*", "CMakeLists.txt", "cmake/*", "secp256k1Config.cmake.in", "contrib/*", "test/*" #, "bitprimbuildinfo.cmake" @@ -229,7 +233,14 @@ def bignum_lib_name(self): def requirements(self): - self.output.info("********************* self.channel: %s" % (self.channel,)) + # self.output.info("********************* BITPRIM_BUILD_NUMBER: %s" % (os.getenv('BITPRIM_BUILD_NUMBER', '-'),)) + # self.output.info("********************* BITPRIM_BRANCH : %s" % (os.getenv('BITPRIM_BRANCH', '-'),)) + # self.output.info("********************* BITPRIM_CONAN_CHANNEL: %s" % (os.getenv('BITPRIM_CONAN_CHANNEL', '-'),)) + # self.output.info("********************* BITPRIM_FULL_BUILD: %s" % (os.getenv('BITPRIM_FULL_BUILD', '-'),)) + # self.output.info("********************* BITPRIM_CONAN_VERSION: %s" % (os.getenv('BITPRIM_CONAN_VERSION', '-'),)) + # self.output.info("********************* get_version(): %s" % (get_version(),)) + # self.output.info("********************* self.channel: %s" % (self.channel,)) + # self.requires("Say/0.1@%s/%s" % (self.user, self.channel)) if self.options.with_bignum_lib: