Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stages:
- - build
- - check
- - test
- services:
- - docker:dind
- before_script:
- - docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3-management
- checkstyle-backend:
- image: ubuntu:20.04
- stage: check
- before_script:
- - apt -y update
- - apt -y install apt-utils
- - apt -y install net-tools python3.8 python3-pip mysql-client libmysqlclient-dev
- - apt -y upgrade
- script:
- - pip install --upgrade pip
- - pip install virtualenv
- - cd backend/
- - virtualenv venv # Create virutalenv name `venv`
- - source venv/bin/activate # activate virtual environment
- - pip install --upgrade pip
- - pip install --ignore-installed -r requirements.txt # update requirements
- - pycodestyle app/
- - deactivate
- backend-build:
- image: ubuntu:20.04
- stage: build
- before_script:
- - apt -y update
- - apt -y install apt-utils
- - apt -y install net-tools python3.8 python3-pip mysql-client libmysqlclient-dev
- - apt -y upgrade
- script:
- - pip install --upgrade pip
- - pip install virtualenv
- - cd backend/
- - virtualenv venv # Create virutalenv name `venv`
- - source venv/bin/activate # activate virtual environment
- - pip install --upgrade pip
- - pip install -r requirements.txt # update requirements
- - python3 manage.py makemigrations
- - python3 manage.py migrate
- - python3 manage.py check
- - deactivate
- backend-test:
- image: docker:stable
- stage: test
- before_script:
- - apk add --no-cache curl python3 py3-pip
- - pip install --ignore-installed virtualenv
- script:
- - docker pull python:3.8
- - docker run -v $(pwd)/backend:/backend -w /backend python:3.8 sh -c '
- pip install --upgrade pip &&
- pip install virtualenv &&
- virtualenv venv &&
- . venv/bin/activate &&
- pip install --upgrade pip &&
- pip install -r requirements.txt &&
- curl -i -u guest:guest http://rabbitmq:15672/api/whoami &&
- tmux new-session -d -s celery-session "celery -A app worker -l info" &&
- sleep 20 &&
- celery -A app status &&
- coverage run --omit="app/tests/*" manage.py test app/tests &&
- coverage html -d ./coverage/ &&
- coverage report'
- after_script:
- - docker stop rabbitmq
- only:
- refs:
- - merge_requests
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement