Skip to content

Commit

Permalink
version support
Browse files Browse the repository at this point in the history
  • Loading branch information
fpelliccioni committed Nov 2, 2017
1 parent 3200859 commit 277e9cf
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
27 changes: 23 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
42 changes: 42 additions & 0 deletions .travis/push_other_repo.sh
Original file line number Diff line number Diff line change
@@ -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 <versions.txt
mv versions.txt{.t,}
fi
}

set -e
set -x

git config --global user.email "ci@bitprim.org"
git config --global user.name "Bitprim CI"

mkdir temp
cd temp

# git clone https://github.com/bitprim/bitprim-node-exe.git --depth 1
git clone https://github.com/bitprim/bitprim-node-exe.git

cd bitprim-node-exe
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"
git remote add origin-commit https://${GH_TOKEN}@github.com/bitprim/bitprim-node-exe.git > /dev/null 2>&1
git push --quiet --set-upstream origin-commit ${TRAVIS_BRANCH}
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from conan.packager import ConanMultiPackager

if __name__ == "__main__":
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 277e9cf

Please sign in to comment.