You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

126 lines
4.1 KiB

---
# drone -s https://<DRONE SERVER> -t <USER TOKEN> sign scrippy/scrippy-core --save
kind: pipeline
type: docker
name: Scrippy/scrippy-core
steps:
- name: Test
image: python
environment:
pip_user:
from_secret: pip_user
pip_password:
from_secret: pip_password
db_connexion_string: postgres://postgres:postgres@scrippy_db:5432/scrippy
commands:
- sleep 30
- apt-get update
- apt-get install postgresql-client -y
- psql -Atx $${db_connexion_string} -f ./tests/scrippy/sql/feed_db.sql
- mkdir /etc/scrippy
- python3 -m pip install pip --upgrade
- python3 -m pip install .[dev]
- pip install -i https://$${pip_user}:$${pip_password}@pip.mcos.nc/simple/ --upgrade scrippy-template scrippy-remote scrippy-db scrippy-git scrippy-api scrippy-mail
- cp tests/scrippy/scrippy.yml /etc/scrippy/
- python3 tests/scrippy/setup.py
- chmod 700 ./tests/scrippy/git/ssh/
- chmod 600 ./tests/scrippy/git/ssh/scrippy.rsa
- chmod 700 ./tests/scrippy/ssh/
- chmod 600 ./tests/scrippy/ssh/scrippy.rsa
- cp tests/test_scrippy_core.conf /etc/scrippy/conf/
- cp tests/test_scrippy_core.txt.j2 /var/lib/scrippy/templates/
- python3 "$(pwd)"/tests/test_scrippy_core.py --remote_path /home/scrippy
--remote_filename message.txt
--local_path /var/tmp/scrippy/
--mail_recipient harry.fink@flying.circus
# On teste le nombre d'exécutions enregistrées dans l'historique
- test $(python3 "$(pwd)"/tests/test_scrippy_core.py --hist | grep -cE "[0-9]+\.[0-9]+_[0-9]+") -eq 1
when:
event:
exclude:
- tag
- name: Build and publish
image: python
environment:
badge_url: '![Build Status](https://drone.mcos.nc/api/badges/scrippy/scrippy-core/status.svg) ![License](https://img.shields.io/static/v1?label=license&color=orange&message=WTFPL) ![Language](https://img.shields.io/static/v1?label=language&color=informational&message=Python)'
pip_user:
from_secret: pip_user
pip_password:
from_secret: pip_password
commands:
- rm -Rf ./build ./dist ./scrippy_core.egg-info ./scrippy_core/__pycache__ ./tests/__pycache__ ./junit_report.xml ./.coverage
- find ./ -maxdepth 3 -type d -name "*__pycache__*" -exec rm -Rf {} \;
- python -m pip install pip --upgrade
- python -m pip install .[dev]
- git push --set-upstream origin master
- bump2version patch
- VERSION=$(grep ^current_version ./.bumpversion.cfg | cut -d\ -f3);
- SCORE=$(pylint ./scrippy_core/* --exit-zero --confidence=HIGH -f parseable | tail -n2 | head -n1 | cut -d\ -f7)
- sed -i "1c \![version](https://img.shields.io/static/v1?label=version&color=informational&message=$${VERSION}) ![pylint](https://img.shields.io/static/v1?label=pylint&color=informational&message=$${SCORE}) $${badge_url}" README.md
- git add setup.cfg .bumpversion.cfg README.md
- git commit -m 'Increment version [CI SKIP]'
- pypirc -s local -u $${pip_user} -p $${pip_password} -r https://pip.mcos.nc
- python3 setup.py sdist bdist_wheel register -r local upload -r local
- git push origin
depends_on:
- Test
when:
branch: master
event:
exclude:
- pull_request
- tag
- name: Tag
image: python
commands:
- python -m pip install pip --upgrade
- VERSION=$(grep ^current_version ./.bumpversion.cfg | cut -d\ -f3);
- git tag $${VERSION}
- git push origin $${VERSION}
depends_on:
- Build and publish
when:
branch: master
event:
exclude:
- tag
- pull_request
services:
- name: mailer
pull: never
image: mailer:latest
ports:
- 2500
- name: gitolite
pull: never
image: gitolite:latest
ports:
- 2201
- name: scrippy_db
image: scrippy_db
pull: never
ports:
- 5432
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: scrippy
- name: api
pull: never
image: gunicorn:latest
ports:
- 8080
- name: remote
pull: never
image: sshd:latest
ports:
- 2200
---
kind: signature
hmac: c9644a6cfc112ff8a609866a61c4f4e83c20807b52db95c6c87d1c2c1e471a5f
...