From f2bbd6be98edcccf4a45e89e0b320044ea48adc8 Mon Sep 17 00:00:00 2001 From: Philip Loche Date: Thu, 29 Feb 2024 17:47:00 +0100 Subject: [PATCH] infrastructure updates * enable codecov * use github pages for docs * update gh actions --- .codecov.yml | 4 ++-- .github/workflows/build.yml | 6 ++--- .github/workflows/docs.yml | 46 ++++++++++++++++++------------------- .github/workflows/lint.yml | 6 ++--- .github/workflows/tests.yml | 28 +++++++++++----------- .readthedocs.yaml | 8 ++----- README.rst | 13 +++++------ pyproject.toml | 1 + tox.ini | 13 +++-------- 9 files changed, 57 insertions(+), 68 deletions(-) diff --git a/.codecov.yml b/.codecov.yml index 69a5923c..0702f102 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -4,9 +4,9 @@ coverage: status: project: default: - target: 90% + target: 80% patch: default: - target: 90% + target: 80% comment: off diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6b0963d5..608be0e8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,12 +10,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python if: ${{ false }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.12" - run: pip install tox - name: Test build integrity diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 6b091c37..3acce5f0 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -11,11 +11,11 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.12" - name: install dependencies run: | @@ -27,25 +27,25 @@ jobs: # Use the CPU only version of torch when building/running the code PIP_EXTRA_INDEX_URL: https://download.pytorch.org/whl/cpu - # - name: put documentation in the website - # run: | - # git clone https://github.com/$GITHUB_REPOSITORY --branch gh-pages gh-pages - # rm -rf gh-pages/.git - # cd gh-pages + - name: put documentation in the website + run: | + git clone https://oauth2:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY --branch gh-pages gh-pages + rm -rf gh-pages/.git + cd gh-pages - # REF_KIND=$(echo $GITHUB_REF | cut -d / -f2) - # if [[ "$REF_KIND" == "tags" ]]; then - # TAG=${GITHUB_REF#refs/tags/} - # mv ../docs/build/html $TAG - # else - # rm -rf latest - # mv ../docs/build/html latest - # fi + REF_KIND=$(echo $GITHUB_REF | cut -d / -f2) + if [[ "$REF_KIND" == "tags" ]]; then + TAG=${GITHUB_REF#refs/tags/} + mv ../docs/build/html $TAG + else + rm -rf latest + mv ../docs/build/html latest + fi - # - name: deploy to gh-pages - # if: github.event_name == 'push' - # uses: peaceiris/actions-gh-pages@v3 - # with: - # github_token: ${{ secrets.GITHUB_TOKEN }} - # publish_dir: ./gh-pages/ - # force_orphan: true + - name: deploy to gh-pages + if: github.event_name == 'push' + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./gh-pages/ + force_orphan: true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9db6584e..53a22c58 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -9,12 +9,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.12" - run: pip install tox - name: Lint the code diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e62e8bef..dfbfc2b2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,32 +15,32 @@ jobs: # - os: ubuntu-22.04 # python-version: "3.8" - os: ubuntu-22.04 - python-version: "3.11" + python-version: "3.12" # - os: macos-11 - # python-version: "3.8" - # - os: macos-11 - # python-version: "3.11" - # - os: windows-2019 - # python-version: "3.8" + # python-version: "3.12" # - os: windows-2019 - # python-version: "3.11" + # python-version: "3.12" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - run: pip install tox + - run: pip install tox coverage[toml] - name: run Python tests - run: tox -e tests + run: | + tox -e tests + coverage xml env: # Use the CPU only version of torch when building/running the code PIP_EXTRA_INDEX_URL: https://download.pytorch.org/whl/cpu - - name: Upload codecoverage - uses: codecov/codecov-action@v3 + - name: upload to codecov.io + uses: codecov/codecov-action@v4 with: - files: ./tests/coverage.xml + fail_ci_if_error: true + files: tests/coverage.xml + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.readthedocs.yaml b/.readthedocs.yaml index b58f9269..7d876318 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -8,11 +8,8 @@ version: 2 # Set the version of Python and other tools we need build: os: ubuntu-22.04 - apt_packages: - - cmake tools: - python: "3.10" - rust: "1.64" + python: "3.12" # Build documentation in the docs/ directory with Sphinx sphinx: @@ -28,5 +25,4 @@ python: - method: pip path: . extra_requirements: - # The documentation runs "examples" to produce outputs via sphinx-gallery. - - examples + - metatensor diff --git a/README.rst b/README.rst index df0f0ac8..ff1e1de1 100644 --- a/README.rst +++ b/README.rst @@ -7,7 +7,7 @@ Particle-mesh based calculation of Long Distance Equivariants. For details, tutorials, and examples, please have a look at our `documentation`_. -.. _`documentation`: https://meshlode.readthedocs.io +.. _`documentation`: https://lab-cosmo.github.io/MeshLODE/latest .. marker-installation @@ -53,15 +53,14 @@ Thanks goes to all people that make MeshLODE possible: .. image:: https://contrib.rocks/image?repo=lab-cosmo/MeshLODE :target: https://github.com/lab-cosmo/MeshLODE/graphs/contributors -.. |tests| image:: https://github.com/lab-cosmo/MeshLODE/workflows/Test/badge.svg +.. |tests| image:: https://github.com/lab-cosmo/MeshLODE/workflows/Tests/badge.svg :alt: Github Actions Tests Job Status - :target: (https://github.com/lab-cosmo/MeshLODE/\ - actions?query=workflow%3ATests) + :target: https://github.com/lab-cosmo/MeshLODE/actions?query=workflow%3ATests -.. |codecov| image:: https://codecov.io/gh/lab-cosmo/meshlode/branch/main/graph/badge.svg?token=UZJPJG34SM +.. |codecov| image:: https://codecov.io/gh/lab-cosmo/meshlode/branch/main/graph/badge.svg :alt: Code coverage :target: https://codecov.io/gh/lab-cosmo/meshlode/ .. |docs| image:: https://img.shields.io/badge/documentation-latest-sucess - :alt: Python - :target: https://meshlode.readthedocs.io + :alt: Documentation + :target: https://lab-cosmo.github.io/MeshLODE/latest/ diff --git a/pyproject.toml b/pyproject.toml index 04412af9..2b3cb229 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,6 +54,7 @@ repository = "https://github.com/lab-cosmo/MeshLODE" issues = "https://github.com/lab-cosmo/MeshLODE/issues" [tool.coverage.report] +show_missing = true include = [ "src/meshlode/*" ] diff --git a/tox.ini b/tox.ini index 2b4e0a8f..74b0dd4c 100644 --- a/tox.ini +++ b/tox.ini @@ -12,6 +12,7 @@ lint_folders = [testenv] passenv = * +test_options = --cov --cov-append --cov-report= --import-mode=append [testenv:build] description = Asserts package build integrity. @@ -40,15 +41,11 @@ extras = metatensor commands = # Run unit tests - pytest --cov --import-mode=append {posargs} + pytest {[testenv]test_options} {posargs} # Run documentation tests pytest --doctest-modules --pyargs meshlode {posargs} -# after executing the pytest assembles the coverage reports -commands_post = - coverage xml - [testenv:tests-min] description = Run the minimal core tests with pytest and {basepython}. usedevelop = true @@ -59,11 +56,7 @@ deps = commands = # Run unit tests - pytest --cov --import-mode=append {posargs} - -# after executing the pytest assembles the coverage reports -commands_post = - coverage xml + pytest {[testenv]test_options} {posargs} [testenv:lint] description = Run linters and type checks