elradix

GITLABCI

Jul 9th, 2019
108
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ---
  2. image: docker:latest
  3.  
  4. stages:
  5.  - preflight
  6.   - test
  7.  
  8. # Generic preflight template
  9. .preflight: &preflight
  10.   stage: preflight
  11.  
  12. # Generic test template
  13. .dev: &test
  14.   stage: test
  15.   variables:
  16.     PYTHONPATH: "/usr/src/app:$PYTHONPATH"
  17.   before_script:
  18.    - python -m homeassistant --version
  19.     - pip3 install colorlog
  20.     - cp secrets_redacted.yaml secrets.yaml
  21.     - mkdir fake_directory/
  22.     - touch fake_directory/data.log
  23.     - touch fake_directory/cert.log
  24.     - touch fake_directory/cert_eu.log
  25.     - echo "10" > fake_directory/cert.log
  26.     - echo "10" > fake_directory/cert_eu.log    
  27. #    - touch ./home-assistant_v2.db
  28. #    - touch ./home-assistant.log
  29. #    - touch ./OZW_Log.txt
  30.   script:
  31.    - |
  32.      python -m homeassistant \
  33.         --script check_config -c . #\
  34. #        --info all
  35.  
  36. # Preflight jobs
  37. shellcheck:
  38.   <<: *preflight
  39.   image:
  40.     name: koalaman/shellcheck-alpine:stable
  41.     entrypoint: [""]
  42.   before_script:
  43.    - shellcheck --version
  44.     - apk --no-cache add grep
  45.     - |
  46.      find . -type f -print0 | \
  47.         xargs -0 sed -i 's:#!/usr/bin/with-contenv bash:#!/bin/bash:g'
  48.   script:
  49.    - |
  50.      for file in $(grep -IRl "#\!\(/usr/bin/env \|/bin/\)" --exclude-dir ".git" "${ADDON_TARGET}"); do
  51.         if ! shellcheck $file; then
  52.           export FAILED=1
  53.         else
  54.           echo "$file OK"
  55.         fi
  56.       done
  57.       if [ "${FAILED}" = "1" ]; then
  58.         exit 1
  59.       fi
  60. yamllint:
  61.   <<: *preflight
  62.   image: sdesbure/yamllint
  63.   allow_failure: true
  64.   before_script:
  65.    - yamllint --version
  66.   script:
  67.    - yamllint .
  68.  
  69. jsonlint:
  70.   <<: *preflight
  71.   image: sahsu/docker-jsonlint
  72.   allow_failure: true
  73.   before_script:
  74.    - jsonlint --version || true
  75.   script:
  76.    - |
  77.      for file in $(find . -type f -name "*.json"); do
  78.         if ! jsonlint -q $file; then
  79.           export FAILED=1
  80.         else
  81.           echo "$file OK"
  82.         fi
  83.       done
  84.       if [ "${FAILED}" = "1" ]; then
  85.         exit 1
  86.       fi
  87. markdownlint:
  88.   <<: *preflight
  89.   image:
  90.     name: ruby:alpine
  91.     entrypoint: [""]
  92.   allow_failure: true  
  93.   before_script:
  94.    - gem install mdl
  95.     - mdl --version
  96.   script:
  97.    - mdl --style all --warnings .
  98.  
  99. # Test jobs
  100. latest:
  101.   <<: *test
  102.   image:
  103.     name: homeassistant/home-assistant:latest
  104.     entrypoint: [""]
  105.  
  106. rc:
  107.   <<: *test
  108.   image:
  109.     name: homeassistant/home-assistant:rc
  110.     entrypoint: [""]
  111.   allow_failure: true
  112.  
  113. dev:
  114.   <<: *test
  115.   image:
  116.     name: homeassistant/home-assistant:dev
  117.     entrypoint: [""]
  118.   allow_failure: true
RAW Paste Data