This repository has been archived by the owner on Dec 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
/
.travis.yml
65 lines (52 loc) · 1.53 KB
/
.travis.yml
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
dist: xenial
language: python
services:
- docker
env:
global:
- REMOTE_URL: https://github.com/NSLS-II/lightsource2-recipes
- RECIPES_DIR: recipes-tag
- DOCKER_IMAGE: nsls2/debian-with-miniconda:v0.1.2
- TEST_DIR: /test
os:
- linux
python:
- 3.6
- 3.7
script:
- |
set -e
# Git status, etc.
git status
git remote add upstream ${REMOTE_URL}
git remote -v
git fetch upstream master
git branch -avv
git log -n 3
- env | sort -u
- |
set -e
if [ "${TRAVIS_EVENT_TYPE}" == "pull_request" ]; then
commit_range="${TRAVIS_COMMIT_RANGE}"
else
commit_range="upstream/master...HEAD"
fi
# See https://stackoverflow.com/a/7256391/4143531 for details:
all_changed_files=$(git diff --name-only ${commit_range})
echo -e "All changed files:\n${all_changed_files}"
changed_meta_yaml=$(echo "${all_changed_files}" | grep "${RECIPES_DIR}" | grep "meta.yaml" || true)
echo -e "Changed meta.yaml files:\n${changed_meta_yaml}"
- |
set -e
docker pull ${DOCKER_IMAGE}
docker images
if [ ! -z "${changed_meta_yaml}" ]; then
recipe_dirs=$(echo "${changed_meta_yaml}" | cut -d/ -f 1-2 | sort -u)
echo -e "Recipe dirs:\n${recipe_dirs}"
for recipe_dir in ${recipe_dirs}; do
echo "Building ${recipe_dir}..."
docker run --rm -it -v $PWD/${recipe_dir}:${TEST_DIR} ${DOCKER_IMAGE} bash -c "conda build ${TEST_DIR} --python=${TRAVIS_PYTHON_VERSION}"
done
else
echo "Nothing to do"
fi