forked from IdentityPython/SATOSA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
171 lines (152 loc) · 5.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
os: linux
dist: bionic
language: python
services:
- docker
- mongodb
before_install:
- sudo apt-get install -y xmlsec1
install:
- pip install tox
- pip install tox-travis
script:
- tox -r
jobs:
allow_failures:
- python: 3.9-dev
include:
- python: 3.6
- python: 3.7
- python: 3.8
- python: pypy3
- stage: Expose env-var information
script: |
cat <<EOF
TRAVIS_BUILD_ID: $TRAVIS_BUILD_ID
TRAVIS_BUILD_STAGE_NAME: $TRAVIS_BUILD_STAGE_NAME
TRAVIS_BUILD_NUMBER: $TRAVIS_BUILD_NUMBER
TRAVIS_BUILD_WEB_URL: $TRAVIS_BUILD_WEB_URL
TRAVIS_JOB_ID: $TRAVIS_JOB_ID
TRAVIS_JOB_NAME: $TRAVIS_JOB_NAME
TRAVIS_JOB_NUMBER: $TRAVIS_JOB_NUMBER
TRAVIS_JOB_WEB_URL: $TRAVIS_JOB_WEB_URL
TRAVIS_DIST: $TRAVIS_DIST
TRAVIS_OS_NAME: $TRAVIS_OS_NAME
TRAVIS_CPU_ARCH: $TRAVIS_CPU_ARCH
TRAVIS_PYTHON_VERSION: $TRAVIS_PYTHON_VERSION
TRAVIS_SECURE_ENV_VARS: $TRAVIS_SECURE_ENV_VARS
TRAVIS_EVENT_TYPE: $TRAVIS_EVENT_TYPE
TRAVIS_REPO_SLUG: $TRAVIS_REPO_SLUG
TRAVIS_BRANCH: $TRAVIS_BRANCH
TRAVIS_COMMIT: $TRAVIS_COMMIT
TRAVIS_COMMIT_RANGE: $TRAVIS_COMMIT_RANGE
TRAVIS_TAG: $TRAVIS_TAG
TRAVIS_PULL_REQUEST: $TRAVIS_PULL_REQUEST
TRAVIS_PULL_REQUEST_BRANCH: $TRAVIS_PULL_REQUEST_BRANCH
TRAVIS_PULL_REQUEST_SHA: $TRAVIS_PULL_REQUEST_SHA
TRAVIS_PULL_REQUEST_SLUG: $TRAVIS_PULL_REQUEST_SLUG
DOCKER_REPO: $DOCKER_REPO
DOCKER_TAG_COMMIT: $DOCKER_TAG_COMMIT
DOCKER_TAG_BRANCH: $DOCKER_TAG_BRANCH
DOCKER_TAG_PR_BRANCH: $DOCKER_TAG_PR_BRANCH
DOCKER_TAG_PR_NUM: $DOCKER_TAG_PR_NUM
DOCKER_TAG_GITTAG: $DOCKER_TAG_GITTAG
DOCKER_TAG_LATEST: $DOCKER_TAG_LATEST
EOF
- stage: Build docker image by commit and deploy on DockerHub
before_install: skip
install: skip
script:
- set -e
- test "$TRAVIS_SECURE_ENV_VARS" = "true" || exit 0
- docker build -f Dockerfile -t "$DOCKER_TAG_COMMIT" .
- echo "$DOCKER_PASS" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker push "$DOCKER_TAG_COMMIT"
- stage: Tag docker image with branch name
if: type = push AND branch IS present
before_install: skip
install: skip
script:
- set -e
- test "$TRAVIS_SECURE_ENV_VARS" = "true" || exit 0
- docker pull "$DOCKER_TAG_COMMIT"
- docker tag "$DOCKER_TAG_COMMIT" "$DOCKER_TAG_BRANCH"
- echo "$DOCKER_PASS" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker push "$DOCKER_TAG_BRANCH"
- stage: Tag docker image with pull-request branch name
if: type = pull_request AND head_branch IS present
before_install: skip
install: skip
script:
- set -e
- test "$TRAVIS_SECURE_ENV_VARS" = "true" || exit 0
- docker pull "$DOCKER_TAG_COMMIT"
- docker tag "$DOCKER_TAG_COMMIT" "$DOCKER_TAG_PR_BRANCH"
- echo "$DOCKER_PASS" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker push "$DOCKER_TAG_PR_BRANCH"
- stage: Tag docker image with pull-request number
if: type = pull_request
before_install: skip
install: skip
script:
- set -e
- test "$TRAVIS_SECURE_ENV_VARS" = "true" || exit 0
- docker pull "$DOCKER_TAG_COMMIT"
- docker tag "$DOCKER_TAG_COMMIT" "$DOCKER_TAG_PR_NUM"
- echo "$DOCKER_PASS" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker push "$DOCKER_TAG_PR_NUM"
- stage: Tag docker image with git-tag
if: type = push AND tag IS present
before_install: skip
install: skip
script:
- set -e
- test "$TRAVIS_SECURE_ENV_VARS" = "true" || exit 0
- docker pull "$DOCKER_TAG_COMMIT"
- docker tag "$DOCKER_TAG_COMMIT" "$DOCKER_TAG_GITTAG"
- echo "$DOCKER_PASS" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker push "$DOCKER_TAG_GITTAG"
- stage: Tag docker image as latest
if: type = push AND branch = master
before_install: skip
install: skip
script:
- set -e
- test "$TRAVIS_SECURE_ENV_VARS" = "true" || exit 0
- docker pull "$DOCKER_TAG_COMMIT"
- docker tag "$DOCKER_TAG_COMMIT" "$DOCKER_TAG_LATEST"
- echo "$DOCKER_PASS" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker push "$DOCKER_TAG_LATEST"
- stage: Deploy new release on GitHub
if: type = push AND tag IS present
before_install: skip
install: skip
script: skip
deploy:
- provider: releases
token: "$GITHUB_RELEASE_TOKEN"
on:
repo: IdentityPython/SATOSA
tags: true
- stage: Deploy new release on PyPI
if: type = push AND tag IS present
before_install: skip
install: skip
script: skip
deploy:
- provider: pypi
distributions: sdist bdist_wheel
username: "__token__"
password: "$PYPI_RELEASE_TOKEN"
on:
repo: IdentityPython/SATOSA
tags: true
env:
global:
- DOCKER_REPO: "satosa/satosa"
- DOCKER_TAG_COMMIT: "${DOCKER_REPO}:${TRAVIS_COMMIT}"
- DOCKER_TAG_BRANCH: "${DOCKER_REPO}:${TRAVIS_BRANCH}"
- DOCKER_TAG_PR_BRANCH: "${DOCKER_REPO}:PR${TRAVIS_PULL_REQUEST_BRANCH}"
- DOCKER_TAG_PR_NUM: "${DOCKER_REPO}:PR${TRAVIS_PULL_REQUEST}"
- DOCKER_TAG_GITTAG: "${DOCKER_REPO}:${TRAVIS_TAG:-NO_TAG}"
- DOCKER_TAG_LATEST: "${DOCKER_REPO}:latest"