[CI] Added support for conditional builds and env vars (#1320)

* Changed travis deploy scheme

* Fixed indentation

* Okay NOW I did fix indentation (hopefully)

* Conditional deployment tests

* Fixed a 7:35 AM typo

* Fixed builds not building.
This commit is contained in:
Kowlin 2018-02-26 06:10:55 +01:00 committed by palmtree5
parent 0593bb9c53
commit 21de95e0a6
2 changed files with 38 additions and 29 deletions

View File

@ -1,19 +1,30 @@
dist: trusty dist: trusty
language: python language: python
cache: pip
notifications:
email: false
python: python:
- 3.5.3 - 3.5.3
- 3.6.1 - 3.6.1
install: install:
- echo "pytest>3" >> requirements.txt - echo "pytest>3" >> requirements.txt
- echo "pytest-asyncio" >> requirements.txt - echo "pytest-asyncio" >> requirements.txt
- echo "git+https://github.com/Rapptz/discord.py.git@rewrite#egg=discord.py[voice]" - echo "git+https://github.com/Rapptz/discord.py.git@rewrite#egg=discord.py[voice]" >> requirements.txt
>> requirements.txt
- pip install -r requirements.txt - pip install -r requirements.txt
- pip install . - pip install .
script: script:
- python -m compileall ./redbot/cogs - python -m compileall ./redbot/cogs
- python -m pytest - python -m pytest
before_deploy:
jobs:
include:
- stage: Deployment
if: tag IS present
python: 3.5.3
env:
- DEPLOYING=true
before_deployment:
- curl https://artifacts.crowdin.com/repo/GPG-KEY-crowdin | sudo apt-key add - - curl https://artifacts.crowdin.com/repo/GPG-KEY-crowdin | sudo apt-key add -
- echo "deb https://artifacts.crowdin.com/repo/deb/ /" | sudo tee -a /etc/apt/sources.list - echo "deb https://artifacts.crowdin.com/repo/deb/ /" | sudo tee -a /etc/apt/sources.list
- sudo apt-get update -qq - sudo apt-get update -qq
@ -37,6 +48,3 @@ deploy:
branch: V3/develop branch: V3/develop
python: 3.5.3 python: 3.5.3
tags: true tags: true
cache: pip
notifications:
email: false

View File

@ -8,6 +8,7 @@ import sys
from setuptools import find_packages from setuptools import find_packages
IS_TRAVIS = 'TRAVIS' in os.environ IS_TRAVIS = 'TRAVIS' in os.environ
IS_DEPLOYING = 'DEPLOYING' in os.environ
dep_links = ['https://github.com/Rapptz/discord.py/tarball/rewrite#egg=discord.py-1.0'] dep_links = ['https://github.com/Rapptz/discord.py/tarball/rewrite#egg=discord.py-1.0']
if IS_TRAVIS: if IS_TRAVIS:
@ -22,7 +23,7 @@ def get_package_list():
def get_requirements(): def get_requirements():
with open('requirements.txt') as f: with open('requirements.txt') as f:
requirements = f.read().splitlines() requirements = f.read().splitlines()
if IS_TRAVIS: if IS_TRAVIS and not IS_DEPLOYING:
requirements.remove('git+https://github.com/Rapptz/discord.py.git@rewrite#egg=discord.py[voice]') requirements.remove('git+https://github.com/Rapptz/discord.py.git@rewrite#egg=discord.py[voice]')
else: else:
requirements.append('discord.py>=1.0.0a0') # Because RTD requirements.append('discord.py>=1.0.0a0') # Because RTD