Skip to content

Commit

Permalink
infrastructure updates
Browse files Browse the repository at this point in the history
* enable codecov
* use github pages for docs
* update gh actions
  • Loading branch information
PicoCentauri committed Mar 1, 2024
1 parent 0def465 commit f2bbd6b
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 68 deletions.
4 changes: 2 additions & 2 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ coverage:
status:
project:
default:
target: 90%
target: 80%
patch:
default:
target: 90%
target: 80%

comment: off
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
46 changes: 23 additions & 23 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
8 changes: 2 additions & 6 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -28,5 +25,4 @@ python:
- method: pip
path: .
extra_requirements:
# The documentation runs "examples" to produce outputs via sphinx-gallery.
- examples
- metatensor
13 changes: 6 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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/
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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/*"
]
Expand Down
13 changes: 3 additions & 10 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit f2bbd6b

Please sign in to comment.