-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy path.travis.yml
61 lines (57 loc) · 1.68 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
os:
- linux
dist: bionic
language: python
# build for all pushes, as well as PRs coming from forks
# this ensures that the pipeline is triggered for internal pushes,
# PRs from forks and pushes to existing PRs from forks
if: (type == push) OR (type == pull_request AND fork == true)
stages:
- name: test
- name: publish
# for security reasons, builds from forks won't be published until merged;
# also, environment variables defined in repository settings are not
# available to builds from PRs coming from external repos
if: fork == false
jobs:
include:
- &test
stage: test
name: Run linting and unit tests
python: 3.6
script:
- flake8
- coverage run --source drs_filer -m pytest
- coveralls
- <<: *test
python: 3.7
- <<: *test
python: 3.8
- stage: publish
name: Build and publish
python: 3.8
services:
- docker
before_script:
- |
export
if [ "$TRAVIS_BRANCH" = "dev" ]; then
export DOCKER_TAG="$(date '+%Y%m%d')"
else
export DOCKER_TAG=${TRAVIS_BRANCH//_/-}
export DOCKER_TAG=${DOCKER_TAG//\//-}
fi
script:
- |
docker build . \
-t "${DOCKER_REPO_NAME}:latest" \
-t "${DOCKER_REPO_NAME}:${DOCKER_TAG}"
- |
echo "${DOCKER_TOKEN}" | \
docker login -u "${DOCKER_USER}" --password-stdin
- docker push "${DOCKER_REPO_NAME}:${DOCKER_TAG}"
- |
if [ "$TRAVIS_BRANCH" = "dev" ]; then
docker push "${DOCKER_REPO_NAME}:latest"
fi
- rm ${HOME}/.docker/config.json # delete token