From 93d8e098084c7d1d2d5cf011575d777cfd563375 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 17 Mar 2022 17:03:40 +0100 Subject: [PATCH] add github actions, fix readme for pypi --- .github/ISSUE_TEMPLATE/bug_report.md | 23 +++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 +++++++++++++ .github/ISSUE_TEMPLATE/help-wanted.md | 14 +++++++++ .github/workflows/ci.yml | 35 +++++++++++++++++++++++ .github/workflows/pypi-publish.yml | 31 ++++++++++++++++++++ .github/workflows/sphinx-build.yml | 26 +++++++++++++++++ .github/workflows/testing_pr.yml | 34 ++++++++++++++++++++++ pina/meta.py | 2 ++ setup.py | 7 +++-- 9 files changed, 189 insertions(+), 3 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/help-wanted.md create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/pypi-publish.yml create mode 100644 .github/workflows/sphinx-build.yml create mode 100644 .github/workflows/testing_pr.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..960e4ad --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,23 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +The piece of code that reproduce the bug. + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Output** +The obtained output. Please include the entire error trace. + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..11fc491 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: enhancement +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/help-wanted.md b/.github/ISSUE_TEMPLATE/help-wanted.md new file mode 100644 index 0000000..97d1c1e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/help-wanted.md @@ -0,0 +1,14 @@ +--- +name: Help wanted +about: Ask help for using the package +title: '' +labels: help wanted +assignees: '' + +--- + +**The objective** +A clear description of the purpose of your application. + +**Already tried tests** +The snippet of code you have already tried in order to obtain the wanted outcome. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f0b91d8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +name: "Coverage Deploy to Codacy" + +on: + push: + branches: + - master + +jobs: + test_deploy: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install Python dependencies + run: | + python3 -m pip install --upgrade pip + python3 -m pip install .[test] + + - name: Test with pytest + env: + CODACY_API_TOKEN: ${{ secrets.CODACY_API_TOKEN }} + shell: bash + run: | + python3 -m pytest --cov-report term --cov-report xml:cobertura.xml --cov=pina + curl -s https://coverage.codacy.com/get.sh -o CodacyCoverageReporter.sh + chmod +x CodacyCoverageReporter.sh + ./CodacyCoverageReporter.sh report -r cobertura.xml -t $CODACY_API_TOKEN + diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml new file mode 100644 index 0000000..9fb5c70 --- /dev/null +++ b/.github/workflows/pypi-publish.yml @@ -0,0 +1,31 @@ +name: "PYPI Publish" + +on: + push: + tags: + - "*" + +jobs: + docs: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + + - name: Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + + - name: Install build + run: >- + python -m pip install build --user + + - name: Build a binary wheel and a source tarball + run: >- + python -m build --sdist --wheel --outdir dist/ . + + - name: Publish distribution to PyPI + if: startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/sphinx-build.yml b/.github/workflows/sphinx-build.yml new file mode 100644 index 0000000..a3929d2 --- /dev/null +++ b/.github/workflows/sphinx-build.yml @@ -0,0 +1,26 @@ +name: "Documentation Deploy" + +on: + push: + tags: + - "*" + +jobs: + docs: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + + - name: Create the new documentation + uses: ammaraskar/sphinx-action@master + with: + pre-build-command: "python -m pip .[docs]" + docs-folder: "docs/" + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + #deploy_key: ${{ secrets.DEPLOY_PRIVATE_KEY }} + publish_dir: ./docs/build/html + allow_empty_commit: true diff --git a/.github/workflows/testing_pr.yml b/.github/workflows/testing_pr.yml new file mode 100644 index 0000000..8b7e185 --- /dev/null +++ b/.github/workflows/testing_pr.yml @@ -0,0 +1,34 @@ +name: "Testing Pull Request" + +on: + pull_request: + branches: + - "master" + + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [windows-latest, macos-latest, ubuntu-latest] + python-version: [3.7, 3.8] + + steps: + - uses: actions/checkout@v2 + + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Python dependencies + run: | + python3 -m pip install --upgrade pip + python3 -m pip install .[test] + + - name: Test with pytest + run: | + python3 -m pytest diff --git a/pina/meta.py b/pina/meta.py index 566279e..8962e24 100644 --- a/pina/meta.py +++ b/pina/meta.py @@ -18,3 +18,5 @@ __version__ = "0.0.1" __mail__ = 'demo.nicola@gmail.com, ' # TODO __maintainer__ = __author__ __status__ = "Alpha" +__packagename__ = "pina-mathlab" + diff --git a/setup.py b/setup.py index be05c8f..1620846 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,8 @@ with open("pina/meta.py") as fp: exec(fp.read(), meta) # Package meta-data. -NAME = meta['__title__'] +IMPORTNAME = meta['__title__'] +PIPNAME = meta['__packagename__'] DESCRIPTION = 'Physic Informed Neural networks for Advance modeling.' URL = 'https://github.com/mathLab/PINA' MAIL = meta['__mail__'] @@ -14,7 +15,7 @@ VERSION = meta['__version__'] KEYWORDS = 'physics-informed neural-network' REQUIRED = [ - 'future', 'numpy', 'matplotlib', 'torch' + 'future', 'numpy', 'matplotlib', 'torch' ] EXTRAS = { @@ -27,7 +28,7 @@ LDESCRIPTION = ( ) setup( - name=NAME, + name=PIPNAME, version=VERSION, description=DESCRIPTION, long_description=LDESCRIPTION,