forked from plus3it/watchmaker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
167 lines (163 loc) · 6.01 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
version: ~> 1.0
dist: focal
language: python
git:
depth: false
stages:
- test
- deploy
env:
global:
- LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so
- SEGFAULT_SIGNALS=all
- RELEASE_VERSION=$(grep -E '^current_version' $TRAVIS_BUILD_DIR/.bumpversion.cfg | sed 's/^.*= //')
- PRIOR_VERSION=$(git describe --abbrev=0 --tags)
python:
- 2.7
- 3.6
- 3.7
- 3.8
- 3.9
- 3.10
if: branch = main OR type = pull_request OR tag is present
before_install:
# don't overwrite env if it's already set (otherwise check, docs won't work properly)
- export TOXENV="${TOXENV:-${TRAVIS_PYTHON_VERSION%-dev}-codecov}"
- echo $TOXENV
- python --version
- uname -a
- lsb_release -a
install:
- pip install -r requirements/pip.txt
- pip install -r requirements/tox.txt
# Install codecov uploader
- curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import # One-time step
- curl -Os https://uploader.codecov.io/latest/linux/codecov
- curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
- curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig
- gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
- shasum -a 256 -c codecov.SHA256SUM
- chmod +x codecov
- sudo mv codecov /usr/local/bin
# Check versions
- virtualenv --version
- pip --version
- tox --version
- codecov --version
script:
- tox -v
before_script:
- |
if [[ "$TRAVIS_BRANCH" = "main" && "$PRIOR_VERSION" = "$RELEASE_VERSION" ]]; then
# not a release, so need to set the dev version for test pypi and standalones
# whether setup.cfg version has "dev" or not, it is added but not duplicated
ver=$(git show -s --format=%cd --date=format:'%Y%m%d%H%M%S')
sed -i -E "s/^(version = )([0-9]+\.[0-9]+\.[0-9]+).*$/\1\2.dev$ver/" setup.cfg
fi
- grep "version = " setup.cfg
after_failure:
- more .tox/log/* | cat
- more .tox/*/log/* | cat
notifications:
email:
on_success: never
on_failure: always
slack:
rooms:
- secure: nsbTI19SAiog6V6OnN1diYU2V3RIwtmY+IqV4uAvki87dQZteWU22/kQ0wI0OZAOzvEG3lLrc7ZGnbKh+IiH3QJkAwwHgtgC2zdzy6EGkjyEQpeAFUujaEHcRKEIpeAdtNpSUTrPsywdbnT6sO4XN/S7ZhSxS3TRmL2Wi399i36/D0T7gt/GAcPdxrFKwZ20PN20By+5j54FO6/X7y0IVcoUgKdYIvP5NGILRyo+tlWP6dJKFeuxT7lU3FV6W7J7DQs/2yjwH1naBmulxWp22+wNopJ1loW9PHtsJzlN0kUp1Up/+pwHvr7bVbZBzXSZZ5V7j+Xi7uh0de8GYckg0ATJTvrB5c1KZaG9p2unhyMlVAyDfNez3LtgUERnd7S1YXxz8JwbyWlEodzKO/dcnA1PkzcPECEbeXQJtxdhXuz+8pVqIAkDejCv4bhZVUtC4beeQFjxTrqKewxMNpTKKCacIWEBLrCUzr4y15qy7ziRU8CPvFkaUYBkPSWIOp2Xv7FOBwlEhR8d5P6P2eJ7P1vbYVB1vvrYgo0Z4pQkaM02E2/YgSoEfpWsgrSNS+9W0aQtAxcIg6ilY4ZcY83xAmwa8W7uILygqqK0Q7m+UiirIePMWXJ3r9MNkpHHlEr+WebFQYYNhOqVDJ5oX1+KKZY91bJl0ozqUvy4KSlBPO8=
on_success: never
on_failure: always
jobs:
include:
- stage: test
name: lint
python: 3.10
env:
- TOXENV=check
- stage: test
name: docs
python: 3.10
env:
- TOXENV=docs
- stage: test
name: build standalone
python: 3.10
install:
- docker --version
- chmod +x ci/prep_docker.sh
script: ci/prep_docker.sh
before_deploy:
# prepare deployment envs
- export APP_VERSION="$(grep "version =" setup.cfg | sed 's/^.*= //')"
- export APP_NAME="watchmaker"
- export STAGING_DIR=".pyinstaller/dist"
- export SATS_SLUG="plus3it/watchmaker"
- export SATS_TAG="$APP_VERSION"
- export SATS_COMMITTISH="$TRAVIS_COMMIT"
- export SATS_BODY="$(echo -e '* ['$APP_NAME' v'$APP_VERSION' CHANGELOG](https://github.com/plus3it/'$APP_NAME'/blob/'$APP_VERSION'/CHANGELOG.md)\n* ['$APP_NAME' v'$APP_VERSION' SCAP REPORTS](https://watchmaker.cloudarmor.io/list.html#releases/'$APP_VERSION'/scans/)')"
- export SATS_REL_NAME="Release v$APP_VERSION"
- export SATS_FILES_FILE=".pyinstaller/satsuki-files.json"
- echo Tag name is "$SATS_TAG"
- pip install -r requirements/deploy.txt
- echo Deploying "$(grep 'version = ' setup.cfg)"
after_deploy: echo Deployed "$(grep 'version = ' setup.cfg)"
deploy:
- provider: script
# deploy to github releases
script: satsuki
skip_cleanup: true
on:
branch: main
condition: '"$PRIOR_VERSION" != "$RELEASE_VERSION"'
- provider: s3
bucket: $DEV_BUCKET
upload_dir: $S3_KEYFIX
local_dir: $STAGING_DIR
skip_cleanup: true
on:
branch: main
- provider: s3
bucket: $RELEASE_BUCKET
upload_dir: $S3_KEYFIX
local_dir: $STAGING_DIR
skip_cleanup: true
on:
tags: true
- provider: script
# publish dev scap reports
script: bash ci/codebuild_start_wait.sh $CODEBUILD_PROJECT s3://$DEV_BUCKET/$S3_KEYFIX/$APP_VERSION/scans
skip_cleanup: true
on:
branch: main
- provider: script
# publish release scap reports
script: bash ci/codebuild_start_wait.sh $CODEBUILD_PROJECT s3://$RELEASE_BUCKET/$S3_KEYFIX/$APP_VERSION/scans
skip_cleanup: true
on:
tags: true
- stage: deploy
name: deploy to pypi
if: type != pull_request AND (branch = main OR tag is present)
python: 3.10
install: skip
script: skip
before_deploy: echo Deploying "$(grep 'version = ' setup.cfg)"
after_deploy: echo Deployed "$(grep 'version = ' setup.cfg)"
deploy:
- provider: pypi
server: https://test.pypi.org/legacy/
distributions: sdist bdist_wheel
username: __token__ # https://test.pypi.org/help/#apitoken
password: $PYPI_TEST_PASSWORD
skip_cleanup: true
skip_upload_docs: true
on:
branch: main
- provider: pypi
distributions: sdist bdist_wheel
username: __token__ # https://pypi.org/help/#apitoken
password: $PYPI_PASSWORD
skip_cleanup: true
skip_upload_docs: true
on:
tags: true