Skip to content

Commit

Permalink
Merge pull request #46 from Matgenix/release_workflow
Browse files Browse the repository at this point in the history
Added GitHub release workflow and docs builds
  • Loading branch information
ml-evs authored Dec 22, 2023
2 parents 0886fbb + 263f9b5 commit 6e1d8e3
Show file tree
Hide file tree
Showing 20 changed files with 220 additions and 135 deletions.
130 changes: 130 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: Publish and Deploy

on:
release:
types:
- published

env:
PUBLISH_UPDATE_BRANCH: develop
GIT_USER_NAME: Matgenix
GIT_USER_EMAIL: "[email protected]"

jobs:

publish:
name: Publish package
runs-on: ubuntu-latest
if: github.repository == 'matgenix/jobflow-remote' && startsWith(github.ref, 'refs/tags/v')

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
ref: ${{ env.PUBLISH_UPDATE_BRANCH }}

- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install Python dependencies
run: |
python -m pip install -U pip
pip install -U setuptools wheel
pip install -e .[all]
- name: Set git config
run: |
git config --global user.name "${{ env.GIT_USER_NAME }}"
git config --global user.email "${{ env.GIT_USER_EMAIL }}"
- name: Update changelog
uses: CharMixer/auto-changelog-action@v1
with:
token: ${{ secrets.RELEASE_PAT_BOT }}
release_branch: ${{ env.PUBLISH_UPDATE_BRANCH }}
exclude_labels: "duplicate,question,invalid,wontfix,dependency_updates,skip_changelog"

- name: Update '${{ env.PUBLISH_UPDATE_BRANCH }}'
uses: CasperWA/push-protected@v2
with:
token: ${{ secrets.RELEASE_PAT_BOT }}
branch: ${{ env.PUBLISH_UPDATE_BRANCH }}
unprotect_reviews: true
sleep: 15
force: true
tags: true

- name: Install docs dependencies
run: |
# Required to generate rst files from markdown
sudo apt install pandoc
pip install .[docs]
- name: Build Sphinx docs
working-directory: doc
run: |
# cannot use sphinx build directly as the makefile handles generation
# of some rst files
make html
- name: Fix permissions # following https://github.com/actions/upload-pages-artifact?tab=readme-ov-file#file-permissions
run: |
chmod -c -R +rX "./doc/build" | while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- name: Upload docs artifact
uses: actions/upload-pages-artifact@v2
with:
path: ./doc/build/html

- name: Get tagged versions
run: echo "PREVIOUS_VERSION=$(git tag -l --sort -version:refname | sed -n 2p)" >> $GITHUB_ENV

- name: Create release-specific changelog
uses: CharMixer/auto-changelog-action@v1
with:
token: ${{ secrets.RELEASE_PAT_BOT }}
release_branch: ${{ env.PUBLISH_UPDATE_BRANCH }}
since_tag: "${{ env.PREVIOUS_VERSION }}"
output: "release_changelog.md"
exclude_labels: "duplicate,question,invalid,wontfix,dependency_updates,skip_changelog"

- name: Append changelog to release body
run: |
gh api /repos/${{ github.repository }}/releases/${{ github.event.release.id }} --jq '.body' > release_body.md
cat release_changelog.md >> release_body.md
gh api /repos/${{ github.repository }}/releases/${{ github.event.release.id }} -X PATCH -F body='@release_body.md'
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PAT_BOT }}

- name: Build source distribution
run: |
pip install -U build
python -m build
- name: Publish package to Test PyPI first
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_PASSWORD }}
repository-url: https://test.pypi.org/legacy/

deploy_docs:
if: github.repository == 'matgenix/jobflow-remote' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
needs: publish
environment:
name: "Documentation"
url: https://matgenix.github.io/Jobflow-Remote

steps:
- name: Deploy docs
uses: actions/deploy-pages@v2
31 changes: 31 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,34 @@ jobs:
- name: Test
run: pytest --cov=jobflow_remote --cov-report=xml

docs:
name: Build documentation
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0

- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install docs dependencies
run: |
python -m pip install -U pip
pip install -U setuptools wheel
# Required to generate rst files from markdown
sudo apt install pandoc
pip install .[docs]
- name: Build Sphinx docs
working-directory: doc
run: |
# cannot use sphinx build directly as the makefile handles generation
# of some rst files
make html
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ instance/
.scrapy

# Sphinx documentation
docs/_build/
doc/_build/
doc/source/api/*.rst

doc/source/dev/index.rst
doc/source/changelog.rst

# PyBuilder
.pybuilder/
Expand Down
32 changes: 2 additions & 30 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,2 @@
Change log
==========

v0.0.2 (add date)
------

Lots of improvements and bug fixes this release.

New features:

- New feature 1
- New feature 2
- ...

Enhancements:

- Enhancement 1
- Enhancement 2
- ...

Bug fixes:

- Bug fix 1
- Bug fix 2
- ...

v0.0.1 (add date)
------

Initial release.
Changelog
=========
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ transparent as possible, whether it's:
jobflow-remote is still in development, so at the moment we
do not have a dedicated help forum. For the time being, please
submit questions and bugs to the
[GitHub issues page](https://github.com/Matgenix/jobflow_remote/issues).
[GitHub issues page](https://github.com/Matgenix/jobflow-remote/issues).

If you are making a bug report, incorporate as many elements of the
following as possible to ensure a timely response and avoid the
Expand All @@ -36,7 +36,7 @@ further tracked.

We use github to host code, to track issues and feature requests,
as well as accept pull requests. We maintain a list of all
contributors [here](https://Matgenix.github.io/jobflow_remote/contributors.html).
contributors [here](https://Matgenix.github.io/jobflow-remote/contributors.html).

Pull requests are the best way to propose changes to the codebase.
Follow the [Github flow](https://www.atlassian.com/git/tutorials/comparing-workflows/forking-workflow)
Expand Down
7 changes: 5 additions & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Installation

Simple installation instructions can be found below.
For more advanced setup including configuring a database and runner, please see the [online documentation](https://matgenix.github.io/jobflow-remote/user/install.html)

Clone this repository and then install with `pip` in the virtual environment of your choice.

```
git clone git@{{ repository_provider }}:{{ repository_namespace }}/{{ package_name }}
cd {{package_name}}
git clone https://github.com/Matgenix/jobflow-remote
cd jobflow-remote
pip install .
```

Expand Down
35 changes: 10 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,22 @@
# jobflow-remote

[![tests](https://img.shields.io/github/actions/workflow/status/Matgenix/jobflow_remote/testing.yml?branch=main&label=tests)](https://github.com/Matgenix/jobflow_remote/actions?query=workflow%3Atesting)
[![code coverage](https://img.shields.io/codecov/c/gh/Matgenix/jobflow_remote)](https://codecov.io/gh/Matgenix/jobflow_remote)
[![pypi version](https://img.shields.io/pypi/v/jobflow_remote?color=blue)](https://pypi.org/project/jobflow_remote)
![supported python versions](https://img.shields.io/pypi/pyversions/jobflow_remote)
[![tests](https://img.shields.io/github/actions/workflow/status/Matgenix/jobflow-remote/testing.yml?branch=main&label=tests)](https://github.com/Matgenix/jobflow-remote/actions?query=workflow%3Atesting)
[![code coverage](https://img.shields.io/codecov/c/gh/Matgenix/jobflow-remote)](https://codecov.io/gh/Matgenix/jobflow-remote)
[![pypi version](https://img.shields.io/pypi/v/jobflow-remote?color=blue)](https://pypi.org/project/jobflow-remote)
![supported python versions](https://img.shields.io/pypi/pyversions/jobflow-remote)

**[Full Documentation][docs]**

jobflow-remote is a Python package to run jobflow workflows on remote resources.

## Quick start

How to get started.

## Installation

How to install.

## User guide

How to use the software.
Jobflow Remote is a Python package to run [jobflow](https://materialsproject.github.io/jobflow) workflows on remote resources.

## Need help?

Ask questions about jobflow-remote on the [jobflow-remote support forum][help-forum].
Ask questions about Jobflow Remote on the [Jobflow Remote support forum][help-forum].
If you've found an issue with jobflow-remote, please submit a bug report on [GitHub Issues][issues].

## Reference

Full reference

## What’s new?

Track changes to jobflow_remote through the [changelog][changelog].
Track changes to jobflow-remote through the [changelog][changelog].

## Contributing

Expand All @@ -43,8 +27,9 @@ We maintain a list of all contributors [here][contributors].
### Code of conduct

Help us keep jobflow-remote open and inclusive.
Please read and follow our [Code of Conduct][codeofconduct]
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md).
Please read and follow our [Code of Conduct][codeofconduct].

[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)

## License

Expand Down
17 changes: 15 additions & 2 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ FILES=
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -WT --keep-going -d build/doctrees $(PAPEROPT_$(PAPER)) \
ALLSPHINXOPTS = -T --keep-going -d build/doctrees $(PAPEROPT_$(PAPER)) \
$(SPHINXOPTS) source

.PHONY: help clean html version-check html-build
Expand Down Expand Up @@ -62,8 +62,21 @@ build/generate-stamp: $(wildcard source/reference/*.rst)
mkdir -p build
touch build/generate-stamp

generate-rst-from-md:
# generate contributing docs
mkdir -p source/dev
pandoc --from=markdown --to=rst --output=source/dev/_index.rst ../CONTRIBUTING.md
echo ".. _devindex:" > source/dev/index.rst
cat source/dev/_index.rst >> source/dev/index.rst
rm source/dev/_index.rst
# generate changelog
pandoc --from=markdown --to=rst --output=source/_changelog.rst ../CHANGELOG.md
echo ".. _changelog:" > source/changelog.rst
cat source/_changelog.rst >> source/changelog.rst
rm source/_changelog.rst

html: api-doc html-build
html-build: generate
html-build: generate generate-rst-from-md
mkdir -p build/html build/doctrees
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) build/html $(FILES)
@echo
Expand Down
2 changes: 0 additions & 2 deletions doc/source/api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@
API Reference
#############

This is the API reference

.. include:: jobflow_remote.rst
9 changes: 3 additions & 6 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

# -- Project information -----------------------------------------------------

project = "Jobflow-Remote"
project = "Jobflow Remote"
copyright = "2023, Matgenix SRL"
author = "Guido Petretto, David Waroquiers"
author = "Guido Petretto, Matthew Evans, David Waroquiers"


import jobflow_remote
Expand Down Expand Up @@ -54,9 +54,6 @@
"sphinx.ext.autosummary",
"sphinx.ext.graphviz",
"sphinx.ext.ifconfig",
"matplotlib.sphinxext.plot_directive",
"IPython.sphinxext.ipython_console_highlighting",
"IPython.sphinxext.ipython_directive",
"sphinx.ext.mathjax",
"sphinx_design",
"sphinx_copybutton",
Expand Down Expand Up @@ -113,7 +110,7 @@
"collapse_navigation": True,
"announcement": (
"<p>"
"Jobflow-Remote is still in beta phase. The API may change at any time."
"Jobflow Remote is still in beta phase. The API may change at any time."
"</p>"
),
# "announcement": "<p>This is still in development</p>",
Expand Down
7 changes: 0 additions & 7 deletions doc/source/dev/index.rst

This file was deleted.

Loading

0 comments on commit 6e1d8e3

Please sign in to comment.