mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-17 11:25:55 +08:00
BLD: Only upload to anaconda if on master
This commit is contained in:
+3
-2
@@ -46,20 +46,21 @@ script:
|
||||
- flake8 zipline tests
|
||||
# deactive env to get access to anaconda command
|
||||
- source deactivate
|
||||
- if [[ "$TRAVIS_SECURE_ENV_VARS" = "true" && "$TRAVIS_BRANCH" = "master" && "$TRAVIS_PULL_REQUEST" = "false" ]]; then DO_UPLOAD="true"; else DO_UPLOAD="false"; fi
|
||||
- |
|
||||
for recipe in $(ls -d conda/*/ | xargs -I {} basename {}); do
|
||||
if [[ "$recipe" = "zipline" ]]; then continue; fi
|
||||
|
||||
conda build conda/$recipe --python=$CONDA_PY --numpy=$CONDA_NPY --skip-existing -c quantopian -c https://conda.anaconda.org/quantopian/label/ci
|
||||
RECIPE_OUTPUT=$(conda build conda/$recipe --python=$CONDA_PY --numpy=$CONDA_NPY --output)
|
||||
if [[ -f "$RECIPE_OUTPUT" && "$TRAVIS_SECURE_ENV_VARS" = "true" ]]; then anaconda -t $ANACONDA_TOKEN upload "$RECIPE_OUTPUT" -u quantopian --label ci; fi
|
||||
if [[ -f "$RECIPE_OUTPUT" && "$DO_UPLOAD" = "true" ]]; then anaconda -t $ANACONDA_TOKEN upload "$RECIPE_OUTPUT" -u quantopian --label ci; fi
|
||||
done
|
||||
|
||||
# unshallow the clone so the conda build can clone it.
|
||||
- git fetch --unshallow
|
||||
- exec 3>&1; ZP_OUT=$(conda build conda/zipline --python=$CONDA_PY --numpy=$CONDA_NPY -c quantopian -c https://conda.anaconda.org/quantopian/label/ci | tee >(cat - >&3))
|
||||
- ZP_OUTPUT=$(echo "$ZP_OUT" | grep "anaconda upload" | awk '{print $NF}')
|
||||
- if [[ "$TRAVIS_SECURE_ENV_VARS" = "true" ]]; then anaconda -t $ANACONDA_TOKEN upload $ZP_OUTPUT -u quantopian --label ci; fi
|
||||
- if [[ "$DO_UPLOAD" = "true" ]]; then anaconda -t $ANACONDA_TOKEN upload $ZP_OUTPUT -u quantopian --label ci; fi
|
||||
# reactivate env (necessary for coveralls)
|
||||
- source activate testenv
|
||||
|
||||
|
||||
@@ -25,11 +25,11 @@ def iter_stdout(cmd):
|
||||
PKG_PATH_PATTERN = re.compile(".* anaconda upload (?P<pkg_path>.+)$")
|
||||
|
||||
|
||||
def main():
|
||||
def main(env, do_upload):
|
||||
for recipe in get_immediate_subdirectories('conda'):
|
||||
cmd = ["conda", "build", os.path.join('conda', recipe),
|
||||
"--python", os.environ['CONDA_PY'],
|
||||
"--numpy", os.environ['CONDA_NPY'],
|
||||
"--python", env['CONDA_PY'],
|
||||
"--numpy", env['CONDA_NPY'],
|
||||
"--skip-existing",
|
||||
"-c", "quantopian",
|
||||
"-c", "https://conda.anaconda.org/quantopian/label/ci"]
|
||||
@@ -44,10 +44,8 @@ def main():
|
||||
if match:
|
||||
output = match.group('pkg_path')
|
||||
|
||||
if (output and os.path.exists(output) and
|
||||
os.environ.get('ANACONDA_TOKEN')):
|
||||
|
||||
cmd = ["anaconda", "-t", os.environ['ANACONDA_TOKEN'],
|
||||
if output and os.path.exists(output) and do_upload:
|
||||
cmd = ["anaconda", "-t", env['ANACONDA_TOKEN'],
|
||||
"upload", output, "-u", "quantopian", "--label", "ci"]
|
||||
|
||||
for line in iter_stdout(cmd):
|
||||
@@ -55,4 +53,8 @@ def main():
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
env = os.environ.copy()
|
||||
main(env,
|
||||
do_upload=(env.get('ANACONDA_TOKEN') and
|
||||
env.get('APPVEYOR_REPO_BRANCH') == 'master') and
|
||||
'APPVEYOR_PULL_REQUEST_NUMBER' not in env)
|
||||
|
||||
Reference in New Issue
Block a user