From 09e808190abfbe5fbd9d979408867b3deffc92fe Mon Sep 17 00:00:00 2001 From: Todd Underwood Date: Tue, 17 Nov 2020 10:45:52 -0800 Subject: [PATCH 01/10] feat: inital commit of GH Actions config --- .github/workflows/build.yml | 33 ++++++++++++++++++++++ .github/workflows/release.yml | 53 +++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..b753829 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,33 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Python package + +on: + push + pull_request: + branches: [ master ] + +jobs: + Build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [2.7, 3.6] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install google-compute-engine + pip install twine + pip install -r requirements.txt + python setup.py install + - name: Run Tests + run: | + nosetests --verbosity=2 tests/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a25a719 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,53 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Python package + +on: + push: + # Sequence of patterns matched against refs/tags + tags: + - 'v*' # Push events to matching v*, i.e. v1.0, v2 + +jobs: + Build-And-Release: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [2.7, 3.6] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install google-compute-engine + pip install twine + pip install -r requirements.txt + python setup.py install + - name: Run Tests + run: | + nosetests --verbosity=2 tests/ + - name: Prepare for release to PyPi + run: | + python setup.py sdist + python setup.py bdist_wheel --universal + - name: Publish a Python distribution to PyPI + uses: pypa/gh-action-pypi-publish@master + with: + user: ${{ secrets.PYIP_USERNAME }} + password: ${{ secrets.PYPI_PASSWORD }} + - name: Slack notification when release fails + if: ${{ failure() }} + uses: rtCamp/action-slack-notify@v2.1.0 + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + SLACK_CHANNEL: cerberus-alerts + SLACK_MESSAGE: 'Cerberus release workflow has failed :build-failed:' + SLACK_ICON: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png + SLACK_TITLE: Cerberus Build Failure Notification + SLACK_USERNAME: GitHub Actions From ae52fd23234ca4311eea1ecb8e83c5251c85570a Mon Sep 17 00:00:00 2001 From: Todd Underwood Date: Tue, 17 Nov 2020 10:47:37 -0800 Subject: [PATCH 02/10] fix build trigger --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b753829..07f8a19 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,8 @@ name: Python package on: - push + push: + branches: [*] pull_request: branches: [ master ] From 68678a35c8a63decd55fff63aa411e356435d928 Mon Sep 17 00:00:00 2001 From: Todd Underwood Date: Tue, 17 Nov 2020 10:48:04 -0800 Subject: [PATCH 03/10] fix build trigger --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 07f8a19..5e58a85 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,7 +5,7 @@ name: Python package on: push: - branches: [*] + branches: ['*'] pull_request: branches: [ master ] From d49cc50eeedfbe1d5c74ff105148f06ce7115111 Mon Sep 17 00:00:00 2001 From: Todd Underwood Date: Tue, 17 Nov 2020 10:50:03 -0800 Subject: [PATCH 04/10] fix build trigger --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5e58a85..5b71981 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,7 +5,8 @@ name: Python package on: push: - branches: ['*'] + branches: + - '**' pull_request: branches: [ master ] From ed8889c6d8186bb48999de7ac943eccf51013319 Mon Sep 17 00:00:00 2001 From: Todd Underwood Date: Tue, 17 Nov 2020 10:55:54 -0800 Subject: [PATCH 05/10] fix build --- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5b71981..512e564 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,7 +28,7 @@ jobs: python -m pip install --upgrade pip pip install google-compute-engine pip install twine - pip install -r requirements.txt + pip install -r requirements-dev.txt python setup.py install - name: Run Tests run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a25a719..5d046ed 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,7 +27,7 @@ jobs: python -m pip install --upgrade pip pip install google-compute-engine pip install twine - pip install -r requirements.txt + pip install -r requirements-dev.txt python setup.py install - name: Run Tests run: | From df98e581ec5cfc81264895edce94cd31981a3054 Mon Sep 17 00:00:00 2001 From: Todd Underwood Date: Tue, 17 Nov 2020 11:06:37 -0800 Subject: [PATCH 06/10] pin to 18.04 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 512e564..8b14869 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ on: jobs: Build: - runs-on: ubuntu-latest + runs-on: ubuntu-18.04 strategy: matrix: python-version: [2.7, 3.6] From 86c8c999fed44c9ec61505c463fc942e83336c22 Mon Sep 17 00:00:00 2001 From: Todd Underwood Date: Tue, 17 Nov 2020 11:15:28 -0800 Subject: [PATCH 07/10] try to add coverage reporting --- .github/workflows/build.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8b14869..0b29e8a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,4 +32,10 @@ jobs: python setup.py install - name: Run Tests run: | - nosetests --verbosity=2 tests/ + nosetests --with-coverage --cover-xml tests/ + - name: Upload coverage report to CodeCov + uses: codecov/codecov-action@v1 + with: + file: coverage.xml # optional + fail_ci_if_error: true # optional (default = false) + verbose: true From 7a89ad13df50d1dfb7eb8b3490289a36a17c0e38 Mon Sep 17 00:00:00 2001 From: Todd Underwood Date: Tue, 17 Nov 2020 11:24:42 -0800 Subject: [PATCH 08/10] Chore: Clean up files --- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 2 +- README.md | 6 +++--- cerberus/__init__.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0b29e8a..0127db5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,7 +1,7 @@ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions -name: Python package +name: Build on: push: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5d046ed..2549a42 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,7 @@ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions -name: Python package +name: Build and Release on: push: diff --git a/README.md b/README.md index 9a23dc3..bd242a5 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # Cerberus Python Client -[![][travis img]][travis] +![Python package](https://github.com/Nike-Inc/cerberus-python-client/workflows/Build/badge.svg) [![][license img]][license] +[![codecov](https://codecov.io/gh/Nike-Inc/cerberus-python-client/branch/master/graph/badge.svg)](https://codecov.io/gh/Nike-Inc/cerberus-python-client) [![PyPI version](https://badge.fury.io/py/cerberus-python-client.svg)](https://badge.fury.io/py/cerberus-python-client) This is a Python based client library for communicating with Cerberus via HTTPS and enables authentication schemes specific @@ -379,8 +380,7 @@ Refer to the "local development" section at [Quick Start](http://engineering.nik Cerberus Management Service is released under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) -[travis]:https://travis-ci.org/Nike-Inc/cerberus-python-client -[travis img]:https://api.travis-ci.org/Nike-Inc/cerberus-python-client.svg?branch=master +[gh actions img]:https://api.travis-ci.org/Nike-Inc/cerberus-python-client.svg?branch=master [license]:LICENSE.txt [license img]:https://img.shields.io/badge/License-Apache%202-blue.svg diff --git a/cerberus/__init__.py b/cerberus/__init__.py index e05099d..c3b8afc 100644 --- a/cerberus/__init__.py +++ b/cerberus/__init__.py @@ -3,7 +3,7 @@ __all__ = ['client', 'user_auth', 'aws_auth', 'util'] -CLIENT_VERSION = '2.5.0' +CLIENT_VERSION = '2.5.1' class CerberusClientException(Exception): """Wrap third-party exceptions expected by the Cerberus client.""" From 9ccd66ce2b114430a751a0bd5afb6db8970618d7 Mon Sep 17 00:00:00 2001 From: Todd Underwood Date: Tue, 17 Nov 2020 11:29:00 -0800 Subject: [PATCH 09/10] Remove Travis File --- .travis.yml | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a54346a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ -language: python -python: -- '2.7' -- '3.6' -install: -- pip install -r requirements-dev.txt -- pip install google-compute-engine -- pip install twine -- python setup.py install -script: -- nosetests --verbosity=2 tests/ -after_success: -- test "${TRAVIS_PULL_REQUEST}" == "false" && test "${TRAVIS_TAG}" != "" && python - setup.py sdist && python setup.py bdist_wheel --universal && twine -u ${USERNAME} - -p ${PASSWORD} -r https://pypi.python.org/pypi register dist/*.whl && twine upload - -u ${USERNAME} -p ${PASSWORD} -r https://pypi.python.org/pypi dist/*.tar.gz -env: - global: - - secure: TeTGvEJ56ZjN0f7SXFgH1pkmUShIiVsNNQyEIfKZy4Zk4swgQa++9Nel0YthM8D9whogTMS0Vfg60XXCeXx/p74xMlAmq1B3bNcC0IHYMneZRHu1V8ZGcJqbWBxg8oRuQqx/QgTLy2xQ42Q2LwK4jUg3dVr38uxCj5YI77flK00hTjTw03N9ymhsUP364pELghZzqBNtl8JL1U1xXUnLAUReQJaOQKR5sN5w7TpVKSNzMMKQ2jAW0pK8HrNlpBAk/1sYGLymXQjfyRQh732IDnGAF8kf6wFQ7A1/rmMXu6MQvhijL+y0r6yTscJfYrBoXxlXKI+O1g8m0pE4+UWDh4SDnTw6oFnLOHs7OdosHa7qgneBOa2QI3xZVgTYdUBVgvUCNXOHFgZDqSzvLxxGtZpzvjzvIisHTlONftwuf6o39vrnTfmJMS9Z06BQVYxBF7bow7ldhlEdMg4M8lqZzIvkIUP5fUXHz3Lra1SfoDI3+JcOemsQSs1/DNGE/lPydNLIrow9e9ysdBEVy6FabpmbSwGH5qpWeHo4qCVo8+9B0nt5qRl7SIB5xf2+4p7z3G7vWVb2hmT8YIBla07unc13KhNqbhbQMxgMCshpPptsW7EGN35gfYqptL5ReG0oMPvjxBymjFjVYkYOdSdfLO4pLPLaR0T2sGxKFHpC0yo= - - secure: lZwArLMIME6XrNMvQXrhVKNn1HyZuEWoovK32lCohNtHp3cjXY1N5iRoz5umfFsa2I8I36Skcw+3BxTFBhs41caS/BcnylY2ON9n6puA9DfOaIq0IANnzgzBB/zSFKYqt0zTbr1t19E+un8lhJFaIY1TfkW0epMWxAig6f7A3/uet7c04Uh0XJrFrOUQ0z+PMIdJnY0WIczP8JmkUjw8sn16kNJSVCT473OyXcLRlcDikQXZboFeSfGC4CQKEcoxMmXEjqt1DOZNiWK5XyDZG5IwNM8EF8RSiPpZ1rzBSPOh7+H9fducZqat8aHQbmTd+IF70oRxtcz1+4xlpHpl96hehJcbDckDwC7/KaVOilb8NV6s1qNa/qguFn2YHEKn7x3noe3rtLXN/PW+dDSCFlVwrSD1ZltUnBdAh50LcNYV2KZMYW9UBHyWjHIn00U2T7n0sUPSUeOTAqpGsyG87WpqUj4Bdacq/bKUPF8iEbvgvgA99/sKObK8OKnpoUr4kdUi2W4egfnBz7PTB6kIdL/C4U284IXsQBORLRrOpWpW2TQ65k6Kdcq5ertHRON27sIu2MQoSM0qoSi7eWz8Qmb5ql9bnOFg+xY6QLE57oeBpzmDQXL3sGhZQwjSQERVpzMiswbI3JSodzYxbizLuiBrU5iDTvmjBeRae+l6nmM= -notifications: - slack: - if: branch = master AND (type = push OR type=cron) - on_success: change - on_failure: always - rooms: - - secure: lL7sg30YyDduAeBUP3izaQnyjcFqHoVWdy5fn6KkRIX3562m4viqP7IZ8g0pVHOoPi5r+C4Sc6Ybj6yGqM0/RPnQjJ4o68Vv8K7bS77DhKGt+AaVKXG+XrTYyhk2oFybCTV+YTAmMTkoLANdQBtBYCGhIOHWLH7gehWManXgX/KmCJGBi1SBqKpl9NeWHCJzwYS0goJ3kDh1MJa5ZO5K1qKYRWSiAYeUXATkjJphtNZUOXGbmx4RFzRibiTndonQw24riQw6ZTO5IPIObK7YVDZkRh/wFErdQfbkRpUfkP97HsgIdWfONBIB8vUIQ7Ju3oWhtWZ+2WOCoHARCTHZf4kzONJVaCnCfgZSLBDBEr8MVoVHm2tBn/iea/0whD36SaUXU84E9iLF1Sxc53CBdqin29lYlfIhvs/NmVYQ/pGOe0/BFIwegeILOb3pm2Ne+8k4pnYGl+hIJixhiiTDTR5As1IG/Bv0vOlttuoAvDyL+4QxOU6Jzdy+yf1MVqsGcrnfR/HpF7Y3ztqB7et8nlsdYV7GYQ6nI6SuOrXEpwsnlG2Do5iqfz14AuqH8zRkqosy8rURbjvItutqlvkrD7DV/eKRpe+KQDQwhOsdiLvgKltEG241WTOIu/7xTCXgj6+gh5cOAFR7XYmOMVtN39ZoBkLzy+Yzbr3sLmZMXOA= From d08ae709672da647bd955bf8e35d52f20ca876dc Mon Sep 17 00:00:00 2001 From: Todd Underwood Date: Tue, 17 Nov 2020 12:17:09 -0800 Subject: [PATCH 10/10] ensure we notify slack if master branch fails --- .github/workflows/build.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0127db5..2dbc14b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,3 +39,13 @@ jobs: file: coverage.xml # optional fail_ci_if_error: true # optional (default = false) verbose: true + - name: Slack notification when master build fails + if: ${{ failure() && github.ref == 'refs/heads/master'}} + uses: rtCamp/action-slack-notify@v2.1.0 + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + SLACK_CHANNEL: cerberus-alerts + SLACK_MESSAGE: 'Cerberus main build has failed :build-failed:' + SLACK_ICON: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png + SLACK_TITLE: Cerberus Build Failure Notification + SLACK_USERNAME: GitHub Actions