From a9a0bf3e7f71ca1b7073a709fa78077a0954ae0d Mon Sep 17 00:00:00 2001 From: Peter Kroon Date: Thu, 21 Oct 2021 16:34:14 +0200 Subject: [PATCH 1/3] Set up github actions CI --- .github/workflows/deploy.yaml | 73 ++++++++++++++++++++++++++++++++++ .github/workflows/test.yaml | 60 ++++++++++++++++++++++++++++ .travis.yml | 74 ----------------------------------- requirements-tests.txt | 4 ++ 4 files changed, 137 insertions(+), 74 deletions(-) create mode 100644 .github/workflows/deploy.yaml create mode 100644 .github/workflows/test.yaml delete mode 100644 .travis.yml create mode 100644 requirements-tests.txt diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 0000000..04c3559 --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,73 @@ +# This workflow will upload a Python Package using the PyPi action workflow + +name: Upload Python Package + +on: + release: + types: [published] + +env: + SKIP_GENERATE_AUTHORS: 1 + SKIP_WRITE_GIT_CHANGELOG: 1 + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + py_version: ["3.9"] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.py_version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.py_version }} + - name: Install dependencies + run: | + pip install --upgrade setuptools pip + - name: Install package and requirements + run: | + pip install --upgrade . + pip install -r requirements-tests.txt + - name: Run pytest with codecoverage + run: | + coverage run --source=hypothesis_networkx $(which pytest) --hypothesis-show-statistics + coverage report + codecov + + deploy: + needs: [build] + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@master + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: 3.9 + + - name: Install pypa/build + run: >- + python -m + pip install + build + --user + pip install pbr + + - name: Build a binary wheel and a source tarball + run: >- + python -m + build + --sdist + --wheel + --outdir dist/ + + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} + diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..d5a7e31 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,60 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: test package + +on: + push: + branches: [ master ] + pull_request: + +env: + SKIP_GENERATE_AUTHORS: 1 + SKIP_WRITE_GIT_CHANGELOG: 1 + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + py_version: ["3.6", "3.7", "3.8", "3.9", "3.10"] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.py_version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.py_version }} + - name: Install dependencies + run: | + pip install --upgrade setuptools pip + - name: Install package and requirements + run: | + pip install --upgrade . + pip install -r requirements-tests.txt + - name: Run pytest with codecoverage + run: | + coverage run --source=hypothesis_networkx $(which pytest) --hypothesis-show-statistics + coverage report + codecov + + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install dependencies + run: | + pip install --upgrade setuptools pip + pip install -r requirements-tests.txt + pip install --upgrade . + - name: Run pylint + run: | + pylint --disable=fixme --fail-under=8.0 hypothesis_networkx tests + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5bb9794..0000000 --- a/.travis.yml +++ /dev/null @@ -1,74 +0,0 @@ -language: python -dist: xenial -cache: pip - - -env: - global: - - SKIP_GENERATE_AUTHORS=1 - - SKIP_WRITE_GIT_CHANGELOG=1 - matrix: - - CODECOV=true -before_install: - - pip install --upgrade pip setuptools pbr -install: - - pip install --upgrade . -before_script: - - pip install --upgrade codecov pytest-cov pytest -script: - - pytest --cov=hypothesis_networkx --hypothesis-show-statistics -after_success: - - if [[ ${CODECOV} == true ]]; then codecov; fi - -branches: - only: - - master - - /^v\d+\.\d+(\.\d+)?(\.0(a|b|c)\d+)?(\.dev\d+)?$/ # Tags - -jobs: - fast_finish: true - allow_failures: - - python: "3.5-dev" - - python: "3.6-dev" - - python: "3.7-dev" - - python: "3.8-dev" - include: - - python: "3.5" - - python: "3.6" - - python: "3.7" - - python: "3.5-dev" - - python: "3.6-dev" - - python: "3.7-dev" - - python: "3.8-dev" - env: CODECOV=false - -# - stage: docs -# python: "3.5" -# addons: skip -# install: -# - pip install --upgrade -r requirements-docs.txt -# - pip install --upgrade .[full] -# # script: python setup.py build_sphinx -# script: mkdir -p doc/source/_static; sphinx-build -EnW -b html doc/source/ doc/build/html -# after_success: skip - -# - stage: pylint -# python: "3.5" -# addons: skip -# install: -# - pip install pylint -# script: -# - python run_pylint.py --disable=fixme --fail-under=8.5 vermouth -# - python run_pylint.py --disable=fixme --fail-under=9.5 bin/martinize2 -# after_success: skip - - stage: deploy - python: "3.8" - script: skip - deploy: - user: pckroon - password: - # travis encrypt --add deploy.password - secure: hZ3wetU8fU24cCZ9VMq+ZJ9yyGnS6EzrA6jZ3KoHUI+3Z2jj2V6IqZVdo9WFG9AbI23DC1bvVj4/8hAdRwzLclkeXo05gotysNM+WlzpJpBtoIMpXn3OKzIkU/LScKP/IDu0EvapzmSUM4Q5qonmw46ybhRNNFdzvDRO2v1FYSjMaAuLtNdwjkXiBnU524tB71lx8/rjK4HZamxXYtAQbISaxWOxnu8gDwFcB7Ed58P823FHlEOhDi8qmI65p70KqWbzmCKF7O2PEY7JnUgFhjRkTcHIMzwYA6iUlGYQMs8jQRtHOlZCIcZItt3koFssNQ9jPBA/RpMHREiNObxra2m/xjv2r/Pneb9Nk2RFX9pn3x3+kglUOIXltTDYEDRv98xnP8O39Y4F+/Bx4s2E8C5FhNbcD1DAHqFppIihzRd/d+csVuChRLMYLwTG3GvPlaK4lSb2LlkDlTBrB6FvOYmAiMg39oiuAnPP5JObV8MP/0mE5B8ex/D0lkv9xUgNZE11uSqmqLzpu2wDG8VPo+FCNX/1UlULBGePeZMsH6SpUuzHyDYhcIMtarXGwanNIecWHgKGVBPGry4Ef5KGhinxAYJqmDXOcec2e3uRrV3jR8LUKJuoEO9eUL0wljunvmlW7xrLb/EfIpI+/CF4Ets+t0gUvJ5jbZBZ+kXYl2Q= - provider: pypi - on: - tags: true diff --git a/requirements-tests.txt b/requirements-tests.txt new file mode 100644 index 0000000..7163a17 --- /dev/null +++ b/requirements-tests.txt @@ -0,0 +1,4 @@ +pytest +pylint +coverage +codecov From 51fb051d7bd5308ff17d2f723fd24d2ca6f5afe3 Mon Sep 17 00:00:00 2001 From: Peter Kroon Date: Thu, 21 Oct 2021 16:35:01 +0200 Subject: [PATCH 2/3] Add missing pytest import --- tests/test_graph_builder.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_graph_builder.py b/tests/test_graph_builder.py index 4730604..d1cf913 100644 --- a/tests/test_graph_builder.py +++ b/tests/test_graph_builder.py @@ -19,6 +19,7 @@ from hypothesis import given, settings, HealthCheck, note import networkx as nx +import pytest from hypothesis_networkx import graph_builder From 077c45b9ce06d24c42a7ef5435d4d509edfe44c7 Mon Sep 17 00:00:00 2001 From: Peter Kroon Date: Thu, 21 Oct 2021 16:40:50 +0200 Subject: [PATCH 3/3] Switch to test.pypi.org --- .github/workflows/deploy.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 04c3559..152a307 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -68,6 +68,7 @@ jobs: - name: Publish package to PyPI uses: pypa/gh-action-pypi-publish@master with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} + user: __token__ + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy