diff --git a/.github/workflows/publish-to-pypi-testpypi.yml b/.github/workflows/publish-to-pypi-testpypi.yml new file mode 100644 index 0000000000..4834d5540c --- /dev/null +++ b/.github/workflows/publish-to-pypi-testpypi.yml @@ -0,0 +1,41 @@ +name: Publish distributions to PyPI (releases only) and TestPyPI (all commits) + +on: push + +jobs: + build-n-publish: + name: Build and publish distributions to PyPI (releases only) and TestPyPI (all commits) + if: github.repository == 'pvlib/pvlib-python' + runs-on: ubuntu-latest + steps: + # fetch all commits and tags so versioneer works + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install build tools + run: | + python -m pip install --upgrade pip + python -m pip install --upgrade setuptools wheel + + - name: Build packages + run: python setup.py sdist bdist_wheel + + - name: Publish distribution to Test PyPI + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.test_pypi_password }} + repository_url: https://test.pypi.org/legacy/ + + - name: Publish distribution to PyPI + if: startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.pypi_password }} \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 885852d2ac..9194bfd40f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,8 @@ matrix: env: - CONDA_ENV=py36 - TASK="coverage" - - DEPLOY_ENV="true" + # not needed as of GH1038. deploy block cannot run without this. + # - DEPLOY_ENV="true" - python: 3.6 env: CONDA_ENV=py37 diff --git a/docs/sphinx/source/whatsnew/v0.8.0.rst b/docs/sphinx/source/whatsnew/v0.8.0.rst index 6039c5bc2b..75e223b045 100644 --- a/docs/sphinx/source/whatsnew/v0.8.0.rst +++ b/docs/sphinx/source/whatsnew/v0.8.0.rst @@ -112,6 +112,9 @@ Testing * Add wrappers around the pandas assert_X_equal functions to accommodate the changed API and default precision thresholds in pandas 1.1.0 (:issue:`1018`, :pull:`1021`) +* Add github action for publishing all commits to + `test.pypi.org `_ and tags to + `pypi.org `_. Documentation ~~~~~~~~~~~~~ diff --git a/setup.cfg b/setup.cfg index bc56ff3090..6e46fdc01e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,4 +17,7 @@ test=pytest [flake8] max-line-length = 79 ignore = E201, E241, E226, W503, W504 -exclude = pvlib/_version.py docs dist \ No newline at end of file +exclude = pvlib/_version.py docs dist + +[tool:pytest] +junit_family=xunit2 \ No newline at end of file