Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating config.yml #647

Merged
merged 18 commits into from
Oct 31, 2020
18 changes: 4 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
version: 2.1

parameters:
label:
type: string
default: "nightly"

aliases:
- &setup_env
name: setup_env
Expand All @@ -21,7 +16,6 @@ aliases:
name: setup_miniconda
command: |
source $BASH_ENV
mkdir -p $WORKDIR
git clone https://github.com/CDAT/cdat.git $WORKDIR/cdat
# install_miniconda.py installs miniconda3 under $WORKDIR/miniconda
python $WORKDIR/cdat/scripts/install_miniconda.py -w $WORKDIR -p 'py3'
Expand All @@ -32,7 +26,7 @@ aliases:
source $BASH_ENV
source $WORKDIR/miniconda/etc/profile.d/conda.sh
conda activate base
make conda-rerender workdir=$WORKDIR branch=$CIRCLE_BRANCH
make conda-rerender workdir=$WORKDIR conda_build_env=base branch=$CIRCLE_BRANCH

- &conda_build
name: conda_build
Expand All @@ -42,7 +36,7 @@ aliases:
conda activate base
os=`uname`
artifacts_dir="artifacts/artifacts.${os}.noarch"
make conda-build workdir=$WORKDIR artifact_dir=$artifacts_dir
make conda-build workdir=$WORKDIR conda_build_env=base artifact_dir=$PWD/$artifacts_dir

- &setup_run_tests
name: setup_run_tests
Expand All @@ -69,7 +63,7 @@ aliases:
source $WORKDIR/miniconda/etc/profile.d/conda.sh
conda activate base
UPLOAD_OPTIONS="conda_upload_token=$CONDA_UPLOAD_TOKEN"
make conda-upload workdir=$WORKDIR $UPLOAD_OPTIONS artifact_dir="artifacts/*Linux*/"
make conda-upload workdir=$WORKDIR $UPLOAD_OPTIONS artifact_dir="$PWD/artifacts/*Linux*/"

- &run_coveralls
name: run_coveralls
Expand Down Expand Up @@ -135,8 +129,6 @@ jobs:
upload:
machine:
image: circleci/classic:latest
environment:
LABEL: << pipeline.parameters.label >>
steps:
- checkout
- attach_workspace:
Expand All @@ -156,16 +148,14 @@ workflows:
matrix:
parameters:
os: [ linux, macos ]
py_ver: [ "3.6", "3.7", "3.8"]
py_ver: [ "3.6", "3.7", "3.8" ]
libnetcdf: [ "nompi", "mpi_mpich", "mpi_openmpi" ]
name: test-<< matrix.os >>-<< matrix.py_ver >>-<< matrix.libnetcdf >>
requires:
- build-<< matrix.os >>

- upload:
requires:
- test
filters:
branches:
only: master

68 changes: 34 additions & 34 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ organization = pcmdi
# user and label for upload
#
user = pcmdi
label = nightly
label ?= nightly
build_script = conda-recipes/build_tools/conda_build.py

test_pkgs = testsrunner scipy cia coverage coveralls
Expand All @@ -32,34 +32,49 @@ extra_channels ?= pcmdi/label/nightly pcmdi cdat/label/nightly conda-forge
conda ?= $(or $(CONDA_EXE),$(shell find /opt/*conda*/bin $(HOME)/*conda*/bin -type f -iname conda))
conda_env_filename ?= spec-file

ifeq ($(workdir),)
# Only populate if workdir is not defined
ifeq ($(origin workdir),undefined)
# Create .tempdir if it doesn't exist
ifeq ($(wildcard $(PWD)/.tempdir),)
workdir = $(shell mktemp -d -t "build_$(pkg_name).XXXXXXXX")
workdir := $(shell mktemp -d -t "build_$(pkg_name).XXXXXXXX")
$(shell echo $(workdir) > $(PWD)/.tempdir)
endif

# Read tempdir
workdir := $(shell cat $(PWD)/.tempdir)
endif

$(info $(workdir))

artif_dir = $(workdir)/$(artifact_dir)
# Only populate if workdir is not defined
ifeq ($(origin workdir),undefined)
# Create .tempdir if it doesn't exist
ifeq ($(wildcard $(PWD)/.tempdir),)
workdir := $(shell mktemp -d -t "build_$(pkg_name).XXXXXXXX")
$(shell echo $(workdir) > $(PWD)/.tempdir)
endif

ifeq ($(coverage),1)
coverage_opt = -c tests/coverage.json --coverage-from-egg
# Read tempdir
workdir := $(shell cat $(PWD)/.tempdir)
endif

$(info $(workdir))

artifact_dir ?= $(PWD)/artifacts

conda_recipes_branch ?= master

conda_base = $(patsubst %/bin/conda,%,$(conda))
conda_activate = $(conda_base)/bin/activate

conda_build_extra = --copy_conda_package $(artif_dir)/
conda_build_extra = --copy_conda_package $(artifact_dir)/

ifndef $(local_repo)
local_repo = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
endif

help: ## Prints help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

conda-info:
source $(conda_activate) $(conda_test_env); conda info

Expand All @@ -73,52 +88,37 @@ else
cd $(workdir)/conda-recipes; git pull
endif

clean:
rm -rf $(shell cat .tempdir)

rm -f .tempdir

setup-tests:
source $(conda_activate) base; conda create -y -n $(conda_test_env) \
$(or $(if $(findstring $(conda_build_env),base),—use-local,),-c file:https://$(conda_base)/envs/$(conda_build_env)/conda-bld) \
source $(conda_activate) base; conda create -y -n $(conda_test_env) --use-local \
$(foreach x,$(extra_channels),-c $(x)) $(pkg_name) $(foreach x,$(test_pkgs),"$(x)") \
$(foreach x,$(extra_pkgs),"$(x)") $(foreach x,$(pkgs),"$(x)")
$(foreach x,$(docs_pkgs),"$(x)") $(foreach x,$(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_build_env) --ignore_conda_missmatch \
--conda_activate $(conda_activate) --organization $(organization)

conda-local-rerender: setup-build
python $(workdir)/$(build_script) -w $(workdir) -l $(last_stable) -B 0 -p $(pkg_name) \
-b $(branch) --do_rerender --conda_env $(conda_build_env) --ignore_conda_missmatch \
--conda_activate $(conda_activate) --organization $(organization) --local_repo=$(local_repo)

conda-build:
mkdir -p $(artif_dir)
mkdir -p $(artifact_dir)

python $(workdir)/$(build_script) -w $(workdir) -p $(pkg_name) --build_version noarch \
--do_build --conda_env $(conda_build_env) --extra_channels $(extra_channels) \
--conda_activate $(conda_activate) $(conda_build_extra)

conda-local-build:
mkdir -p $(artif_dir)

python $(workdir)/$(build_script) -w $(workdir) -p $(pkg_name) --build_version noarch \
--do_build --conda_env $(conda_build_env) --extra_channels $(extra_channels) \
--conda_activate $(conda_activate) $(conda_build_extra) --local_repo=$(local_repo)
--conda_activate $(conda_activate) $(conda_build_extra)

conda-upload:
source $(conda_activate) $(conda_build_env); \
anaconda -t $(conda_upload_token) upload -u $(user) -l $(label) --force $(artif_dir)/*.tar.bz2
anaconda -t $(conda_upload_token) upload -u $(user) -l $(label) --force $(artifact_dir)/*.tar.bz2

conda-dump-env:
mkdir -p $(artif_dir)
mkdir -p $(artifact_dir)

source $(conda_activate) $(conda_test_env); conda list --explicit > $(artif_dir)/$(conda_env_filename).txt
source $(conda_activate) $(conda_test_env); conda list --explicit > $(artifact_dir)/$(conda_env_filename).txt

run-tests:
source $(conda_activate) $(conda_test_env); python run_tests.py -H -v2 $(coverage_opt)

run-doc-test:
source $(conda_activate) $(conda_test_env); cd docs; make doctest;

run-coveralls:
source $(conda_activate) $(conda_test_env); coveralls;