forked from gitcoinco/web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
103 lines (97 loc) · 3.4 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
language: python
python: 3.7
dist: bionic
node_js: 14
os:
- linux
services:
- docker
- postgresql
- redis
- xvfb
addons:
chrome: stable
cache:
npm: false
directories:
- $HOME/.cache/pip
- node_modules/
jobs:
include:
# Lint and test the repository.
- stage: lint-test
before_script:
- nvm install "14"
- psql -c 'create database testdb;' -U postgres
script:
# Setup Env.
- cp app/app/travis.env app/app/.env
- pip install pip==20.0.2 setuptools --upgrade
# Fetch and Install GeoIP database files.
- sudo apt-get update && sudo apt-get install -y libmaxminddb-dev libsodium-dev libsecp256k1-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.
- node --version
- yarn install
- pip install -r requirements/test.txt
- yarn run eslint
- yarn run stylelint
- (cd app; python3 ./manage.py collectstatic --noinput --disable-collectfast)
# Run migrations
- python3 app/manage.py migrate
# Fetch polygons gas price
- python3 app/manage.py fetch_gas_prices
# Run the tests
- pytest -p no:ethereum -p no:warnings
# Run cypress tests
- bin/ci/cypress-run
# Generate Markdown documentation and static docs page.
- pydocmd build
env:
- PYTHONPATH="${TRAVIS_BUILD_DIR}/app/"
- DJANGO_SETTINGS_MODULE="app.settings"
- SUPRESS_DEBUG_TOOLBAR=1
deploy:
strategy: git
provider: pages
token: $GITHUB_TOKEN
keep_history: true
skip_cleanup: 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