1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- ---
- ################
- # Build & Test #
- ################
- kind: pipeline
- name: run_tests
- steps:
- # Run tests against Python/Flask engine backend (with pytest)
- - name: pytest with coverage
- image: python:3.11.1
- commands:
- # Install dependencies
- - cp emus.conf.example emus.conf
- - pip install poetry
- - poetry install
- # Start with a fresh database (which is already running as a service from Drone)
- - poetry run pytest --cov-report term:skip-covered --cov=emus tests
- environment:
- EMUS_DATABASE_URL: sqlite:///test.db
- volumes:
- # Mount pip cache from host
- - name: pip_cache
- path: /root/.cache/pip
- - name: deploy
- image: appleboy/drone-ssh
- settings:
- host:
- - emus.service
- username: root
- ssh_key:
- from_secret: jail_key
- command_timeout: 2m
- script:
- - pip uninstall -y emus-web
- - pip install git+https://code.unbl.ink/secstate/emus.git@main
- - emus migrate
- - emus collectstatic --noinput
- - immortalctl restart emus
- when:
- branch:
- - main
- - name: build success notification
- image: parrazam/drone-ntfy:0.3-linux-amd64
- when:
- status: [success]
- settings:
- url: https://ntfy.unbl.ink
- topic: drone
- priority: low
- tags:
- - cd
- - failure
- - emus
- - name: build failure notification
- image: parrazam/drone-ntfy:0.3-linux-amd64
- when:
- status: [failure]
- settings:
- url: https://ntfy.unbl.ink
- topic: drone
- priority: high
- tags:
- - cd
- - success
- - emus
- volumes:
- - name: docker
- host:
- path: /var/run/docker.sock
- - name: pip_cache
- host:
- path: /tmp/cache/drone/pip
|