From db0ac3c72e12321e14f9e1e9a565074eff34b200 Mon Sep 17 00:00:00 2001 From: dherrada Date: Tue, 3 Dec 2019 17:44:27 -0500 Subject: [PATCH] Moving from Travis to GitHub Actions --- .github/workflows/build.yml | 47 +++++++++++++++++++++++ .github/workflows/release.yml | 70 +++++++++++++++++++++++++++++++++++ .gitignore | 3 +- .travis.yml | 31 ---------------- README.rst | 4 +- 5 files changed, 120 insertions(+), 35 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 30fb990..0000000 --- a/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -dist: trusty -sudo: false -language: python -python: -- '3.6' -cache: - pip: 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 - on: - tags: true - password: - secure: lDPtYKxyqrKUk/kT770l/yw1TdvNhaIFjCZcEvagzg+RdDTcosDjzp2UGmLI81cOKMmPhJgGVLDN80srHcGdgJThfgqxcDwIBDx+Ggtwf16FFjsjOa3PAhGdo9zOFhj4hhYiF8an6jNVJQlGUbCcMBOW3DbNgze5fScwDQaWBqSJyj7YvtNZukMT6YGCqWRF+UO4VmCBp/tpZc09oA8zHwZG8IKkLhMjKugD8ezx1qL4jXsJ+MMPSoPjweAWpPOqfzVImD1ykTvgLLNJohOvPXs9YfDcMlq0fScpHH1q0VQngFM+u0Y6eQbA01pJGtDjBxrxvWNKwpoUwALscdPlnHOduWAIW5vGlGx3X/Q/N+ntOWjVotsNPQ2ag0RP25UOvvL5m29JuHXTgWz+CtJpik+uZoT5zn8bNZwL5i0waIKLqERRj8sEdd6BbamqWnUFSQg9mZ9niEvRiTk62yv1vfhZmrJlz7ZGSVBqczGFbfpkmC6LVORAr8nps08HGhsYrfJIUQ+kyAfka6VzMEAsphu2JrFwJEbzsuPWD2Y2esen8vUn/rK0Vfi4Tzp7DLrTKETC5u2B2ZHyC0k40twxg5bmoKjXo1eBgdiNCdNFJXiPRCnPLgMau5Q6z1QJXiuOkdpWxuJDaNwYH2+ZuYZuei8Q/lBwXZQgV8l5yR4xDxA= -install: -- pip install -r requirements.txt -- pip install pylint circuitpython-build-tools Sphinx sphinx-rtd-theme -- pip install --force-reinstall pylint==1.9.2 -script: -- pylint adafruit_us100.py -- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,bad-whitespace examples/*.py) -- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-us100 --library_location . -- cd docs && sphinx-build -E -W -b html . _build/html && cd .. diff --git a/README.rst b/README.rst index 483bd6f..3b829db 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_US100.svg?branch=master - :target: https://travis-ci.com/adafruit/Adafruit_CircuitPython_US100 +.. image:: https://github.com/adafruit/Adafruit_CircuitPython_US100/workflows/Build%CI/badge.svg + :target: https://github.com/adafruit/Adafruit_CircuitPython_US100 :alt: Build Status CircuitPython library for reading distance and temperature via US-100 ultra-sonic sensor