From 10b4cc3a3b61953d1b3fe63ba8e7903c83742336 Mon Sep 17 00:00:00 2001 From: dherrada Date: Tue, 3 Dec 2019 18:23:08 -0500 Subject: [PATCH 1/2] Moving from Travis to GitHub Actions --- .github/workflows/build.yml | 47 +++++++++++++++++++++++ .github/workflows/release.yml | 70 +++++++++++++++++++++++++++++++++++ .gitignore | 3 +- .travis.yml | 43 --------------------- README.rst | 4 +- 5 files changed, 120 insertions(+), 47 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..54c6663 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,47 @@ +name: Build CI + +on: [pull_request, push] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + - name: Translate Repo Name For Build Tools filename_prefix + id: repo-name + run: | + echo ::set-output name=repo-name::$( + echo ${{ github.repository }} | + awk -F '\/' '{ print tolower($2) }' | + tr '_' '-' + ) + - name: Set up Python 3.6 + uses: actions/setup-python@v1 + with: + python-version: 3.6 + - name: Versions + run: | + python3 --version + - uses: actions/checkout@v1 + with: + submodules: true + - name: Install deps + run: | + sudo apt-get install -y gettext + pip install -r requirements.txt + pip install circuitpython-build-tools Sphinx sphinx-rtd-theme + pip install --force-reinstall pylint==1.9.2 + - name: Library version + run: git describe --dirty --always --tags + - name: PyLint + run: | + pylint $( find . -path './adafruit*.py' ) + ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,bad-whitespace examples/*.py) + - name: Build assets + run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location . + - name: Build docs + working-directory: docs + run: sphinx-build -E -W -b html . _build/html diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..83fc810 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,70 @@ +name: Release Actions + +on: + release: + types: [published] + +jobs: + upload-release-assets: + runs-on: ubuntu-latest + steps: + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + - name: Translate Repo Name For Build Tools filename_prefix + id: repo-name + run: | + echo ::set-output name=repo-name::$( + echo ${{ github.repository }} | + awk -F '\/' '{ print tolower($2) }' | + tr '_' '-' + ) + - name: Set up Python 3.6 + uses: actions/setup-python@v1 + with: + python-version: 3.6 + - name: Versions + run: | + python3 --version + - uses: actions/checkout@v1 + with: + submodules: true + - name: Install deps + run: | + sudo apt-get install -y gettext + pip install -r requirements.txt + pip install circuitpython-build-tools Sphinx sphinx-rtd-theme + - name: Build assets + run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location . + - name: Upload Release Assets + # the 'official' actions version does not yet support dynamically + # supplying asset names to upload. @csexton's version chosen based on + # discussion in the issue below, as its the simplest to implement and + # allows for selecting files with a pattern. + # https://github.com/actions/upload-release-asset/issues/4 + #uses: actions/upload-release-asset@v1.0.1 + uses: csexton/release-asset-action@master + with: + pattern: "bundles/*" + github-token: ${{ secrets.GITHUB_TOKEN }} + + upload-pypi: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.pypi_username }} + TWINE_PASSWORD: ${{ secrets.pypi_password }} + run: | + python setup.py sdist + twine upload dist/* diff --git a/.gitignore b/.gitignore index 55f127b..1be1c4b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,9 +4,8 @@ __pycache__ _build *.pyc .env -build* bundles *.DS_Store .eggs dist -**/*.egg-info \ No newline at end of file +**/*.egg-info diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index bc2a83f..0000000 --- a/.travis.yml +++ /dev/null @@ -1,43 +0,0 @@ -# This is a common .travis.yml for generating library release zip files for -# CircuitPython library releases using circuitpython-build-tools. -# See https://github.com/adafruit/circuitpython-build-tools for detailed setup -# instructions. - -dist: xenial -language: python -python: - - "3.6" - -cache: - pip: true - -env: - - DEPLOY_PYPI="true" - -deploy: - - provider: releases - api_key: "$GITHUB_TOKEN" - file_glob: true - file: "$TRAVIS_BUILD_DIR/bundles/*" - skip_cleanup: true - overwrite: true - on: - tags: true - - provider: pypi - user: adafruit-travis - password: - secure: as3x42ABUNswdux+2R9vryaCJFd3/L/YojxaKXV1gcLyqn6HXMC/s/GqIXM+heF5QrNmvKT8WWOejYCdK4mZy+FHicIgM4Frws0MQ4oQQ9ETtw2WvTTC9xHpOFhGvqShzPRcKfzImuDgh7yA2qh32yIxjrUc3/kC3hZWYaQsTjIIapiO2X/wBsQJIWLQZNGOg32GNYGTrkXR0+5yR3wWCrojlBfTUmWRMbe1M8nDxqcnBKIioO8qrrMCCUDjovR3NBGpiDbAXp4go+fQZyCgrcSoRpTIXNXPN+BEW9iP+2ElbqP23Ibd2xNhfdOapkbZ9MSG2jBOmrmFlevQStYPnEFWmwYzBjGfbNfU0Vooc6W+dqAVIUblyyxzKqNYHGBF0aKFryb/tucJVvmCv4V4uxMFyggHwycX9BrskLZkzxFKoOfLGFnAClo8WpSmZwYaagvDLek7vQbgSb9rEYDJiq6kq/S5bAQfPJ9P5T+wxllTW4ofkQaJmGpuBlAYa+ln1Q/0VGYorEmoV+826SwM1u1r7rtKEH9108ixxBty3i40q08FzmewJBmJr+t0soCPPMXK5d8Kz2pLLmKPrgdCCg9gjBBkbjYXIzAT/e/uG/UhccvzwFvDuDQ7Wkwoy9bANyHOz79noKKA6xGaw3CWb0RBVx6DqVRe/TO6sgVRSZ4= - on: - tags: true - condition: $DEPLOY_PYPI = "true" - -install: - - pip install -r requirements.txt - - pip install circuitpython-build-tools Sphinx sphinx-rtd-theme - - pip install --force-reinstall pylint==1.9.2 - -script: - - pylint adafruit_hue.py - - ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,bad-whitespace examples/*.py) - - circuitpython-build-bundles --filename_prefix adafruit-circuitpython-hue --library_location . - - cd docs && sphinx-build -E -W -b html . _build/html && cd .. diff --git a/README.rst b/README.rst index d1e96cc..ccbbeac 100644 --- a/README.rst +++ b/README.rst @@ -9,8 +9,8 @@ Introduction :target: https://discord.gg/nBQh6qu :alt: Discord -.. image:: https://travis-ci.com/adafruit/Adafruit_CircuitPython_Hue.svg?branch=master - :target: https://travis-ci.com/adafruit/Adafruit_CircuitPython_Hue +.. image:: https://github.com/adafruit/Adafruit_CircuitPython_Hue/workflows/Build%CI/badge.svg + :target: https://github.com/adafruit/Adafruit_CircuitPython_Hue :alt: Build Status CircuitPython helper library for Philips Hue Lights. From f51057e747f4b59fb04a0d2cd89ec03cc90e2d3a Mon Sep 17 00:00:00 2001 From: dherrada Date: Sun, 29 Dec 2019 23:51:45 -0500 Subject: [PATCH 2/2] Moved repository from Travis to GitHub Actions --- .github/workflows/build.yml | 13 ++++++++----- .github/workflows/release.yml | 19 +++++++++++++++---- README.rst | 2 +- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 54c6663..66ce4db 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,15 +25,18 @@ jobs: - name: Versions run: | python3 --version - - uses: actions/checkout@v1 + - name: Checkout Current Repo + uses: actions/checkout@v1 with: submodules: true + - name: Checkout tools repo + uses: actions/checkout@v2 + with: + repository: adafruit/actions-ci-circuitpython-libs + path: actions-ci - name: Install deps run: | - sudo apt-get install -y gettext - pip install -r requirements.txt - pip install circuitpython-build-tools Sphinx sphinx-rtd-theme - pip install --force-reinstall pylint==1.9.2 + source actions-ci/install.sh - name: Library version run: git describe --dirty --always --tags - name: PyLint diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 83fc810..18efb9c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,14 +27,18 @@ jobs: - name: Versions run: | python3 --version - - uses: actions/checkout@v1 + - name: Checkout Current Repo + uses: actions/checkout@v1 with: submodules: true + - name: Checkout tools repo + uses: actions/checkout@v2 + with: + repository: adafruit/actions-ci-circuitpython-libs + path: actions-ci - name: Install deps run: | - sudo apt-get install -y gettext - pip install -r requirements.txt - pip install circuitpython-build-tools Sphinx sphinx-rtd-theme + source actions-ci/install.sh - name: Build assets run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location . - name: Upload Release Assets @@ -53,15 +57,22 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 + - name: Check For setup.py + id: need-pypi + run: | + echo ::set-output name=setup-py::$( find . -wholename './setup.py' ) - name: Set up Python + if: contains(steps.need-pypi.outputs.setup-py, 'setup.py') uses: actions/setup-python@v1 with: python-version: '3.x' - name: Install dependencies + if: contains(steps.need-pypi.outputs.setup-py, 'setup.py') run: | python -m pip install --upgrade pip pip install setuptools wheel twine - name: Build and publish + if: contains(steps.need-pypi.outputs.setup-py, 'setup.py') env: TWINE_USERNAME: ${{ secrets.pypi_username }} TWINE_PASSWORD: ${{ secrets.pypi_password }} diff --git a/README.rst b/README.rst index ccbbeac..8daf75a 100644 --- a/README.rst +++ b/README.rst @@ -10,7 +10,7 @@ Introduction :alt: Discord .. image:: https://github.com/adafruit/Adafruit_CircuitPython_Hue/workflows/Build%CI/badge.svg - :target: https://github.com/adafruit/Adafruit_CircuitPython_Hue + :target: https://github.com/adafruit/Adafruit_CircuitPython_Hue/actions/ :alt: Build Status CircuitPython helper library for Philips Hue Lights.