This repository was archived by the owner on Dec 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
147 lines (134 loc) · 3.15 KB
/
.gitlab-ci.yml
File metadata and controls
147 lines (134 loc) · 3.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
stages:
- preflight
- homeassistant
- deploy
variables:
GIT_SUBMODULE_STRATEGY: recursive
# Generic preflight template
.preflight: &preflight
stage: preflight
tags:
- hass
# Generic Home Assistant template
.ha: &ha
stage: homeassistant
variables:
PYTHONPATH: "/usr/src/app:$PYTHONPATH"
before_script:
- python -m homeassistant --version
- cp $CI_PROJECT_DIR/ci_secrets.yaml $CI_PROJECT_DIR/secrets.yaml
- rm -f packages/hacs.yaml
- rm -f packages/rubbish.yaml
script:
- |
/usr/local/bin/python -m homeassistant \
--config $CI_PROJECT_DIR/ \
--script check_config
- |
if /usr/local/bin/python -m homeassistant \
--config $CI_PROJECT_DIR/ --script check_config | \
grep "ERROR" ; then exit 1; else echo "No YAML errors"; fi
tags:
- hass
# before_script:
# - apt-get update
# - apt-get install -y mosquitto-clients
# Preflight jobs
shellcheck:
<<: *preflight
image:
name: koalaman/shellcheck-alpine:stable
entrypoint: [""]
before_script:
- ln -s $CI_PROJECT_DIR /config
- mv shell_commands/ci_secrets.sh shell_commands/secrets.sh
- shellcheck --version
- apk --no-cache add grep
script:
- |
for file in $(grep -IRl "#\!\(/usr/bin/env bash\|/bin/bash\)" \
--exclude-dir ".git" .); do
if ! shellcheck -x $file; then
export FAILED=1
else
echo "$file OK"
fi
done
if [ "${FAILED}" = "1" ]; then
exit 1
fi
yamllint:
<<: *preflight
image: sdesbure/yamllint
before_script:
- yamllint --version
- mv ci_secrets.yaml secrets.yaml
- rm -f known_devices.yaml appdaemon.yaml apps/apps.yaml
script:
- yamllint -c ci_config/.yamllint .
allow_failure: true
jsonlint:
<<: *preflight
image: sahsu/docker-jsonlint
before_script:
- jsonlint --version || true
script:
- |
for file in $(find . -type f -name \
"*.json" -path "mysensors.json" -prune); do
if ! jsonlint -q $file; then
export FAILED=1
else
echo "$file OK"
fi
done
if [ "${FAILED}" = "1" ]; then
exit 1
fi
markdownlint:
<<: *preflight
image:
name: ruby:alpine
entrypoint: [""]
before_script:
- apk --no-cache add git
- gem install mdl
- mdl --version
script:
- mdl --style ci_config/mdstyle.rb --warnings --git-recurse .
# Home Assistant test jobs
ha-latest:
<<: *ha
image:
name: homeassistant/home-assistant:latest
entrypoint: [""]
ha-rc:
<<: *ha
image:
name: homeassistant/home-assistant:rc
entrypoint: [""]
allow_failure: true
ha-dev:
<<: *ha
image:
name: homeassistant/home-assistant:dev
entrypoint: [""]
allow_failure: true
deploy:
stage: deploy
image:
name: alpine:latest
entrypoint: [""]
environment:
name: home-assistant
before_script:
- apk --no-cache add curl
script:
- "curl -X POST -H \"Authorization: Bearer $DEPLOYMENT_HASS_TOKEN\" -H \
\"Content-Type: application/json\" \
$DEPLOYMENT_HASS_URL/api/services/script/configuation_update"
only:
refs:
- master
tags:
- hass