-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
86 lines (62 loc) · 2.53 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
.PHONY: conda-info conda-list setup-build setup-tests conda-rerender \
conda-build conda-upload conda-dump-env \
run-tests run-coveralls
SHELL = /bin/bash
os = $(shell uname)
pkg_name = cdtime
user ?= cdat
label ?= nightly
build_script = conda-recipes/build_tools/conda_build.py
test_pkgs = numpy cdat_info libcdms libdrs_f testsrunner
last_stable ?= 3.1.4
conda_env ?= test_cdtime
workdir ?= $(PWD)/workspace
branch ?= $(shell git rev-parse --abbrev-ref HEAD)
extra_channels ?= cdat/label/nightly conda-forge
artifact_dir ?= $(PWD)/artifacts
conda_env_filename ?= spec-file
build_version ?= 3.7
ifneq ($(coverage),)
coverage = -c tests/coverage.json --coverage-from-egg
endif
conda_recipes_branch ?= master
conda ?= $(or $(CONDA_EXE),$(shell find /opt/*conda*/bin $(HOME)/*conda* -type f -iname conda))
conda_base = $(patsubst %/bin/conda,%,$(conda))
conda_activate = $(conda_base)/bin/activate
conda_build_extra = --copy_conda_package $(artifact_dir)/
ifndef $(local_repo)
local_repo = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
endif
conda-info:
source $(conda_activate) $(conda_env); conda info
conda-list:
source $(conda_activate) $(conda_env); conda list
setup-build:
ifeq ($(wildcard $(workdir)/conda-recipes),)
git clone -b $(conda_recipes_branch) https://github.com/CDAT/conda-recipes $(workdir)/conda-recipes
else
cd $(workdir)/conda-recipes; git pull
endif
setup-tests:
source $(conda_activate) base; conda create -y -n $(conda_env) --use-local \
$(foreach x,$(extra_channels),-c $(x)) $(pkg_name) $(foreach x,$(test_pkgs),"$(x)") \
$(foreach x,$(extra_pkgs),"$(x)")
conda-rerender: setup-build
python $(workdir)/$(build_script) -w $(workdir) -l $(last_stable) -B 0 -p $(pkg_name) \
-b $(branch) --do_rerender --conda_env $(conda_env) --ignore_conda_missmatch \
--conda_activate $(conda_activate)
conda-build:
mkdir -p $(artifact_dir)
python $(workdir)/$(build_script) -w $(workdir) -p $(pkg_name) --build_version $(build_version) \
--do_build --conda_env $(conda_env) --extra_channels $(extra_channels) \
--conda_activate $(conda_activate) $(conda_build_extra)
conda-upload:
source $(conda_activate) $(conda_env); \
anaconda -t $(conda_upload_token) upload -u $(user) -l $(label) --force $(artifact_dir)/*.tar.bz2
conda-dump-env:
mkdir -p $(artifact_dir)
source $(conda_activate) $(conda_env); conda list --explicit > $(artifact_dir)/$(conda_env_filename).txt
run-tests:
source $(conda_activate) $(conda_env); python run_tests.py -H -v2 $(coverage)
run-coveralls:
source $(conda_activate) $(conda_env); coveralls;