Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Plio
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
aflab
astrogeology
Plio
Commits
8a766fa3
Commit
8a766fa3
authored
8 years ago
by
jlaura
Committed by
Jason R Laura
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
AppVeyor Upload Support
parent
6f0a25e3
No related branches found
No related tags found
No related merge requests found
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
appveyor.yml
+59
-22
59 additions, 22 deletions
appveyor.yml
ci_support/upload_or_check_non_existence.py
+119
-0
119 additions, 0 deletions
ci_support/upload_or_check_non_existence.py
ci_tools/condaci.py
+0
-764
0 additions, 764 deletions
ci_tools/condaci.py
with
178 additions
and
786 deletions
appveyor.yml
+
59
−
22
View file @
8a766fa3
environment
:
environment
:
BINSTAR_USER
:
jlaura
PYTHON_VERSION
:
3.4
CONDA_INSTALL_LOCN
:
"
C:
\\
conda"
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
# /E:ON and /V:ON options are not enabled in the batch script intepreter
# See: http://stackoverflow.com/a/13751649/163740
CMD_IN_ENV
:
"
cmd
/E:ON
/V:ON
/C
obvci_appveyor_python_build_env.cmd"
# We set a default Python version for the miniconda that is to be installed. This can be
# overridden in the matrix definition where appropriate.
CONDA_PY
:
"
27"
matrix
:
-
TARGET_ARCH
:
x64
CONDA_PY
:
34
# We always use a 64-bit machine, but can build x86 distributions
# with the TARGET_ARCH variable.
platform
:
platform
:
-
x64
-
x64
install
:
install
:
-
cmd
:
set PATH=C:\Miniconda3;C:\Miniconda3\Scripts;%PATH%
# If there is a newer build queued for the same PR, cancel this one.
-
cmd
:
conda config --set always_yes yes --set changeps1 no
# The AppVeyor 'rollout builds' option is supposed to serve the same
-
cmd
:
conda update -q conda
# purpose but it is problematic because it tends to cancel builds pushed
# directly to master instead of just PR builds (or the converse).
# credits: JuliaLang developers.
-
ps
:
if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." }
# Cywing's git breaks conda-build. (See https://github.com/conda-forge/conda-smithy-feedstock/pull/2.)
-
cmd
:
rmdir C:\cygwin /s /q
-
appveyor DownloadFile "https://raw.githubusercontent.com/pelson/Obvious-CI/master/bootstrap-obvious-ci-and-miniconda.py"
-
cmd
:
python bootstrap-obvious-ci-and-miniconda.py %CONDA_INSTALL_LOCN% %TARGET_ARCH% %CONDA_PY:~0,1% --without-obvci
-
cmd
:
set PATH=%CONDA_INSTALL_LOCN%;%CONDA_INSTALL_LOCN%\scripts;%PATH%
-
cmd
:
set PYTHONUNBUFFERED=1
# Useful for debugging any issues with conda
-
cmd
:
conda config --set show_channel_urls
true
-
cmd
:
conda info -a
-
cmd
:
conda install -c pelson/channel/development --yes --quiet obvious-ci
-
cmd
:
conda config --add channels conda-forge
-
cmd
:
conda info
-
cmd
:
conda install -n root --quiet --yes conda-build anaconda-client jinja2 setuptools
# Workaround for Python 3.4 and x64 bug in latest conda-build.
# FIXME: Remove once there is a release that fixes the upstream issue
# ( https://github.com/conda/conda-build/issues/895 ).
-
cmd
:
if "%TARGET_ARCH%" == "x64" if "%CONDA_PY%" == "34" conda install conda-build=1.20.0 --yes
# Install not using env because build needs to be in root env
# Now install the pacakge dependencies
-
cmd
:
conda config --add channels conda-forge
-
cmd
:
conda config --add channels conda-forge
-
cmd
:
conda config --add channels jlaura
-
cmd
:
conda config --add channels jlaura
-
cmd
:
conda install -c conda-forge gdal h5py
-
cmd
:
conda install -c conda-forge gdal h5py
-
cmd
:
conda install pandas sqlalchemy pyyaml
-
cmd
:
conda install pandas sqlalchemy pyyaml
-
cmd
:
pip install pvl
-
cmd
:
conda install -c jlaura protobuf pvl
-
cmd
:
pip install protobuf==3.0.0b2
# Development installation
# Development installation
-
cmd
:
conda install nose coverage
anaconda-client
-
cmd
:
conda install nose coverage
-
cmd
:
pip install coveralls
-
cmd
:
pip install coveralls
# Skip .NET project specific build phase.
build
:
off
build
:
off
test_script
:
test_script
:
-
cmd
:
nosetests --with-coverage --cover-package=plio
-
cmd
:
nosetests --with-coverage --cover-package=plio
-
"
%CMD_IN_ENV%
conda
build
conda
--quiet"
deploy_script
:
after_test
:
-
'
python
ci_support\upload_or_check_non_existence.py
.\conda
jlaura
--channel=main'
# Afte test success, package and upload to Anaconda
-
cmd
:
python ci_tools/condaci.py build ./conda
This diff is collapsed.
Click to expand it.
ci_support/upload_or_check_non_existence.py
0 → 100644
+
119
−
0
View file @
8a766fa3
#!/usr/bin/env python
from
__future__
import
print_function
import
argparse
import
hashlib
import
os
import
subprocess
import
sys
from
binstar_client.utils
import
get_binstar
import
binstar_client.errors
import
conda.config
from
conda_build.metadata
import
MetaData
from
conda_build.build
import
bldpkg_path
def
built_distribution_already_exists
(
cli
,
meta
,
owner
):
"""
Checks to see whether the built recipe (aka distribution) already
exists on the owner/user
'
s binstar account.
"""
distro_name
=
'
{}/{}.tar.bz2
'
.
format
(
conda
.
config
.
subdir
,
meta
.
dist
())
fname
=
bldpkg_path
(
meta
)
try
:
dist_info
=
cli
.
distribution
(
owner
,
meta
.
name
(),
meta
.
version
(),
distro_name
)
except
binstar_client
.
errors
.
NotFound
:
dist_info
=
{}
exists
=
bool
(
dist_info
)
# Unfortunately, we cannot check the md5 quality of the built distribution, as
# this will depend on fstat information such as modification date (because
# distributions are tar files). Therefore we can only assume that the distribution
# just built, and the one on anaconda.org are the same.
# if exists:
# md5_on_binstar = dist_info.get('md5')
# with open(fname, 'rb') as fh:
# md5_of_build = hashlib.md5(fh.read()).hexdigest()
#
# if md5_on_binstar != md5_of_build:
# raise ValueError('This build ({}), and the build already on binstar '
# '({}) are different.'.format(md5_of_build, md5_on_binstar))
return
exists
def
upload
(
cli
,
meta
,
owner
,
channels
):
try
:
with
open
(
'
binstar.token
'
,
'
w
'
)
as
fh
:
fh
.
write
(
cli
.
token
)
subprocess
.
check_call
([
'
anaconda
'
,
'
--quiet
'
,
'
-t
'
,
'
binstar.token
'
,
'
upload
'
,
bldpkg_path
(
meta
),
'
--user={}
'
.
format
(
owner
),
'
--channel={}
'
.
format
(
channels
)],
env
=
os
.
environ
)
finally
:
os
.
remove
(
'
binstar.token
'
)
def
distribution_exists_on_channel
(
binstar_cli
,
meta
,
owner
,
channel
=
'
main
'
):
"""
Determine whether a distribution exists on a specific channel.
Note from @pelson: As far as I can see, there is no easy way to do this on binstar.
"""
fname
=
'
{}/{}.tar.bz2
'
.
format
(
conda
.
config
.
subdir
,
meta
.
dist
())
distributions_on_channel
=
[
dist
[
'
basename
'
]
for
dist
in
binstar_cli
.
show_channel
(
owner
=
owner
,
channel
=
channel
)[
'
files
'
]]
return
fname
in
distributions_on_channel
def
add_distribution_to_channel
(
binstar_cli
,
meta
,
owner
,
channel
=
'
main
'
):
"""
Add a(n already existing) distribution on binstar to another channel.
Note - the addition is done based on name and version - no build strings etc.
so if you have a foo-0.1-np18 and foo-0.1-np19 *both* will be added to the channel.
"""
package_fname
=
'
{}/{}.tar.bz2
'
.
format
(
conda
.
config
.
subdir
,
meta
.
dist
())
binstar_cli
.
add_channel
(
channel
,
owner
,
meta
.
name
(),
meta
.
version
())
def
main
():
token
=
os
.
environ
.
get
(
'
BINSTAR_KEY
'
)
description
=
(
'
Upload or check consistency of a built version of a
'
'
conda recipe with binstar. Note: The existence of the
'
'
BINSTAR_KEY environment variable determines
'
'
whether the upload should actually take place.
'
)
parser
=
argparse
.
ArgumentParser
(
description
=
description
)
parser
.
add_argument
(
'
recipe_dir
'
,
help
=
'
the conda recipe directory
'
)
parser
.
add_argument
(
'
owner
'
,
help
=
'
the binstar owner/user
'
)
parser
.
add_argument
(
'
--channel
'
,
help
=
'
the binstar channel
'
,
default
=
'
main
'
)
args
=
parser
.
parse_args
()
recipe_dir
,
owner
,
channel
=
args
.
recipe_dir
,
args
.
owner
,
args
.
channel
cli
=
get_binstar
(
argparse
.
Namespace
(
token
=
token
,
site
=
None
))
meta
=
MetaData
(
recipe_dir
)
if
meta
.
skip
():
print
(
"
No upload to take place - this configuration was skipped in build/skip.
"
)
return
exists
=
built_distribution_already_exists
(
cli
,
meta
,
owner
)
if
token
:
on_channel
=
distribution_exists_on_channel
(
cli
,
meta
,
owner
,
channel
)
if
not
exists
:
upload
(
cli
,
meta
,
owner
,
channel
)
print
(
'
Uploaded {}
'
.
format
(
bldpkg_path
(
meta
)))
elif
not
on_channel
:
print
(
'
Adding distribution {} to {}
\'
s {} channel
'
''
.
format
(
bldpkg_path
(
meta
),
owner
,
channel
))
add_distribution_to_channel
(
cli
,
meta
,
owner
,
channel
)
else
:
print
(
'
Distribution {} already
\n
exists on {}
\'
s {} channel.
'
''
.
format
(
bldpkg_path
(
meta
),
owner
,
channel
))
else
:
print
(
"
No BINSTAR_KEY present, so no upload is taking place.
"
"
The distribution just built {} already available on {}
'
s
"
"
{} channel.
"
.
format
(
'
is
'
if
exists
else
'
is not
'
,
owner
,
channel
))
if
__name__
==
'
__main__
'
:
main
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
ci_tools/condaci.py
deleted
100644 → 0
+
0
−
764
View file @
6f0a25e3
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment