Skip to content
This repository was archived by the owner on Sep 8, 2024. It is now read-only.

Commit ba07843

Browse files
author
devs-mycroft
committed
Update to v20.2.2
2 parents d4bbe33 + 4d45933 commit ba07843

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1796
-367
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ doc/_build/
2424
.installed
2525
.mypy_cache
2626
.vscode
27+
.theia
2728
.venv/
2829

2930
# Created by unit tests

Jenkinsfile

Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
pipeline {
2+
agent any
3+
options {
4+
// Running builds concurrently could cause a race condition with
5+
// building the Docker image.
6+
disableConcurrentBuilds()
7+
buildDiscarder(logRotator(numToKeepStr: '5'))
8+
lock resource: 'VoightKampff'
9+
}
10+
stages {
11+
// Run the build in the against the dev branch to check for compile errors
12+
stage('Run Integration Tests') {
13+
when {
14+
anyOf {
15+
branch 'dev'
16+
branch 'master'
17+
changeRequest target: 'dev'
18+
}
19+
}
20+
environment {
21+
// Some branches have a "/" in their name (e.g. feature/new-and-cool)
22+
// Some commands, such as those tha deal with directories, don't
23+
// play nice with this naming convention. Define an alias for the
24+
// branch name that can be used in these scenarios.
25+
BRANCH_ALIAS = sh(
26+
script: 'echo $BRANCH_NAME | sed -e "s#/#-#g"',
27+
returnStdout: true
28+
).trim()
29+
}
30+
steps {
31+
echo 'Building Mark I Voight-Kampff Docker Image'
32+
sh 'cp test/Dockerfile.test Dockerfile'
33+
sh 'docker build \
34+
--target voight_kampff_builder \
35+
--build-arg platform=mycroft_mark_1 \
36+
-t voight-kampff-mark-1:${BRANCH_ALIAS} .'
37+
echo 'Running Mark I Voight-Kampff Test Suite'
38+
timeout(time: 60, unit: 'MINUTES')
39+
{
40+
sh 'docker run \
41+
-v "$HOME/voight-kampff/identity:/root/.mycroft/identity" \
42+
-v "$HOME/voight-kampff/:/root/allure" \
43+
voight-kampff-mark-1:${BRANCH_ALIAS} \
44+
-f allure_behave.formatter:AllureFormatter \
45+
-o /root/allure/allure-result --tags ~@xfail'
46+
}
47+
}
48+
post {
49+
always {
50+
echo 'Report Test Results'
51+
echo 'Changing ownership...'
52+
sh 'docker run \
53+
-v "$HOME/voight-kampff/:/root/allure" \
54+
--entrypoint=/bin/bash \
55+
voight-kampff-mark-1:${BRANCH_ALIAS} \
56+
-x -c "chown $(id -u $USER):$(id -g $USER) \
57+
-R /root/allure/"'
58+
59+
echo 'Transferring...'
60+
sh 'rm -rf allure-result/*'
61+
sh 'mv $HOME/voight-kampff/allure-result allure-result'
62+
script {
63+
allure([
64+
includeProperties: false,
65+
jdk: '',
66+
properties: [],
67+
reportBuildPolicy: 'ALWAYS',
68+
results: [[path: 'allure-result']]
69+
])
70+
}
71+
unarchive mapping:['allure-report.zip': 'allure-report.zip']
72+
sh (
73+
label: 'Publish Report to Web Server',
74+
script: '''scp allure-report.zip [email protected]:~;
75+
ssh [email protected] "unzip -o ~/allure-report.zip";
76+
ssh [email protected] "rm -rf /var/www/voight-kampff/core/${BRANCH_ALIAS}";
77+
ssh [email protected] "mv allure-report /var/www/voight-kampff/core/${BRANCH_ALIAS}"
78+
'''
79+
)
80+
echo 'Report Published'
81+
}
82+
failure {
83+
script {
84+
// Create comment for Pull Requests
85+
if (env.CHANGE_ID) {
86+
echo 'Sending PR comment'
87+
pullRequest.comment('Voight Kampff Integration Test Failed ([Results](https://reports.mycroft.ai/core/' + env.BRANCH_ALIAS + '))')
88+
}
89+
}
90+
// Send failure email containing a link to the Jenkins build
91+
// the results report and the console log messages to Mycroft
92+
// developers, the developers of the pull request and the
93+
// developers that caused the build to fail.
94+
echo 'Sending Failure Email'
95+
emailext (
96+
attachLog: true,
97+
subject: "FAILED - Core Integration Tests - Build ${BRANCH_NAME} #${BUILD_NUMBER}",
98+
body: """
99+
<p>
100+
One or more integration tests failed. Use the
101+
resources below to identify the issue and fix
102+
the failing tests.
103+
</p>
104+
<br>
105+
<p>
106+
<a href='${BUILD_URL}'>
107+
Jenkins Build Details
108+
</a>
109+
&nbsp(Requires account on Mycroft's Jenkins instance)
110+
</p>
111+
<br>
112+
<p>
113+
<a href='https://reports.mycroft.ai/core/${BRANCH_ALIAS}'>
114+
Report of Test Results
115+
</a>
116+
</p>
117+
<br>
118+
<p>Console log is attached.</p>""",
119+
replyTo: '[email protected]',
120+
121+
recipientProviders: [
122+
[$class: 'RequesterRecipientProvider'],
123+
[$class:'CulpritsRecipientProvider'],
124+
[$class:'DevelopersRecipientProvider']
125+
]
126+
)
127+
}
128+
success {
129+
script {
130+
if (env.CHANGE_ID) {
131+
echo 'Sending PR comment'
132+
pullRequest.comment('Voight Kampff Integration Test Succeeded ([Results](https://reports.mycroft.ai/core/' + env.BRANCH_ALIAS + '))')
133+
}
134+
}
135+
// Send success email containing a link to the Jenkins build
136+
// and the results report to Mycroft developers, the developers
137+
// of the pull request and the developers that caused the
138+
// last failed build.
139+
echo 'Sending Success Email'
140+
emailext (
141+
subject: "SUCCESS - Core Integration Tests - Build ${BRANCH_NAME} #${BUILD_NUMBER}",
142+
body: """
143+
<p>
144+
All integration tests passed. No further action required.
145+
</p>
146+
<br>
147+
<p>
148+
<a href='${BUILD_URL}'>
149+
Jenkins Build Details
150+
</a>
151+
&nbsp(Requires account on Mycroft's Jenkins instance)
152+
</p>
153+
<br>
154+
<p>
155+
<a href='https://reports.mycroft.ai/core/${BRANCH_ALIAS}'>
156+
Report of Test Results
157+
</a>
158+
</p>""",
159+
replyTo: '[email protected]',
160+
161+
recipientProviders: [
162+
[$class: 'RequesterRecipientProvider'],
163+
[$class:'CulpritsRecipientProvider'],
164+
[$class:'DevelopersRecipientProvider']
165+
]
166+
)
167+
}
168+
}
169+
}
170+
// Build a voight_kampff image for major releases. This will be used
171+
// by the mycroft-skills repository to test skill changes. Skills are
172+
// tested against major releases to determine if they play nicely with
173+
// the breaking changes included in said release.
174+
stage('Build Major Release Image') {
175+
when {
176+
tag "release/v*.*.0"
177+
}
178+
environment {
179+
// Tag name is usually formatted like "20.2.0" whereas skill
180+
// branch names are usually "20.02". Reformat the tag name
181+
// to the skill branch format so this image will be easy to find
182+
// in the mycroft-skill repository.
183+
SKILL_BRANCH = sh(
184+
script: 'echo $TAG_NAME | sed -e "s/v//g" -e "s/[.]0//g" -e "s/[.]/.0/g"',
185+
returnStdout: true
186+
).trim()
187+
}
188+
steps {
189+
echo 'Building ${TAG_NAME} Docker Image for Skill Testing'
190+
sh 'cp test/Dockerfile.test Dockerfile'
191+
sh 'docker build \
192+
--target voight_kampff_builder \
193+
--build-arg platform=mycroft_mark_1 \
194+
-t voight-kampff-mark-1:${SKILL_BRANCH} .'
195+
}
196+
}
197+
}
198+
post {
199+
cleanup {
200+
sh(
201+
label: 'Docker Container and Image Cleanup',
202+
script: '''
203+
docker container prune --force;
204+
docker image prune --force;
205+
'''
206+
)
207+
}
208+
}
209+
}

README.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,32 @@ When the configuration loader starts, it looks in these locations in this order,
8484

8585
## Using Mycroft Without Home
8686

87-
If you do not wish to use the Mycroft Home service, you may insert your own API keys into the configuration files listed below in <b>configuration</b>.
87+
If you do not wish to use the Mycroft Home service, before starting Mycroft for the first time, create `$HOME/.mycroft/mycroft.conf` with the following contents:
8888

89-
The place to insert the API key looks like the following:
89+
```
90+
{
91+
"skills": {
92+
"blacklisted_skills": [
93+
"mycroft-configuration.mycroftai",
94+
"mycroft-pairing.mycroftai"
95+
]
96+
}
97+
}
98+
```
99+
100+
Mycroft will then be unable to perform speech-to-text conversion, so you'll need to set that up as well, using one of the [STT engines Mycroft supports](https://mycroft-ai.gitbook.io/docs/using-mycroft-ai/customizations/stt-engine).
90101

91-
`[WeatherSkill]`
92-
`api_key = ""`
102+
You may insert your own API keys into the configuration files listed above in <b>Configuration</b>. For example, to insert the API key for the Weather skill, create a new JSON key in the configuration file like so:
93103

94-
Put a relevant key inside the quotes and mycroft-core should begin to use the key immediately.
104+
```
105+
{
106+
// other configuration settings...
107+
//
108+
"WeatherSkill": {
109+
"api_key": "<insert your API key here>"
110+
}
111+
}
112+
```
95113

96114
## API Key Services
97115

bin/mycroft-skill-testrunner

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ source "$DIR/../venv-activate.sh" -q
2323
# Invoke the individual skill tester
2424
if [ "$#" -eq 0 ] ; then
2525
python -m test.integrationtests.skills.runner .
26+
elif [ "$1" = "vktest" ] ; then
27+
shift
28+
python -m test.integrationtests.voight_kampff "$@"
2629
else
2730
python -m test.integrationtests.skills.runner $@
28-
fi
31+
fi

dev_setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ fi" > ~/.profile_mycroft
274274
# Add PEP8 pre-commit hook
275275
sleep 0.5
276276
echo '
277-
(Devloper) Do you want to automatically check code-style when submitting code.
277+
(Developer) Do you want to automatically check code-style when submitting code.
278278
If unsure answer yes.
279279
'
280280
if get_YN ; then

mycroft/client/enclosure/__main__.py

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,44 +12,67 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
#
15-
import sys
15+
"""Entrypoint for enclosure service.
1616
17+
This provides any "enclosure" specific functionality, for example GUI or
18+
control over the Mark-1 Faceplate.
19+
"""
20+
from mycroft.configuration import LocalConf, SYSTEM_CONFIG
1721
from mycroft.util.log import LOG
18-
from mycroft.messagebus.client import MessageBusClient
19-
from mycroft.configuration import Configuration, LocalConf, SYSTEM_CONFIG
22+
from mycroft.util import (create_daemon, wait_for_exit_signal,
23+
reset_sigint_handler)
2024

2125

22-
def main():
23-
# Read the system configuration
24-
system_config = LocalConf(SYSTEM_CONFIG)
25-
platform = system_config.get("enclosure", {}).get("platform")
26+
def create_enclosure(platform):
27+
"""Create an enclosure based on the provided platform string.
2628
29+
Arguments:
30+
platform (str): platform name string
31+
32+
Returns:
33+
Enclosure object
34+
"""
2735
if platform == "mycroft_mark_1":
28-
LOG.debug("Creating Mark I Enclosure")
36+
LOG.info("Creating Mark I Enclosure")
2937
from mycroft.client.enclosure.mark1 import EnclosureMark1
3038
enclosure = EnclosureMark1()
3139
elif platform == "mycroft_mark_2":
32-
LOG.debug("Creating Mark II Enclosure")
40+
LOG.info("Creating Mark II Enclosure")
3341
from mycroft.client.enclosure.mark2 import EnclosureMark2
3442
enclosure = EnclosureMark2()
3543
else:
36-
LOG.debug("Creating generic enclosure, platform='{}'".format(platform))
44+
LOG.info("Creating generic enclosure, platform='{}'".format(platform))
3745

3846
# TODO: Mechanism to load from elsewhere. E.g. read a script path from
3947
# the mycroft.conf, then load/launch that script.
4048
from mycroft.client.enclosure.generic import EnclosureGeneric
4149
enclosure = EnclosureGeneric()
4250

51+
return enclosure
52+
53+
54+
def main():
55+
"""Launch one of the available enclosure implementations.
56+
57+
This depends on the configured platform and can currently either be
58+
mycroft_mark_1 or mycroft_mark_2, if unconfigured a generic enclosure with
59+
only the GUI bus will be started.
60+
"""
61+
# Read the system configuration
62+
system_config = LocalConf(SYSTEM_CONFIG)
63+
platform = system_config.get("enclosure", {}).get("platform")
64+
65+
enclosure = create_enclosure(platform)
4366
if enclosure:
4467
try:
4568
LOG.debug("Enclosure started!")
46-
enclosure.run()
69+
reset_sigint_handler()
70+
create_daemon(enclosure.run)
71+
wait_for_exit_signal()
4772
except Exception as e:
4873
print(e)
49-
finally:
50-
sys.exit()
5174
else:
52-
LOG.debug("No enclosure available for this hardware, running headless")
75+
LOG.info("No enclosure available for this hardware, running headless")
5376

5477

5578
if __name__ == "__main__":

0 commit comments

Comments
 (0)