From 8ac4b730491f49959f5a4906fdc1de69a0b75a69 Mon Sep 17 00:00:00 2001 From: JR Conlin Date: Fri, 15 Jan 2021 15:36:34 -0800 Subject: [PATCH] Chore/circleci (#125) * chore: convert to .circleci Closes: #124 --- .circleci/config.yml | 55 ++++++++++++++++++++++++++++++++++++++ .travis.yml | 16 ----------- aplt/metrics.py | 2 +- aplt/tests/test_metrics.py | 2 +- 4 files changed, 57 insertions(+), 18 deletions(-) create mode 100644 .circleci/config.yml delete mode 100644 .travis.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..9cf54d8 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,55 @@ +# These environment variables must be set in CircleCI UI +# +# DOCKERHUB_REPO - docker hub repo, format: / +# DOCKER_USER - login info for docker hub +# DOCKER_PASS +# +version: 2.1 +defaults: + docker_login: &docker_login + run: + name: Login to Dockerhub + command: | + if [ "${DOCKER_USER}" == "" ] || [ "${DOCKER_PASS}" == "" ]; then + echo "Skipping Login to Dockerhub, no credentials." + else + echo "${DOCKER_PASS}" | docker login -u="${DOCKER_USER}" --password-stdin + fi +jobs: + test: + docker: + - image: pypy:2.7 + auth: + username: $DOCKER_USER + password: $DOCKER_PASS + # Future TODO: use a local dynamodb + working_directory: /app + steps: + - checkout + - setup_remote_docker + - run: + name: Install Docker test dependencies + command: | + apt update + apt install -y pypy-dev + pip install tox flake8 + #- run: + # name: flake8 + # command: | + # flake8 aplt + - run: + name: run tests & coverage + environment: + TOXENV: pypy + CODECOV: true + command: | + tox -e ALL + +workflows: + version: 2 + build-test-deploy: + jobs: + - test: + filters: + tags: + only: /.*/ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8b80267..0000000 --- a/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -language: python -cache: pip -sudo: false - -matrix: - include: - - python: pypy-5.4.1 - env: TOXENV=pypy CODECOV=true - - env: TOXENV=flake8 - -install: - - pip install tox codecov -script: - - tox ${CODECOV:+-- --with-coverage --cover-xml --cover-package=aplt} -after_success: - - ${CODECOV:+codecov} diff --git a/aplt/metrics.py b/aplt/metrics.py index f2d2f83..a9cc22a 100644 --- a/aplt/metrics.py +++ b/aplt/metrics.py @@ -76,7 +76,7 @@ def __init__(self, api_key, app_key, flush_interval=10, datadog.initialize(api_key=api_key, app_key=app_key) self._client = ThreadStats() self._flush_interval = flush_interval - self._host = get_hostname() + self._host = get_hostname(False) self._namespace = namespace def _prefix_name(self, name): diff --git a/aplt/tests/test_metrics.py b/aplt/tests/test_metrics.py index 176ab3b..6af44d1 100644 --- a/aplt/tests/test_metrics.py +++ b/aplt/tests/test_metrics.py @@ -48,7 +48,7 @@ def test_basic(self, mock_reactor): class DatadogMetricsTestCase(unittest.TestCase): @patch("aplt.metrics.datadog") def test_basic(self, mock_dog): - hostname = get_hostname() + hostname = get_hostname(False) m = DatadogMetrics("someapikey", "someappkey", namespace="testpush") ok_(len(mock_dog.mock_calls) > 0)