From 84a72ad189a629ae41645973734ed88585122faf Mon Sep 17 00:00:00 2001 From: dherrada Date: Tue, 10 Dec 2019 17:46:02 -0500 Subject: [PATCH 1/2] Switched from Travis to GitHub Actions --- .github/workflows/build.yml | 47 +++++++++++++++++++++++ .github/workflows/release.yml | 70 +++++++++++++++++++++++++++++++++++ .gitignore | 1 - .travis.yml | 32 ---------------- README.rst | 4 +- 5 files changed, 119 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 cc1a9c8..1be1c4b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,6 @@ __pycache__ _build *.pyc .env -build* bundles *.DS_Store .eggs diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c0ea78d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +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: QCVXg2x28R7W6g+YvewEM0XamfyNVUal0CvNTFgjrnqj4K9Yd9gd8uKXM9cmFxD54y2Uvw8vWyNwQ4IsVZOuuTTohzc3hIlQhSEWhYZTt5i/JQISQSph/Q/dSn0/rb7n2/utfj/g1hB7cQlAtkecISrtIF7wOJacrh11z5/Ay99kcpc60Y7YFjZTbx02g8NnM0g6Cg92fEdRLr2UtwloFw1C0+nQxdb9vS7xj3IWrtfopQ3LRVsLTGocctj5u6OPgkh+FZma+NCIseONqpYX4PYRrRZJRQ4g+SZ+6tFb6zVOHsIAJ0Z6PdLMZmUeNGb42mTfHxPFWaTtPXi5/bgsOLfuL7IMpkirrqQFyppvqi7bqBYC5dCDGguEvzwHZusK4h8SAXiLJL4hZVkzNQ4JJN3JQSvAaF7nv8LIHGNpPsFOF8sd5gndMHUOBZx+lJ6wHqk3dxrhfehKKyv/xZ8Tl1ot65E8I3QBrJfREDbSgTfyetEFMPQLOUkZFcag3FCjiLVfR2AxxxaSPMcS0eUDefhYHm78ukZi8EQRiM/5Pnqv7tnsFg4+ua4c5Hw2Tck5htNAHEMMJ94PxvFSGhbZ8ujjSjiSPePfAVoJZo1617rL7cw54LeaOe6zU5fJiWEMVDeonCFK9yZ9tmqxpEnEf+wwK4bfTI8TycA9e5oNY0M= -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_ads1x15/*.py -- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/*.py) -- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-ads1x15 --library_location - . -- cd docs && sphinx-build -E -W -b html . _build/html && cd .. diff --git a/README.rst b/README.rst index df052c7..a76b635 100644 --- a/README.rst +++ b/README.rst @@ -9,8 +9,8 @@ Introduction :target: https://adafru.it/discord :alt: Discord -.. image:: https://travis-ci.com/adafruit/Adafruit_CircuitPython_ADS1x15.svg?branch=master - :target: https://travis-ci.com/adafruit/Adafruit_CircuitPython_ADS1x15 +.. image:: https://github.com/adafruit/Adafruit_CircuitPython_ADS1x15/workflows/Build%20CI/badge.svg + :target: https://github.com/adafruit/Adafruit_CircuitPython_ADS1x15/actions/ :alt: Build Status Support for the ADS1x15 series of analog-to-digital converters. Available in 12-bit (ADS1015) From a778646bd29d975e62c0819a760abadb39a44a9a Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 27 Dec 2019 22:23:11 -0500 Subject: [PATCH 2/2] Moved repository from Travis to GitHub Actions --- .github/workflows/build.yml | 13 ++++++++----- .github/workflows/release.yml | 19 +++++++++++++++---- 2 files changed, 23 insertions(+), 9 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 }}