albertyw/reaction-pics

View on GitHub
.drone.yml

Summary

Maintainability
Test Coverage
kind: pipeline
type: docker
name: test

steps:
  - name: Test Go
    image: golang:1.22
    commands:
      - cp .env.example .env
      - touch /drone/src/server/static/gen/main.js
      - touch /drone/src/server/static/gen/main.css
      - 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"
      - cc-test-reporter before-build
      - bin/test.sh
      - exitcode="$?"
      - cc-test-reporter after-build --exit-code "$exitcode"
    environment:
      CC_TEST_REPORTER_ID: a80cd7d0697a40f38985bf79bc5aec83b6c742ed8d3463b42388b972a0b99443

  - name: Test Node
    image: satantime/puppeteer-node:21-bookworm-slim
    commands:
      - cp .env.example .env
      - npm ci
      - npm test

  - name: Test Bash
    image: koalaman/shellcheck-alpine:stable
    commands:
      - cp .env.example .env
      - shellcheck -x --exclude=SC1091 bin/*.sh

  - name: Test Dockerfile
    image: hadolint/hadolint:latest-alpine
    commands:
      - hadolint Dockerfile --ignore=DL3008 --ignore=DL4006 --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 Makefile
    image: cytopia/checkmake:latest
    commands:
      - checkmake Makefile

  - name: Build Docker Container
    depends_on:
      - Test Go
      - Test Node
      - Test Bash
      - Test Dockerfile
      - Test Makefile
      - Test Nginx
    image: plugins/docker
    settings:
      repo: reaction-pics
      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.2
    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 reaction-pics/bin/deploy.sh master
    when:
      branch:
        - master