diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..e8756b5 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,118 @@ +name: Continuous Integration + +env: + TERM: screen-256color + +on: + pull_request: + branches: ["master", "main"] + paths-ignore: ["docs/**"] + + push: + branches: ["master", "main"] + paths-ignore: ["docs/**"] + tags: + - "v*" + +jobs: + + # Runs all steps on the VM + test: + + runs-on: ubuntu-20.04 + + strategy: + matrix: + python-version: [3.6, 3.7, 3.8, 3.9] + + steps: + + - name: Checkout Code Repository + 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 tox tox-gh-actions + pip install codecov + + - name: "Run tox targets for Python ${{ matrix.python-version }}" + run: | + tox + + - name: Upload Coverage to Codecov + uses: "codecov/codecov-action@v2" + with: + fail_ci_if_error: true + + # Runs all steps on the VM + # Deploy to PyPI & create a GitHub Release when the test job succeeds, and only on pushes to tags. + deploy: + + needs: test + + if: needs.test.result == 'success' && startsWith( github.ref, 'refs/tags/v' ) + + runs-on: ubuntu-20.04 + + steps: + - name: Checkout Code Repository + uses: actions/checkout@v2 + + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install Dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements_dev.txt + + - name: Build Package + run: | + invoke dist + + - name: Publish 🐍 distribution 📦 to Test PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy/ + + - name: Publish 🐍 distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} + verbose: true + + - name: Get the version + id: get_version + run: | + echo "${{ github.ref }}" + echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + + - name: Generate Release Title + id: get_release_title + shell: bash + run: | + export TODAY="($(TZ=Africa/Lusaka date --iso))" + echo ::set-output name=RELEASE_NAME::"${{ steps.get_version.outputs.VERSION }} $TODAY" + + - name: Extract Release Notes + # This creates a file LATEST_RELEASE_NOTES.md in the parent directory (../) + run: | + invoke get-release-notes + + - name: GitHub Release + uses: softprops/action-gh-release@v1 + with: + name: ${{ steps.get_release_title.outputs.RELEASE_NAME }} + body_path: ../LATEST_RELEASE_NOTES.md + files: dist/* diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6bf39a4..0584b75 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,6 +15,7 @@ repos: - id: detect-private-key - id: end-of-file-fixer - id: mixed-line-ending + exclude: .git/COMMIT_EDITMSG - id: trailing-whitespace - repo: https://github.com/psf/black rev: 21.7b0 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index af60919..0000000 --- a/.travis.yml +++ /dev/null @@ -1,45 +0,0 @@ -language: python -os: linux -dist: focal -python: -- 3.9 -- 3.8 -- 3.7 -- 3.6 -install: -- pip install -U tox-travis -- pip install codecov -script: tox -after_success: -- codecov -before_deploy: -- pip install -r requirements_dev.txt -- invoke dist -- invoke get-release-notes -- export TODAY="($(TZ=Africa/Lusaka date --iso))" -- export RELEASE_NAME="$TRAVIS_TAG $TODAY" -deploy: - - provider: pypi - distributions: sdist bdist_wheel - user: __token__ - password: - secure: PIJ5cRV72oNmNWSMmGGW53f+MrYRLLbNKQldPlNRXihDJH8XyCiomX0R14NlHQrI8JyBZZv/VK1opyoUmW6cPJL5oyso3VXhYjuvUPjNhjgbNFv926EtJigjEIAbUZ74tJS6v+c+zIh54g28k2C2rRPXUSZl3rqC3CPU0PFZ1TmvqTweCu/Gq14ocSdEB1I5gMbA07KtSbhAS/Y4FM01vtEBht04zZupnIzLgThghuPWvAJCfIVOSlaQ8lny7ImWmUsLOdb5lG6amVZja6FITZmsXpDecc6Pk6lEyTAWs4PexbILq8UEKkLjs8GgggVEjyS4YtQlVT6n9nkihmhLDW8vjQ8jyaW+UA7JOKDubI5AuyLUrOS4yPkzAeJ8UAhH8wkfRA6WY6vhd6hxNaQIuz2J12nfpnACeBOCjwwGlwW78nB9fWZHUygfqs6Xyr40Inx0T87/UQqx+VipNuJ2wyOtjptYWUUHHRarlOHfz9scbBjbPqeX0xUH25ycVv3P4d1/lTdFRaKl2F4xwWcfkU2MR+59Uftupg2Zs/NsqL6se4uJpgNcnjVsCnTYfsceEaG+5cWnsxWZp6U6lnRkaSwc2MnoCJxPqL24Ga4LV14dNZYG7SOAvuml3d42dXPZxNSoeT7xnkaurlMLHzcJljUMjEV4cXq51Sr22XQk934= - on: - tags: true - repo: engineervix/readme-coverage-badger - python: 3.8 - skip_existing: true - skip-cleanup: true - - provider: releases - api_key: - secure: "OEeZ6z+zJnXFoOsOewFHSxwsaJnOcr6jafralypFfzSxP6akzhqgIjfYGzz/M8IUKVIzPfcYOYAG6b4vnN6R2afVOTSsViSTBSJOGXuGoJtFn4+V3cSMHc+6Zk1GM0T5n5q5ssasBiin8h8JVTypDrgy2QrWC8979QrwYAYLVtOkrT8NEajYsU2cWaqySQYgTtqq3SEZpEtY2B62kAzzO+u1CZ3ipXnDmCWyCc0wTm5514Zj+GuuA7W5Eo5SgzJEgaapq8xlKFHxRSyVkv00nIB6ZAu5uyl3Y3Cl9b42czha+qHgtpsNfcHUGdw5bsjfjAI6zOypsPo6TAx5mMmdW+pm4LL7ae9hvCyG1ZTEDgzMI9SubMsU+WYc50QhYqCi7yi37wvPGuj6cYDEf8nDEFiZhaumCK2BhHbLoOZXsD/lpl+N8wOcyf2HPyLP/yGlukDkI5HYPVWGlDZnoRO7Jok8c1Xn1kg+OlCYyNc+GGtyy8gt3qL8jPQN9crlCnIrEuW8Qdzj0FOIA4DgBob/nfZevxr5F8RnujH8V9QHkRrOFURcse6JTmzVLlELRYLxv6WsGvWICXNhgxw9zilf3pckSrf3Ru4GL2cEwI9Nf3SvoIq2R3i5LPbKdIfmQ+QJXRxVHbQQDUdCQYHiTEn8SN7P5N8F+otUn0p1sdpV/3Q=" - file_glob: true - file: dist/* - skip_cleanup: true - edge: true - name: $RELEASE_NAME - release_notes_file: "$HOME/LATEST_RELEASE_NOTES.md" - on: - tags: true - repo: engineervix/readme-coverage-badger - python: 3.8 diff --git a/README.md b/README.md index 42ab322..a1e53c6 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ PyPI - Python Version - - Build Status + + Build Status codecov diff --git a/setup.cfg b/setup.cfg index 203d7f3..cd690d9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -96,7 +96,7 @@ testpaths = tests envlist = lint, py36, py37, py38, py39 isolated_build = True -[travis] +[gh-actions] python = 3.9: py39 3.8: lint, py38 diff --git a/tasks.py b/tasks.py index 3d57c6a..f158d39 100644 --- a/tasks.py +++ b/tasks.py @@ -1,9 +1,10 @@ import os -from pathlib import Path from colorama import Fore, init from invoke import task +# from pathlib import Path + def execute_bump_hack(c): """A little hack that combines commitizen-tools and standard-version @@ -230,7 +231,8 @@ def get_release_notes(c): elif pattern_to_match in line and count == 1: break - home = str(Path.home()) - release_notes = os.path.join(home, "LATEST_RELEASE_NOTES.md") + # home = str(Path.home()) + # release_notes = os.path.join(home, "LATEST_RELEASE_NOTES.md") + release_notes = os.path.join("../", "LATEST_RELEASE_NOTES.md") with open(release_notes, "w") as f: print("".join(lines), file=f, end="")