This repository has been archived by the owner on Jan 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
/
.travis.yml
119 lines (110 loc) · 8.06 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
language: python
sudo: required
jobs:
include:
- stage: lint
python:
- '3.5'
install:
- pip3 install flake8
script:
- flake8 --ignore=E121,E123,E126,E226,E24,E704,E501,W504 ./nordnm
- stage: testing
python:
- '3.5'
- '3.6'
- '3.7'
- 'nightly'
install:
#- pip install -r requirements.txt
- pip install bandit
#- python setup.py install --root ./
script:
- bandit -r --skip B322,B301,B404,B602,B603,B403,B607 ./nordnm
#- sudo nordnm --help
- stage: deploy_pypi
python: '3.5'
install: true
script:
- python setup.py install
deploy:
provider: pypi
user: Chadsr
password:
secure: dSfgQQ9wsJ1VYsWXf/nG/7nNLwlO0fkKxPNElUN+od0wf6AQiLbmO2QjO28o76K/SEXh+iqSE/dRzOKsGTpYSOEWlntxhb4IOC6dFzU1Cfw1RBDLRHwEUsAuh7W0REoVTL7WHot+XEwvzsIxoR3zRAx8+UmcOXX/e8NaxdV7CRmY8bUqv1bDpcvhXRLwcPd72CpQoP4/GAmKiTzLHXGbWBBua+X8sMe5M8QNVLL7qAMXCUtjoXbYBov2TJlL3/8JrFclIs+xySVmyhldhNWsESiFitwA7D8OpdCyvFOS6e92fAfvcLsWvxc7/MWVWOdPATMuL2y4AW2ISb0c8MicDxDi9JyOT7Aq/GOS8NbMQw0hOlBRPASzbU4uKZX5Tp7C0BKHUsgXkK5qrrKLSxgCXJsFoXOsAgKSdBHWicCXpZCq2KYnlG6SywjfvEWwtvgieM2Hi2EgMeGQKEYDyU1jbS6jAguzU5vkxvslEciK5iM64uTeEdEK43becxhbW4ieLJ63mdzaIoJeWo0K1lOck+260eUdKJ9O//RZOoYEYjDD43d42QRlbEXO7lXjFIIc5YQhGWBAQRwnlcXSJyOV7L52f8pxjKOltC1Vh5i+DHqHwshdY2NO1ZyNVyT57FQImQyZf4uhN2jdpUsytdeOuE66lls2tKy64P0GBmEHynI=
on:
branch: master
tags: true
- stage: deploy_builds
python: '3.5'
services:
- docker
env:
- DESCRIPTION="A CLI tool for automating the importing, securing and usage of NordVPN OpenVPN servers through NetworkManager."
- VERSION=${TRAVIS_TAG}
- GH_EMAIL=hello@rchadwick.co.uk
- GH_USER=${TRAVIS_REPO_SLUG%/*}
- NAME=${TRAVIS_REPO_SLUG#*/}
- PACKAGE=nordnm
- PYTHON_MIN_VERSION=3.5.0
- DEB_DOCKER=ubuntu:latest
- DEB_PYTHON=python3
- DEB_PIP=pip3
- FED_DOCKER=fedora:latest
- FED_PYTHON=python3
- FED_PIP=pip3.7
- JFROG_USER=chadsr
- JFROG_CLI_OFFER_CONFIG=false
- secure: "pPG85EvUVWahXHSVToXJ9yE/ow4U1mC/RX63J3mjSG5Ywp7BYqdNEa9/YD2cwZaDx1FiwHmbSHZWiYbmNkVKfI0CgcrGXCgKLeRusAHqCSAQ7TsDbk8/LW2e/5saSDqyE7dDvZxyktsJgn906cWu2ZcX+GnwC3sEVW2GNqVIxkRcMqjoTCgxewyodnOMurbSTRrIpVlgVsXu1nBhXvocatFNXE1/RhJnE43KBgVIZHDgGysdZl2RHYkMYy4oW3g80f/d2zrwvQhnlTezUWgx6TGjpfD6w+3JnwrlVG/17A76NBu2GT3YB545hrxPw7QikZ2KMYxJ2TEKN92KResclK8wWQx1IT1csikRYwkXIPESJxzAkQfPNBqmjOofekawc7XOzsC+btOOpJz1CEvksaXfaepGJOmJr2N7h7ZeMRI8I2sXicTsvL7/9R5Tbb5wDOtnmt0PiHMyHBGMF9sBwi64qjQGoq0bj6Q0AxIbXthd2v/p5BDHSA+7fDWUuLpmRyqiPuFZckg+Cd9Q1VsldcR8Qy3pkHMwhyKK4QBgqxsEAgCTFoAozkB9E8ICgE28lJwdk7aQ5Y24ynwcbUK8Jz981v5IlkvJs6vXD6jw1tEo3YNYvi0M5FBcwkH0FNSbEVu0U1dM75wNKjJpXPIX3FBF6+IcQE/K7qXgkT3lU4k="
before_install:
- git config --global user.name "${GH_USER}"
- git config --global user.email "${GH_EMAIL}"
install:
# Get the jfrog CLI tool
- curl -fL https://getcli.jfrog.io | sh
- docker pull $FED_DOCKER
- docker pull $DEB_DOCKER
script:
- mkdir builds && cd builds/
# Start building packages
- echo "Deploying ${PACKAGE} v${VERSION} from PyPi to ${GH_USER}/${NAME} - ${DESCRIPTION}"
- docker run -e DEB_PYTHON=$DEB_PYTHON -e DEB_PIP=$DEB_PIP -e PYTHON_MIN_VERSION=$PYTHON_MIN_VERSION -e DESCRIPTION="${DESCRIPTION}" -e PACKAGE=$PACKAGE -e VERSION=$VERSION -e GH_USER=$GH_USER -e NAME=$NAME -v $PWD:/mnt/travis ${DEB_DOCKER} /bin/bash -c 'su && cd /mnt/travis && apt-get update && apt-get -y install ${DEB_PYTHON} ${DEB_PYTHON}-pip ruby ruby-dev rubygems-integration build-essential && gem install --no-document fpm && ${DEB_PYTHON} --version && fpm --maintainer "${GH_USER}" --description "${DESCRIPTION}" --url "https://github.com/${GH_USER}/${NAME}" --provides "${PACKAGE}" -a "all" --no-python-fix-name --python-package-name-prefix "${DEB_PYTHON}" --python-bin ${DEB_PYTHON} --python-pip ${DEB_PIP} --python-install-bin "/usr/bin/" --python-install-lib "/usr/lib/${DEB_PYTHON}/dist-packages/" -d "${DEB_PYTHON} >= ${PYTHON_MIN_VERSION}" -d iputils-ping -d "network-manager >= 1.2.0" -d openvpn -d network-manager-openvpn-gnome -s python -t deb -p ./${PACKAGE}_${VERSION}_all.deb ${PACKAGE} && apt-get install -y ./${PACKAGE}_${VERSION}_all.deb && /usr/bin/nordnm --help'
- docker run -e FED_PYTHON=$FED_PYTHON -e FED_PIP=$FED_PIP -e DESCRIPTION="${DESCRIPTION}" -e PACKAGE=$PACKAGE -e VERSION=$VERSION -e GH_USER=$GH_USER -e NAME=$NAME -v $PWD:/mnt/travis ${FED_DOCKER} /bin/bash -c 'su && cd /mnt/travis && dnf install ruby-devel gcc make rpm-build libffi-devel ${FED_PYTHON} ${FED_PYTHON}-pip -y && gem install --no-document fpm && ${FED_PYTHON} --version && fpm --maintainer "${GH_USER}" --description "${DESCRIPTION}" --url "https://github.com/${GH_USER}/${NAME}" --provides "${PACKAGE}" -a "all" --no-python-fix-name --python-package-name-prefix "${FED_PYTHON}" --python-bin ${FED_PYTHON} --python-pip ${FED_PIP} --python-install-bin "/usr/bin/" --python-install-lib "/lib/${FED_PYTHON}.7/site-packages/" -d "${FED_PYTHON} >= 3.7.0" -d iputils -d "NetworkManager >= 1.2.0" -d openvpn -d NetworkManager-openvpn-gnome -s python -t rpm -p ${PACKAGE}-${VERSION}-1.noarch.rpm ${PACKAGE} && dnf install -y ${PACKAGE}-${VERSION}-1.noarch.rpm && /usr/bin/nordnm --help'
before_deploy:
- pwd && cd ../
- ls -la builds/
# Create deb package
- ./jfrog bt pc --key=${BTKEY} --user=${JFROG_USER} --licenses=GPL-3.0 --desc="${DESCRIPTION}" --vcs-url=https://github.com/${GH_USER}/${NAME} ${JFROG_USER}/${PACKAGE}-deb/${PACKAGE} || echo "package already exists"
# Create rpm package
- ./jfrog bt pc --key=${BTKEY} --user=${JFROG_USER} --licenses=GPL-3.0 --desc="${DESCRIPTION}" --vcs-url=https://github.com/${GH_USER}/${NAME} ${JFROG_USER}/${PACKAGE}-rpm/${PACKAGE} || echo "package already exists"
# Create versions
#- ./jfrog bt vc --key=${BTKEY} --user=${JFROG_USER} --github-tag-rel-notes=true --vcs-tag=${VERSION} ${JFROG_USER}/${PACKAGE}-deb/${PACKAGE}/${VERSION}
#- ./jfrog bt vc --key=${BTKEY} --user=${JFROG_USER} --github-tag-rel-notes=true --vcs-tag=${VERSION} ${JFROG_USER}/${PACKAGE}-rpm/${PACKAGE}/${VERSION}
# Upload artifact to deb repo
- ./jfrog bt upload --override=true --key=${BTKEY} --user=${JFROG_USER} --publish=true --deb="xenial,artful,bionic,zesty,stretch/main/amd64,i386" "builds/${PACKAGE}_${VERSION}_all.deb" ${JFROG_USER}/${PACKAGE}-deb/${PACKAGE}/${VERSION}
# Upload artifact to rpm repo
- ./jfrog bt upload --override=true --key=${BTKEY} --user=${JFROG_USER} --publish=true "builds/${PACKAGE}-${VERSION}-1.noarch.rpm" ${JFROG_USER}/${PACKAGE}-rpm/${PACKAGE}/${VERSION}
# Generate deb metadata
- curl -X POST -u ${JFROG_USER}:${BTKEY} https://api.bintray.com/calc_metadata/${JFROG_USER}/${PACKAGE}-deb
# Generate rpm metadata
- curl -X POST -u ${JFROG_USER}:${BTKEY} https://api.bintray.com/calc_metadata/${JFROG_USER}/${PACKAGE}-rpm
deploy:
provider: releases
api_key:
secure: pK7tExJc33HSztagm34IHuFwtVRNzXYiwEyuPlYJpXXG4REMQiwh7AErwEaSwoyXG3wnxKNsTiPz6/IuR0e1CnFwSypV0IDOChKvRVXZroeUZ2+trz/w23+NtNn0IA/DGxBchkpoTCJgEmeAn9PYAbuosZfc5YAnO8uIP0zSjWqtUjiYpgW2qyaAXIITdBg8QW7WRHqRa0jPZahe9ZSe+z9x5824maHPl0UHPpJzYSibkER2RAnPKwckY2mJZHndMdc6AfdseUkt5w4JgVLuXDimtOYm9wJM4igAruvrvadw64bY6GcNPVmJKR5zO/WoNw3lg/uAZuWqvbEhmD9Ws63PFlJSGSu0FygqMd9prcabcdCxVmEHkniMW3APVwF7m0JquPo6P9NGZrQkUvU/RWoEnHRWhxkWpxsWbnvdRCo3dh49jZXoMcsMEb6eqv0y398ymxu1MdWH3ciD2nMkgswFRfy1I1h/8kNkCog8DDXVbyVzcjoASmnNhgNG2pt6MHiTAerNcTvyDzszOOP/5FoJJtRdMeBoDhUCHeCSDaWKvzeC8XYeR5AMpWlRrWgGlkhtEOmHQy0oTkJTqHhqfB6jM7d97Sm8sNOpnNUbXDrvX1YCLKQ5K26Uh0gDeoo4fF3zZoitIArq2XvqncMMlap2jK76pSi4sgHXuLXdUX8=
skip_cleanup: true
file_glob: true
file:
- builds/${PACKAGE}_${VERSION}_all.deb
- builds/${PACKAGE}-${VERSION}-1.noarch.rpm
on:
repo: "${GH_USER}/${NAME}"
branch: master
tags: true
stages:
- lint
- testing
- name: deploy_pypi
if: tag IS present
- name: deploy_builds
if: tag IS present