Skip to content
This repository was archived by the owner on Oct 28, 2021. It is now read-only.

Commit 6ef4ebf

Browse files
committed
Hunter: Update upload procedure
1 parent a41fcbb commit 6ef4ebf

File tree

5 files changed

+33
-54
lines changed

5 files changed

+33
-54
lines changed

.travis.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ cache:
6565
install: |
6666
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
6767
./scripts/install_cmake.sh && ./scripts/install_solc_lllc.sh;
68+
pyenv local 3.6
69+
pip install --user requests
6870
fi
6971
export HOMEBREW_NO_AUTO_UPDATE=1
7072
./scripts/install_deps.sh
@@ -77,13 +79,6 @@ script:
7779
after_success:
7880
- pip install --user codecov
7981
- codecov
80-
after_script: |
81-
# Hunter: upload cache to the cache server.
82-
if [[ "$TRAVIS_EVENT_TYPE" != "pull_request" ]]; then
83-
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo pip install --upgrade requests pyopenssl; fi
84-
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then pip install requests; fi
85-
make -C $TRAVIS_BUILD_DIR/build hunter_upload_cache
86-
fi
8782
deploy:
8883
# This is the deploy target for the native build (Linux and macOS)
8984
# which generates ZIPs per commit. We are in agreement that

CMakeLists.txt

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -51,40 +51,24 @@ set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO Release)
5151
set(HUNTER_CONFIGURATION_TYPES Release)
5252
set(HUNTER_JOBS_NUMBER 4)
5353
set(HUNTER_CACHE_SERVERS "https://github.com/ethereum/hunter-cache")
54+
set(HUNTER_PASSWORDS_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Hunter/passwords.cmake)
55+
56+
# In CI builds upload the binaries if the GITHUB_USER_PASSWORD was decrypted
57+
# (only for branches and internal PRs).
58+
if("$ENV{CI}" AND NOT "$ENV{GITHUB_USER_PASSWORD}" STREQUAL "")
59+
set(run_upload YES)
60+
else()
61+
set(run_upload NO)
62+
endif()
63+
option(HUNTER_RUN_UPLOAD "Upload binaries to the cache server" ${run_upload})
64+
5465
include(HunterGate)
5566
HunterGate(
5667
URL "https://github.com/ruslo/hunter/archive/v0.20.9.tar.gz"
5768
SHA1 "8f7cf6d719d05c49224a4ebeba90c6bb90b90f4a"
5869
LOCAL
5970
)
6071

61-
if(HUNTER_ENABLED)
62-
# Find Python executable,
63-
# prefer version 3 that has requests module included.
64-
set(Python_ADDITIONAL_VERSIONS 3)
65-
find_package(PythonInterp)
66-
if(PYTHONINTERP_FOUND)
67-
hunter_gate_self(
68-
"${HUNTER_CACHED_ROOT}"
69-
"${HUNTER_VERSION}"
70-
"${HUNTER_SHA1}"
71-
hunter_dir
72-
)
73-
set(hunter_upload_script "${hunter_dir}/maintenance/upload-cache-to-github.py")
74-
set(hunter_cache_dir "${HUNTER_GATE_ROOT}/_Base/Cache")
75-
set(hunter_tmp_dir "${HUNTER_GATE_ROOT}/tmp")
76-
add_custom_target(
77-
hunter_upload_cache
78-
${PYTHON_EXECUTABLE} ${hunter_upload_script}
79-
--username hunter-cache-bot
80-
--repo-owner ethereum
81-
--repo hunter-cache
82-
--cache-dir ${hunter_cache_dir}
83-
--temp-dir ${hunter_tmp_dir}
84-
)
85-
endif()
86-
endif()
87-
8872
# project name and version should be set after cmake_policy CMP0048
8973
project(cpp-ethereum VERSION "1.3.0")
9074

appveyor.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ cache:
3939
- build/deps -> cmake/ProjectLibFF.cmake
4040
install:
4141
- git submodule update --init --recursive
42+
43+
# Python 3
44+
- set PATH=C:\Python36-x64;C:\Python36-x64\Scripts;%PATH%
45+
- pip install requests
46+
4247
- scripts/install_deps.bat
4348
- set ETHEREUM_DEPS_PATH=%APPVEYOR_BUILD_FOLDER%\deps
4449
before_build: |
@@ -49,12 +54,6 @@ build_script:
4954
- msbuild cpp-ethereum.sln /p:Configuration=%CONFIGURATION% /m:%NUMBER_OF_PROCESSORS% /v:minimal
5055
- cd %APPVEYOR_BUILD_FOLDER%
5156
- scripts\release.bat %CONFIGURATION% %ETHEREUM_DEPS_PATH% %TESTS%
52-
after_build:
53-
ps: |
54-
if (-not $env:appveyor_pull_request_number) {
55-
pip install --user requests
56-
cmake --build build --target hunter_upload_cache
57-
}
5857
test_script:
5958
- cd %APPVEYOR_BUILD_FOLDER%
6059
- scripts\tests.bat %TESTS% %CONFIGURATION% %APPVEYOR_BUILD_FOLDER% %ETHEREUM_DEPS_PATH%

circle.yml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,6 @@ defaults:
66
command: |
77
git submodule update --init
88
9-
upload-hunter-cache: &upload-hunter-cache
10-
run:
11-
name: "Upload Hunter cache"
12-
working_directory: ~/build
13-
command: | # Upload Hunter cache if not PR build.
14-
if [ ! "$CIRCLE_PR_NUMBER" ]; then
15-
cmake --build . --target hunter_upload_cache
16-
fi
17-
189
environment-info: &environment-info
1910
run:
2011
name: "Environment info"
@@ -112,7 +103,6 @@ defaults:
112103
- *environment-info
113104
- *restore-deps-cache
114105
- *configure
115-
- *upload-hunter-cache
116106
- *build
117107
- *save-deps-cache
118108
- *store-eth
@@ -169,13 +159,12 @@ jobs:
169159
- *environment-info
170160
- run:
171161
name: "Install macOS dependencies"
162+
# Python3 and requests are needed for Hunter upload.
172163
command: |
173-
pip install -q requests codecov &
174-
HOMEBREW_NO_AUTO_UPDATE=1 brew install -q cmake ninja leveldb &
175-
wait
164+
HOMEBREW_NO_AUTO_UPDATE=1 brew install -q cmake ninja python3 leveldb
165+
pip3 install -q requests codecov
176166
- *restore-deps-cache
177167
- *configure
178-
- *upload-hunter-cache
179168
- *build
180169
- *save-deps-cache
181170
- *store-eth

cmake/Hunter/passwords.cmake

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
hunter_upload_password(
3+
# REPO_OWNER + REPO = https://github.com/ethereum/hunter-cache
4+
REPO_OWNER "ethereum"
5+
REPO "hunter-cache"
6+
7+
# USERNAME = https://github.com/hunter-cache-bot
8+
USERNAME "hunter-cache-bot"
9+
10+
# PASSWORD = GitHub token saved as a secure environment variable
11+
PASSWORD "$ENV{GITHUB_USER_PASSWORD}"
12+
)

0 commit comments

Comments
 (0)