mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
Improve CI handling
This commit is contained in:
@ -7,7 +7,7 @@ from os.path import isfile, join
|
|||||||
|
|
||||||
from platformio import __version__
|
from platformio import __version__
|
||||||
from platformio.exception import InvalidSettingName, InvalidSettingValue
|
from platformio.exception import InvalidSettingName, InvalidSettingValue
|
||||||
from platformio.util import get_home_dir
|
from platformio.util import get_home_dir, is_ci
|
||||||
|
|
||||||
DEFAULT_SETTINGS = {
|
DEFAULT_SETTINGS = {
|
||||||
"check_platformio_interval": {
|
"check_platformio_interval": {
|
||||||
@ -109,8 +109,7 @@ def get_setting(name):
|
|||||||
if name == "enable_prompts":
|
if name == "enable_prompts":
|
||||||
# disable prompts for Continuous Integration systems
|
# disable prompts for Continuous Integration systems
|
||||||
# and when global "--force" option is set
|
# and when global "--force" option is set
|
||||||
if any([getenv("CI", "").lower() == "true",
|
if any([is_ci(), get_session_var("force_option")]):
|
||||||
get_session_var("force_option")]):
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
_env_name = "PLATFORMIO_SETTING_%s" % name.upper()
|
_env_name = "PLATFORMIO_SETTING_%s" % name.upper()
|
||||||
|
@ -7,6 +7,7 @@ import re
|
|||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
import uuid
|
import uuid
|
||||||
|
from os import getenv
|
||||||
from time import time
|
from time import time
|
||||||
|
|
||||||
import click
|
import click
|
||||||
@ -197,6 +198,32 @@ def _finalize():
|
|||||||
def on_command(ctx): # pylint: disable=W0613
|
def on_command(ctx): # pylint: disable=W0613
|
||||||
mp = MeasurementProtocol()
|
mp = MeasurementProtocol()
|
||||||
mp.send("screenview")
|
mp.send("screenview")
|
||||||
|
if util.is_ci():
|
||||||
|
measure_ci()
|
||||||
|
|
||||||
|
|
||||||
|
def measure_ci():
|
||||||
|
event = {
|
||||||
|
"category": "CI",
|
||||||
|
"action": "NoName",
|
||||||
|
"label": None
|
||||||
|
}
|
||||||
|
|
||||||
|
envmap = {
|
||||||
|
"APPVEYOR": {"label": getenv("APPVEYOR_REPO_NAME")},
|
||||||
|
"CIRCLECI": {"label": "%s/%s" % (getenv("CIRCLE_PROJECT_USERNAME"),
|
||||||
|
getenv("CIRCLE_PROJECT_REPONAME"))},
|
||||||
|
"TRAVIS": {"label": getenv("TRAVIS_REPO_SLUG")},
|
||||||
|
"SHIPPABLE": {"label": getenv("REPO_NAME")},
|
||||||
|
"DRONE": {"label": getenv("DRONE_REPO_SLUG")}
|
||||||
|
}
|
||||||
|
|
||||||
|
for key, value in envmap.iteritems():
|
||||||
|
if getenv(key, "").lower() != "true":
|
||||||
|
continue
|
||||||
|
event.update({"action": key, "label": value['label']})
|
||||||
|
|
||||||
|
on_event(**event)
|
||||||
|
|
||||||
|
|
||||||
def on_run_environment(options, targets):
|
def on_run_environment(options, targets):
|
||||||
|
Reference in New Issue
Block a user