.drone.yml
kind: pipeline
type: docker
name: test
steps:
- name: Test Python
image: python:3.12-slim-bookworm
commands:
- apt-get update && apt-get install -y curl git
- ln -fs .env.development .env
- pip install -e .[test]
- curl -L "https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-$(dpkg --print-architecture)" > "${HOME}/bin/cc-test-reporter"
- chmod +x "${HOME}/bin/cc-test-reporter"
- ruff check .
- gunicorn -c config/gunicorn.conf.py --check-config
- mypy .
- cc-test-reporter before-build
- coverage run -m unittest discover
- exitcode="$?"
- coverage report -m
- coverage xml -i
- cc-test-reporter after-build --exit-code "$exitcode"
environment:
CC_TEST_REPORTER_ID: 6859e866e9159afd7aeb668eb616115e4403caca001083b57f24c2e7a4bd632c
- name: Test Node
image: satantime/puppeteer-node:22-bookworm-slim
commands:
- ln -fs .env.development .env
- npm ci
- npm test
- name: Test Bash
image: koalaman/shellcheck-alpine:stable
commands:
- ln -fs .env.development .env
- shellcheck -x bin/*.sh
- name: Test Dockerfile
image: hadolint/hadolint:latest-alpine
commands:
- hadolint Dockerfile --ignore=DL3008 --ignore=SC2046 --ignore=SC2006
- name: Test Nginx
image: python:3.12-alpine
commands:
- pip install gixy==0.1.20 pyparsing==2.4.7
- gixy config/nginx/*
- name: Test Markdown
image: pipelinecomponents/markdownlint:0.13.3
commands:
- git ls-files | grep '\.md$' | xargs mdl --style app/tests/mdl_style.rb
- name: Build Docker Container
depends_on:
- Test Python
- Test Node
- Test Bash
- Test Dockerfile
- Test Nginx
- Test Markdown
image: plugins/docker:20
settings:
repo: albertyw.com
tags: test
dry_run: true
- name: Deploy
depends_on:
- Build Docker Container
environment:
SSH_KEY:
from_secret: ssh_key
image: albertyw/ssh-client:4.1.3
commands:
- ssh-keyscan direct.albertyw.com >> /root/.ssh/known_hosts
- echo "$${SSH_KEY}" > /root/.ssh/id_ed25519
- chmod 600 /root/.ssh/id_ed25519
- ssh albertyw@direct.albertyw.com albertyw.com/bin/deploy.sh master
when:
branch:
- master