Skip to content

Commit

Permalink
feat: update gh actions workflows and add docs #11
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbuhr authored Sep 6, 2024
2 parents 3445ce0 + 043222f commit 6f125a1
Show file tree
Hide file tree
Showing 67 changed files with 14,159 additions and 135 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: docs

on:
workflow_call:
workflow_dispatch:
pull_request:
branches: [ main ]
types: [labeled]

permissions:
contents: write

jobs:
build-docs:
runs-on: ubuntu-latest
if: github.event.label.name == 'docthis'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- uses: quarto-dev/quarto-actions/setup@v2
with:
version: "1.5.53"
- name: Install dependencies
run: |
python -m pip install .[dev]
- name: Build docs
run: |
make docs
- name: Commit rendered docs
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore(docs): render docs"
commit_user_name: "github-actions[bot]"
commit_user_email: "github-actions[bot]@users.noreply.github.com"
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
file_pattern: "docs/ _inv/ _reference/ _freeze/"
push_options: "--force"

16 changes: 16 additions & 0 deletions .github/workflows/draft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Marks all newly opened pull requests as drafts
name: Draft on Open
on:
pull_request:
types: [ opened ]

jobs:
mark-as-draft:
name: Mark as draft
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Mark as draft
uses: voiceflow/draft-pr@latest
with:
token: ${{ secrets.GITHUB_TOKEN }}
12 changes: 0 additions & 12 deletions .github/workflows/lint.yml

This file was deleted.

51 changes: 51 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: publish

on:
workflow_call:
workflow_dispatch:


jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/kimmdy-reactions
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
87 changes: 10 additions & 77 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
name: release-please
on:
workflow_dispatch:
push:
branches: [ main ]

permissions:
contents: write
pull-requests: write

jobs:
release:
runs-on: ubuntu-latest
outputs:
created: ${{ steps.release.outputs.release_created }}
steps:
- uses: google-github-actions/release-please-action@v3
- uses: googleapis/release-please-action@v4
id: release
with:
release-type: python
package-name: kimmdy-reactions
changelog-notes-type: default
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: tag stable versions
if: ${{ steps.release.outputs.release_created }}
run: |
Expand All @@ -26,80 +29,10 @@ jobs:
git push origin :stable || true
git tag -a stable -m "Last Stable Release"
git push origin stable
build:
publish:
needs: release
if: ${{ needs.release.outputs.created }}
name: Build distribution 📦
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
# if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
if: ${{ needs.release.outputs.created }}
needs:
- build
- release
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/kimmdy-reactions
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

publish-to-testpypi:
name: Publish Python 🐍 distribution 📦 to TestPyPI
if: ${{ needs.release.outputs.created }}
needs:
- build
- release
runs-on: ubuntu-latest

environment:
name: testpypi
url: https://test.pypi.org/p/kimmdy-reactions

permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
id-token: write
uses: ./.github/workflows/publish.yml

3 changes: 1 addition & 2 deletions .github/workflows/test-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
jobs:
test-local:
runs-on: ubuntu-latest
container: riedmiki/gromacs-plumed-python:2021
container: riedmiki/gromacs-plumed-python:2023.5-plumed
steps:
- uses: actions/checkout@v3
- name: run tox
Expand All @@ -19,4 +19,3 @@ jobs:
name: coverage artifact
path: htmlcov.zip


25 changes: 0 additions & 25 deletions .github/workflows/test-release.yml

This file was deleted.

15 changes: 8 additions & 7 deletions .github/workflows/test-pr.yml → .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
name: test PR
name: tests
on:
workflow_call:
workflow_dispatch:
pull_request:
branches: [ main ]
types: [labeled]
types: [opened, synchronize, reopened, ready_for_review]

jobs:
test:
if: github.event.label.name == 'testthis' && !startsWith(github.head_ref, 'release-please-')
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
container: riedmiki/gromacs-plumed-python:2021
container: riedmiki/gromacs-plumed-python:2023.5-plumed
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: psf/black@stable
- name: run tox
run: tox
- name: zip coverage report
if: ${{ !cancelled() }}
run: zip -r htmlcov.zip htmlcov || true
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: coverage artifact
path: htmlcov.zip


29 changes: 29 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.PHONY: Makefile setup-docs preview docs clear-docs watch

preview:
quarto preview

watch:
python -m quartodoc build --watch

docs:
python -m quartodoc build
python -m quartodoc interlinks
quarto render

setup-docs: clear-docs
quarto add --no-prompt machow/quartodoc
python -m quartodoc build --verbose
python -m quartodoc interlinks
quarto render

clear-docs:
rm -rf docs
rm -rf .quarto
rm -rf _inv
rm -rf _reference
rm -f ./objects.json
rm -f _sidebar.yml

format:
black src tests
26 changes: 20 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
# Reaction template for KIMMDY
# A collection of simple reactions for KIMMDY

[![test latest release](https://github.com/graeter-group/kimmdy-reactions/actions/workflows/tests.yml/badge.svg?branch=release-please--branches--main)](https://github.com/graeter-group/kimmdy-reactions/actions/workflows/tests.yml/?branch=release-please--branches--main)

## Documentation

See [KIMMDY documentation](https://graeter-group.github.io/kimmdy/)
and [documentation for these reactions](https://graeter-group.github.io/kimmdy-reactions/).

## Installation
Should get installed together with kimmdy. If you want to install it separatly:

* Download
* `pip install -e ./` or for development: `pip install -r requirements.txt`
Together with KIMMDY

```bash
pip installl kimmdy[reactions]
```

To install it separatly:

```bash
pip install kimmdy-reactions
```

## Making your own

* Implement your reaction as a subclass of `kimmdy.reaction.Reaction`
* Register your Reaction class in the **[options.entry_points]** section in the setup.cfg. The name you give here must match the entry in the config.yml for Kimmdy!




3 changes: 3 additions & 0 deletions _extensions/machow/interlinks/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.html
*.pdf
*_files/
7 changes: 7 additions & 0 deletions _extensions/machow/interlinks/_extension.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
title: Interlinks
author: Michael Chow
version: 1.1.0
quarto-required: ">=1.2.0"
contributes:
filters:
- interlinks.lua
Loading

0 comments on commit 6f125a1

Please sign in to comment.