From a6b3accc63177a60cbc589ebdbb4b1c193c751ab Mon Sep 17 00:00:00 2001 From: Leah Wasser Date: Thu, 19 Nov 2020 17:54:48 -0700 Subject: [PATCH] build on mac, windows and push to pypi on release (#331) * build on mac * rename for easier fixes * add black * remove travis file * testing a deployment --- .github/workflows/mac-python-package.yml | 41 ++++++++++++++++++++ .github/workflows/publish-pypi.yml | 31 +++++++++++++++ .github/workflows/windows-python-package.yml | 5 +-- .travis.yml | 32 --------------- dev-requirements.txt | 1 + 5 files changed, 75 insertions(+), 35 deletions(-) create mode 100644 .github/workflows/mac-python-package.yml create mode 100644 .github/workflows/publish-pypi.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/mac-python-package.yml b/.github/workflows/mac-python-package.yml new file mode 100644 index 00000000..778d0149 --- /dev/null +++ b/.github/workflows/mac-python-package.yml @@ -0,0 +1,41 @@ +# 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: Mac Run Pytest & Build Docs + +on: + push: + branches: + - '*' + pull_request: + branches: + - '*' + +jobs: + build: + + runs-on: windows-latest + strategy: + matrix: + python-version: [3.6, 3.7, 3.8] + + 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 -r dev-requirements.txt + pip install -e . + - name: Test with pytest + run: | + pytest + - name: Build Docs + run: | + make -B docs + - name: Linting + run: | + black --check --verbose . diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml new file mode 100644 index 00000000..4e1ef42d --- /dev/null +++ b/.github/workflows/publish-pypi.yml @@ -0,0 +1,31 @@ +# This workflows will upload a Python Package using Twine when a release is created +# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries + +name: Upload Python Package + +on: + release: + types: [created] + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + 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 bdist_wheel + twine upload dist/* diff --git a/.github/workflows/windows-python-package.yml b/.github/workflows/windows-python-package.yml index 6b34c4f4..8af4bf30 100644 --- a/.github/workflows/windows-python-package.yml +++ b/.github/workflows/windows-python-package.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: Windows Run Pytest on: push: @@ -13,8 +13,7 @@ on: jobs: build: - - runs-on: windows-latest + runs-on: macos-latest strategy: matrix: python-version: [3.6, 3.7, 3.8] diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0f9092cc..00000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -language: python -matrix: - include: - - os: linux - dist: xenial - python: 3.6 - env: TOXENV=py36 - - os: linux - dist: xenial - python: 3.7 - env: TOXENV=py37 - - os: linux - dist: xenial - python: 3.8 - env: TOXENV=py38,black,docs - - os: osx - language: generic -install: -- chmod +x .travis/install.sh -- "./.travis/install.sh" -script: -- chmod +x .travis/test.sh -- "./.travis/test.sh" -deploy: - provider: pypi - user: earthlab - password: - secure: Gz4wpXdQ9g1av/2ApILFHlu4VZGvYnyMPevzUcCTCBpcxqFV/YDC/MpYlaHj29tPrVrmYe7hwzqJT06xcjcANm84d9/V38GFzIE32z5Vwac/DHzunQyhtl+Y8e8xNuuE/Qf9YhSjF0AXBAp9fbKX8f19XTlP2C6Wujo8hi+1g7kBGOhlbRvUMx1GMTy7D7cWZj02wS4QOY1d2280mgWyOCZzkFLu1IP4zkCTKQxxu2WCssrDztkTkQPC+9S6L0CSfda5X40wJOGgjJ4tnqRXUYk1C3z7T03x1AVrE8a4i7y3pqrx4XdwyN1no2YaabB0LgBZlWZsVJmDd0x8nSdZ3R/e+8dj9WwE1GmgMcPMgCVXeCdZThzZq7QuMwh1iUf9VWjNuiuhx358KaaLtZbivMvP7tcrKdrXpncXtvTvDyp/32jPAc/t/cY4yC/PALjiJabXXTtc5LMZSn5jcbY6z4j7srBhUa5W2hC7btnZTVATNp92yBY9erhCcL7JDKIZcnrHgjM/u+GLFHBW5fBuQvvmFiF+QM/reCwk/kGWha5GAuw16ohaQOpZGNWXKpGDO36oyojYyAMILLKem9WvKx2+Qxvt/gheECix85+LYkFe5hJX6/KPgSoLooEWVJI+kAbcypXif4ZzCctffISp/XFDcIyavffzHZpz7o8eqGw= - on: - tags: true - repo: earthlab/abc-classroom - python: 3.7 diff --git a/dev-requirements.txt b/dev-requirements.txt index 56ec3e98..4f0c8ee4 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -9,3 +9,4 @@ sphinx==3.2.1 sphinx-autobuild==2020.9.1 sphinx_copybutton==0.3.0 pydata_sphinx_theme==0.4.1 +black