forked from gitcoinco/web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
91 lines (86 loc) · 3 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
language: python
python: 3.7
dist: xenial
sudo: true
node_js:
- "9"
os:
- linux
services:
- docker
- postgresql
- redis-server
cache:
directories:
- $HOME/.cache/pip
- node_modules
jobs:
include:
# Lint and test the repository.
- stage: lint-test
before_script:
- psql -c 'create database testdb;' -U postgres
script:
# Setup Env.
- cp app/app/travis.env app/app/.env
- pip install pip setuptools --upgrade
- pip install codecov
# Fetch and Install GeoIP database files.
- sudo apt-get update && sudo apt-get install -y libmaxminddb-dev
# Download links no more valid
- cp dist/*.gz ./
- gunzip GeoLite2-City.mmdb.tar.gz && gunzip GeoLite2-Country.mmdb.tar.gz
- tar -xvf GeoLite2-City.mmdb.tar && tar -xvf GeoLite2-Country.mmdb.tar
- sudo mkdir -p /opt/GeoIP/
- sudo mv GeoLite2-City_20200128/*.mmdb /opt/GeoIP/
- sudo mv GeoLite2-Country_20200128/*.mmdb /opt/GeoIP/
# Install libvips dependencies.
- sudo apt-get install -y libvips libvips-dev
# Install Node and Python dependencies.
- npm install
- pip install -r requirements/test.txt
- npm run eslint
- npm run stylelint
- pytest -p no:ethereum
# Publish CodeCov coverage results.
- codecov
# Generate Markdown documentation and static docs page.
- pydocmd build
env:
- PYTHONPATH="${TRAVIS_BUILD_DIR}/app/"
- DJANGO_SETTINGS_MODULE="app.settings"
deploy:
provider: pages
skip-cleanup: true
github-token: $GITHUB_TOKEN
keep-history: true
local-dir: _build/site
fqdn: docs.gitcoin.co
target-branch: gh-pages
on:
branch: master
# Deploy to Docker Hub and initiate a rolling update for web.
- stage: deploy-stage
if: branch = master AND NOT type = pull_request
script:
# Authenticate with Docker Hub.
- echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
# Pull Docker images.
- docker pull python:3.6-slim-jessie
# Build, tag, and publish the new gitcoin/web image.
- docker build -t gitcoin/web:${TRAVIS_BUILD_NUMBER} .
- docker push gitcoin/web:${TRAVIS_BUILD_NUMBER}
- docker tag gitcoin/web:${TRAVIS_BUILD_NUMBER} gitcoin/web:latest
- docker push gitcoin/web:latest
- stage: deploy-prod
if: branch = stable
script:
# Authenticate with Docker Hub.
- echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
# Pull Docker images.
- docker pull python:3.6-slim-jessie
# Build, tag, and publish the new gitcoin/web image.
- docker build -t gitcoin/web:${TRAVIS_BUILD_NUMBER} .
- docker push gitcoin/web:${TRAVIS_BUILD_NUMBER}
- docker tag gitcoin/web:${TRAVIS_BUILD_NUMBER} gitcoin/web:stable
- docker push gitcoin/web:stable