diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index 57d8ba6..9700b9d 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -4,10 +4,13 @@ on: push: branches: - main - jobs: deploy: runs-on: ubuntu-22.04 + env: + # Directory that will be published on github pages + PUBLISH_DIR: ./docs/_build/html + steps: - uses: actions/checkout@v3 @@ -17,12 +20,22 @@ jobs: python-version: "3.10" - name: Install dependencies - run: python -m pip install ".[docs]" + run: python -m pip install ".[test,docs]" + - name: Build docs run: make doc + - name: Copy Dockerfile into gh-pages + run: cp Dockerfile ${PUBLISH_DIR} + + - name: Add coverage report to github pages + run: | + python -m pytest --cov=mypackage test + python -m coverage html + cp -r htmlcov ${PUBLISH_DIR} + - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./docs/_build/html \ No newline at end of file + publish_dir: ${PUBLISH_DIR} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index ef189c6..1dc708a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ RUN apt-get purge -y python3-setuptools # Install mypackage WORKDIR /tmp/ RUN git clone https://github.com/jorgensd/reproducibility && \ - pip3 install ./reproducibility[docs] + pip install ./reproducibility[docs] RUN rm -rf /tmp diff --git a/README.md b/README.md index b9a86a5..ccee369 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,26 @@ # Reproducible workflow for researchers -[![Jupyter Book Badge](https://jupyterbook.org/badge.svg)](https://jorgensd.github.io/reproducibility) -[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/) This repository is a template for how to set up a reproducible python environment with GitHub. +## Badges + +[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/jorgensd/reproducibility/gh-pages?labpath=_sources) + +To get the `Launch Binder` badge, go to: [https://mybinder.org/](https://mybinder.org/) and fill in (specifics for this repo in brackets): +- Your Github repository (https://github.com/jorgensd/reproducibility) +- Git ref (`gh-pages`, see: [How to create github pages](#ghpages)) +- Path to notebook file (`_sources`, as generated by `jupyter-book`, see [Jupyter-book](#jupyterbook)) + +Then press `Launch`, and then `Expand to see the text below, paste it into your README to show a binder badge` and copy the markdown code. If you render the README.md file as plaintext, you can see all the settings explicitly in the image link + +[![Jupyter Book Badge](https://jupyterbook.org/badge.svg)](https://jorgensd.github.io/reproducibility) + +Replace link in image (https://jorgensd.github.io/reproducibility) with your [Github pages url](#ghpages) + +![MIT License](https://img.shields.io/github/license/jorgensd/reproducibility) + +Replace `username/repo` in image link with appropriate user/respository. + ## Python-packaging To be able to create a python package, we need a folder with the name of the package (in this repository it is called `mypackage`, located under `src/mypackage`), and a `pyproject.toml` file. @@ -24,4 +41,13 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for ways to get started. A good idea is to look at the [issue tracker](https://github.com/jorgensd/reproducibility/issues) and see if you can resolve any open issues. A list of good first issues can be found [here](https://github.com/jorgensd/reproducibility/contribute) -If you find a bug in the source code, please [open an issue](https://github.com/jorgensd/reproducibility/issues/new/choose). +If you find a bug in the source code, please [open an issue](https://github.com/jorgensd/reproducibility/issues/new). + + +## Auto-publish to Github Pages + +Add text + +## Jupyter-book + +Add text