Skip to content

Commit

Permalink
feat: implementing ansys/actions/changelogs and adding release note…
Browse files Browse the repository at this point in the history
… in documentation (#3019)

* maint: update `labeler.yml`

* feat: implementing `ansys/actions/changelogs`

* Adding changelog entry: 3019.miscellaneous.md

* maint: adding `doc-deploy-changelog` action and removing `release.yml` as unused

* maint: adding `update-changelog` as a CICD dependency

* fix: `changelog.rst` file

* revert: readding `release.yml` file

* maint: update `labeler.yml`

* feat: implementing `ansys/actions/changelogs`

* Adding changelog entry: 3019.miscellaneous.md

* maint: adding `doc-deploy-changelog` action and removing `release.yml` as unused

* maint: adding `update-changelog` as a CICD dependency

* fix: `changelog.rst` file

* revert: readding `release.yml` file

* Update CHANGELOG.md

Co-authored-by: Kathy Pippert <84872299+PipKat@users.noreply.github.com>

* maint: adding `branch-name-style` and `commit-style`

* Adding pull request template

* Update pyproject.toml

Co-authored-by: German <28149841+germa89@users.noreply.github.com>

* doc: adding branch and commit naming convention references

* doc: adding the mention of the *PyAnsys Developer's Guide* before redirecting to the links

* Apply suggestions from code review

Co-authored-by: German <28149841+germa89@users.noreply.github.com>

* doc: removing unused practice

* maint: removing `Testing` label in `labeler.yml`

* doc: redirecting to PyAnsys dev guide

* Update .github/pull_request_template.md

Co-authored-by: German <28149841+germa89@users.noreply.github.com>

* fix: updating `dependabot.yml` file

---------

Co-authored-by: pyansys-ci-bot <pyansys.github.bot@ansys.com>
Co-authored-by: Kathy Pippert <84872299+PipKat@users.noreply.github.com>
Co-authored-by: German <germanmartinezayuso@gmail.com>
Co-authored-by: German <28149841+germa89@users.noreply.github.com>
  • Loading branch information
5 people authored Jun 18, 2024
1 parent bee6643 commit 4953669
Show file tree
Hide file tree
Showing 13 changed files with 163 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ updates:
assignees:
- "ansys/pymapdl-maintainers"
commit-message:
prefix: "MAINT"
prefix: "ci"
groups:
actions:
patterns:
Expand All @@ -29,7 +29,7 @@ updates:
assignees:
- "ansys/pymapdl-maintainers"
commit-message:
prefix: "MAINT"
prefix: "build"
groups:
minimal:
patterns:
Expand Down
17 changes: 17 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## Description
**Please provide a brief description of the changes made in this pull request.**

## Issue linked
**Please mention the issue number or describe the problem this pull request addresses.**

## Checklist
- [ ] I have visited and read [Develop PyMAPDL](https://mapdl.docs.pyansys.com/version/stable/getting_started/develop_pymapdl.html#develop-pymapdl).
- [ ] I have [tested my changes locally](https://mapdl.docs.pyansys.com/version/stable/getting_started/develop_pymapdl.html#unit-testing)
- [ ] I have added necessary [documentation or updated existing documentation](https://mapdl.docs.pyansys.com/version/stable/getting_started/write_documentation.html#id2).
- [ ] I have followed the [PyMAPDL coding style guidelines](https://mapdl.docs.pyansys.com/version/stable/getting_started/develop_pymapdl.html#code-style).
- [ ] I have added appropriate [unit tests](https://mapdl.docs.pyansys.com/version/stable/getting_started/develop_pymapdl.html#unit-testing) that also ensure the [minimal coverage criteria](https://mapdl.docs.pyansys.com/version/stable/getting_started/develop_pymapdl.html#code-coverage).
- [ ] I have reviewed my changes before submitting this pull request.
- [ ] I have [linked the issue or issues](https://dev.docs.pyansys.com/content-writing/content-how-tos/create-PR.html#id2) that are solved to the PR if any.
- [ ] I have [assigned this PR to myself](https://dev.docs.pyansys.com/content-writing/content-how-tos/create-PR.html#id2).
- [ ] I have marked this PR as ``draft`` if it is not ready to be reviewed yet.
- [ ] I have made sure that the title of my PR follows [Commit naming conventions](https://dev.docs.pyansys.com/how-to/contributing.html#commit-naming-conventions) (e.g. ``feat: adding new MAPDL command``)
38 changes: 37 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,41 @@ permissions:

jobs:


update-changelog:
name: "Update CHANGELOG (on release)"
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: ansys/actions/doc-deploy-changelog@v6
with:
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}


branch-name:
# Only if the event is a pull request and the branch name is not from the pre-commit-ci bot
if: github.event_name == 'pull_request' && github.head_ref != 'pre-commit-ci-update-config'
name: Check the name of the branch
runs-on: ubuntu-latest
steps:
- name: Check branch name
uses: ansys/actions/branch-name-style@v6


commit-name:
if: github.event_name == 'pull_request'
name: Check the name of the commit
runs-on: ubuntu-latest
steps:
- name: Check commit name
uses: ansys/actions/commit-style@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}


doc-style:
name: "Documentation style check"
runs-on: ubuntu-latest
Expand All @@ -69,6 +104,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
vale-version: "3.4.1"


smoke-tests:
name: Build and smoke test (${{ matrix.os }} | Python ${{ matrix.python-version }}) (Release=${{ matrix.should-release }})
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -816,7 +852,7 @@ jobs:
release:
name: "Release"
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: [smoke-tests, docs-build, build-test, build-test-ubuntu, build-test-ubuntu-minimal]
needs: [smoke-tests, docs-build, build-test, build-test-ubuntu, build-test-ubuntu-minimal, update-changelog]
runs-on: ubuntu-latest
steps:
- name: Set up Python
Expand Down
17 changes: 16 additions & 1 deletion .github/workflows/label.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
name: "Pull Request Labeler"
on:
pull_request:
types: [opened, reopened]
# opened, reopened, and synchronize are default for pull_request
# edited - when PR title or body is changed
# labeled - when labels are added to PR
types: [opened, reopened, synchronize, edited, labeled]
push:
branches: [ main ]
paths:
Expand Down Expand Up @@ -101,3 +104,15 @@ jobs:
- [Examples](https://github.com/ansys/pymapdl/pulls?q=label%3Aexamples+)
- [Maintenance](https://github.com/ansys/pymapdl/pulls?q=label%3Amaintenance+)
- [CI/CD](https://github.com/ansys/pymapdl/pulls?q=label%3Aci%2Fcd+)
changelog-fragment:
name: "Create changelog fragment"
needs: [labeler]
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: ansys/actions/doc-changelog@v6
with:
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# CHANGELOG

This project uses [towncrier](https://towncrier.readthedocs.io/) to generate changelogs.

For more information, see the [raw release notes](doc/source/changelog.rst).

[Published release notes](https://mapdl.docs.pyansys.com/version/stable/changelog.html) can be found in the online documentation.
1 change: 1 addition & 0 deletions doc/changelog.d/3019.miscellaneous.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
feat: implementing `ansys/actions/changelogs` and adding release note in documentation
17 changes: 17 additions & 0 deletions doc/changelog.d/changelog_template.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% if sections[""] %}
{% for category, val in definitions.items() if category in sections[""] %}

{{ definitions[category]['name'] }}
{% set underline = '^' * definitions[category]['name']|length %}
{{ underline }}

{% for text, values in sections[""][category].items() %}
- {{ text }} {{ values|join(', ') }}
{% endfor %}

{% endfor %}
{% else %}
No significant changes.


{% endif %}
13 changes: 13 additions & 0 deletions doc/source/changelog.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.. _ref_release_notes:

Release notes
#############

This document contains the release notes for the project.

.. vale off
.. towncrier release notes start
.. vale on
12 changes: 10 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
# The short X.Y version
release = version = __version__
cname = os.getenv("DOCUMENTATION_CNAME", "mapdl.docs.pyansys.com")
switcher_version = get_version_match(__version__)

REPOSITORY_NAME = "pymapdl"
USERNAME = "ansys"
Expand Down Expand Up @@ -229,6 +230,13 @@
"pyvista.Plotter.show",
]

# If we are on a release, we have to ignore the "release" URLs, since it is not
# available until the release is published.
if switcher_version != "dev":
linkcheck_ignore.append(
f"https://github.com/ansys/pymapdl/releases/tag/v{__version__}"
)

user_agent = """curl https://www.ansys.com -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.3"""

# The name of the Pygments (syntax highlighting) style to use.
Expand Down Expand Up @@ -299,12 +307,12 @@
],
"switcher": {
"json_url": f"https://{cname}/versions.json",
"version_match": get_version_match(__version__),
"version_match": switcher_version,
},
"use_meilisearch": {
"api_key": os.getenv("MEILISEARCH_PUBLIC_API_KEY", ""),
"index_uids": {
f"pymapdl-v{get_version_match(__version__).replace('.', '-')}": "PyMAPDL",
f"pymapdl-v{switcher_version.replace('.', '-')}": "PyMAPDL",
},
},
}
Expand Down
7 changes: 6 additions & 1 deletion doc/source/getting_started/contribution.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ Overall guidance on contributing to a PyAnsys library appears in the
in the *PyAnsys Developer's Guide*. Ensure that you are thoroughly familiar
with it and the `Coding style <dev_guide_coding_style_>`_ before attempting to
contribute to PyMAPDL.


In order to have a nice :ref:`ref_release_notes` section, it is important to follow
the branch and commit names conventions as described in the *PyAnsys Developer's Guide*
`branch <dev_guide_branch_names_>`_ and `commit <dev_guide_commit_names_>`_ naming
sections.


Answer discussions
==================
Expand Down
1 change: 1 addition & 0 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
mapdl_commands/index
api/index
examples/index
changelog


.. image:: ../source/_static/logo_dark.png
Expand Down
2 changes: 2 additions & 0 deletions doc/source/links.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
.. _dev_guide_contributing: https://dev.docs.pyansys.com/how-to/contributing.html
.. _dev_guide_coding_style: https://dev.docs.pyansys.com/coding-style/index.html
.. _dev_guide_setup_your_environment: https://dev.docs.pyansys.com/how-to/setting-up.html
.. _dev_guide_branch_names: https://dev.docs.pyansys.com/how-to/contributing.html#branch-naming-conventions
.. _dev_guide_commit_names: https://dev.docs.pyansys.com/how-to/contributing.html#commit-naming-conventions

.. #Other libraries
.. _pyvista_docs: https://docs.pyvista.org/version/stable/
Expand Down
34 changes: 34 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,37 @@ override_SS05 = [ # override SS05 to allow docstrings starting with these words
# '^Assess ',
# '^Access ',
]

[tool.towncrier]
package = "ansys.mapdl.core"
directory = "doc/changelog.d"
filename = "doc/source/changelog.rst"
template = "doc/changelog.d/changelog_template.jinja"
start_string = ".. towncrier release notes start\n"
title_format = "`{version} <https://github.com/ansys/pymapdl/releases/tag/v{version}>`_ - {project_date}"
issue_format = "`#{issue} <https://github.com/ansys/pymapdl/pull/{issue}>`_"

[[tool.towncrier.type]]
directory = "added"
name = "Added"
showcontent = true

[[tool.towncrier.type]]
directory = "changed"
name = "Changed"
showcontent = true

[[tool.towncrier.type]]
directory = "fixed"
name = "Fixed"
showcontent = true

[[tool.towncrier.type]]
directory = "dependencies"
name = "Dependencies"
showcontent = true

[[tool.towncrier.type]]
directory = "miscellaneous"
name = "Miscellaneous"
showcontent = true

0 comments on commit 4953669

Please sign in to comment.