Guest User

Untitled

a guest
May 21st, 2018
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. stages:
  2. - test
  3. - deploy
  4. test_frontend:
  5. image: "node:8.9.3"
  6. stage: test
  7. before_script:
  8. - "cd frontend"
  9. - "npm cache clean --force"
  10. - "rm -rf node_modules"
  11. - "npm install"
  12. script:
  13. - "npm test"
  14. coverage: /All files[^|]*\\|[^|]*\\s+([\\d\\.]+)/
  15. test_backend:
  16. stage: test
  17. before_script:
  18. - apt-get install -f
  19. - apt-get update -qy
  20. - apt-get install -y python3-pip sudo python-dev libpq-dev postgresql postgresql-contrib pep8
  21. - apt-get update
  22. - service postgresql start
  23. - sudo -u postgres psql -c "CREATE USER ppl WITH PASSWORD 'ppl' CREATEDB"
  24. - sudo -u postgres psql -c "CREATE DATABASE ppl OWNER ppl;"
  25. - sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE ppl TO ppl;"
  26. - export DATABASE_NAME=ppl
  27. - export DATABASE_USER=ppl
  28. - export DATABASE_PASSWORD=ppl
  29. - export DATABASE_HOST=localhost
  30. script:
  31. - cd backend
  32. - pip3 install -r requirements.txt
  33. - python3 manage.py migrate
  34. - coverage run --source='.' --omit='*/env*',manage.py manage.py test
  35. - pycodestyle .
  36. - coverage report
  37. - cd ..
  38. coverage: '/TOTAL.+ ([0-9]{1,3}%)/'
  39. artifacts:
  40. paths:
  41. - public
  42. deploy_situat:
  43. image: ruby:latest
  44. type: deploy
  45. stage: deploy
  46. only:
  47. - sit_uat
  48. script:
  49. - apt-get update -qy
  50. - apt-get install -y ruby-dev
  51. - gem install dpl
  52. - cd frontend && dpl --provider=heroku --app=$HEROKU_APP_SITUAT_NEW --api-key=$HEROKU_API_KEY_NEW
  53. - cd ../backend && dpl --provider=heroku --app=$HEROKU_APP_SITUAT_2_NEW --api-key=$HEROKU_API_KEY_NEW
  54. environment:
  55. name: SITUAT
  56. url: $HEROKU_APP_HOST_SITUAT
  57. deploy_staging:
  58. image: ruby:latest
  59. type: deploy
  60. stage: deploy
  61. except:
  62. - sit_uat
  63. - master
  64. - production
  65. script:
  66. - apt-get update -qy
  67. - apt-get install -y ruby-dev
  68. - gem install dpl
  69. - cd frontend && dpl --provider=heroku --app=$HEROKU_APP_STAGING --api-key=$HEROKU_API_KEY
  70. - cd ../backend && dpl --provider=heroku --app=$HEROKU_APP_STAGING_2 --api-key=$HEROKU_API_KEY_2
  71. environment:
  72. name: production
  73. url: $HEROKU_APP_HOST_STAGING
  74. deploy_production:
  75. stage: deploy
  76. image: gitlab/dind:latest
  77. only:
  78. - master
  79. - production
  80. before_script:
  81. - apt-get update -qy && apt-get install sshpass
  82. script:
  83. - mkdir ~/.ssh
  84. - echo -e "Host 159.65.136.5\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
  85. - git remote add server $VPS_SERVER_GIT
  86. - sshpass -p $VPS_SERVER_PASSWORD git push server master -f
  87. environment:
  88. name: production
  89. url: $VPS_SERVER_URL
Add Comment
Please, Sign In to add comment