From d21bb54929c9d3313111eaffc0a6e2a5cde9009d Mon Sep 17 00:00:00 2001 From: afernand Date: Tue, 28 May 2024 10:57:44 +0200 Subject: [PATCH 1/5] feat: Add changelog --- .github/workflows/label.yml | 97 ++++++++++++++++++++++++ CHANGELOG.md | 3 + doc/changelog.d/changelog_template.jinja | 15 ++++ pyproject.toml | 37 ++++++++- 4 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/label.yml create mode 100644 CHANGELOG.md create mode 100644 doc/changelog.d/changelog_template.jinja diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml new file mode 100644 index 00000000..3926690d --- /dev/null +++ b/.github/workflows/label.yml @@ -0,0 +1,97 @@ +name: Labeler + +on: + pull_request: + # 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: + - '../labels.yml' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + label-syncer: + name: Syncer + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: micnncim/action-label-syncer@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + labeler: + name: Set labels + needs: [label-syncer] + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + steps: + # Label based on modified files + - name: Label based on changed files + uses: actions/labeler@v5 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + sync-labels: true + + - uses: actions-ecosystem/action-add-labels@v1 + if: | + startsWith(github.event.pull_request.head.ref, 'doc') || + startsWith(github.event.pull_request.head.ref, 'docs') + with: + labels: documentation + - uses: actions-ecosystem/action-add-labels@v1 + if: | + startsWith(github.event.pull_request.head.ref, 'maint') || + startsWith(github.event.pull_request.head.ref, 'no-ci') || + startsWith(github.event.pull_request.head.ref, 'ci') + with: + labels: maintenance + + - uses: actions-ecosystem/action-add-labels@v1 + if: startsWith(github.event.pull_request.head.ref, 'feat') + with: + labels: enhancement + + - uses: actions-ecosystem/action-add-labels@v1 + if: | + startsWith(github.event.pull_request.head.ref, 'fix') || + startsWith(github.event.pull_request.head.ref, 'patch') + with: + labels: bug + + commenter: + runs-on: ubuntu-latest + steps: + - name: Suggest to add labels + uses: peter-evans/create-or-update-comment@v4 + # Execute only when no labels have been applied to the pull request + if: toJSON(github.event.pull_request.labels.*.name) == '{}' + with: + issue-number: ${{ github.event.pull_request.number }} + body: | + Please add one of the following labels to add this contribution to the Release Notes :point_down: + - [bug](https://github.com/ansys/ansys-tools-visualization-interface/pulls?q=label%3Abug+) + - [documentation](https://github.com/ansys/ansys-tools-visualization-interface/pulls?q=label%3Adocumentation+) + - [enhancement](https://github.com/ansys/ansys-tools-visualization-interface/pulls?q=label%3Aenhancement+) + - [good first issue](https://github.com/ansys/ansys-tools-visualization-interface/pulls?q=label%3Agood+first+issue) + - [maintenance](https://github.com/ansys/ansys-tools-visualization-interface/pulls?q=label%3Amaintenance+) + - [release](https://github.com/ansys/ansys-tools-visualization-interface/pulls?q=label%3Arelease+) + + 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 }} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..8040b0f4 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +This project uses [towncrier](https://towncrier.readthedocs.io/) and the changes for the upcoming release can be found in . + + \ No newline at end of file diff --git a/doc/changelog.d/changelog_template.jinja b/doc/changelog.d/changelog_template.jinja new file mode 100644 index 00000000..0cf429a3 --- /dev/null +++ b/doc/changelog.d/changelog_template.jinja @@ -0,0 +1,15 @@ +{% if sections[""] %} +{% for category, val in definitions.items() if category in sections[""] %} + +### {{ definitions[category]['name'] }} + +{% for text, values in sections[""][category].items() %} +- {{ text }} {{ values|join(', ') }} +{% endfor %} + +{% endfor %} +{% else %} +No significant changes. + + +{% endif %} diff --git a/pyproject.toml b/pyproject.toml index ffd57162..14a3cdca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi" [project] name = "ansys-tools-visualization-interface" -version = "0.2.dev0" +version = "0.2.0" description = "A Python visualization interface for PyAnsys libraries" readme = "README.rst" requires-python = ">=3.9,<4" @@ -91,3 +91,38 @@ known-first-party = ["ansys"] [tool.ruff.lint.pydocstyle] # Settings: https://docs.astral.sh/ruff/settings/#lintpydocstyle convention = "google" + +[tool.towncrier] +package = "ansys.tools.visualization_interface" +directory = "doc/changelog.d" +filename = "CHANGELOG.md" +start_string = "\n" +underlines = ["", "", ""] +template = "doc/changelog.d/changelog_template.jinja" +title_format = "## [{version}](https://github.com/ansys/{repo-name}/releases/tag/v{version}) - {project_date}" +issue_format = "[#{issue}](https://github.com/ansys/{repo-name}/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 \ No newline at end of file From 20db6407a1561394aade56b8af8255a7b4553126 Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot Date: Tue, 28 May 2024 09:36:23 +0000 Subject: [PATCH 2/5] Adding changelog entry: 58.added.md --- doc/changelog.d/58.added.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changelog.d/58.added.md diff --git a/doc/changelog.d/58.added.md b/doc/changelog.d/58.added.md new file mode 100644 index 00000000..9a015af8 --- /dev/null +++ b/doc/changelog.d/58.added.md @@ -0,0 +1 @@ +feat: Add changelog \ No newline at end of file From 1b550894b194ef537e80068910237ce33ba18488 Mon Sep 17 00:00:00 2001 From: afernand Date: Tue, 28 May 2024 13:07:01 +0200 Subject: [PATCH 3/5] feat: Add vulnerability checker --- .github/workflows/ci_cd.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 8af4f874..620dffd9 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -21,6 +21,40 @@ concurrency: cancel-in-progress: true 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 }} + + vulnerabilities: + name: Vulnerabilities + runs-on: ubuntu-latest + steps: + - name: PyAnsys Vulnerability check (on main) + if: github.ref == 'refs/heads/main' + uses: ansys/actions/check-vulnerabilities@v6 + with: + python-version: ${{ env.MAIN_PYTHON_VERSION }} + python-package-name: ${{ env.PACKAGE_NAME }} + token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} + + - name: PyAnsys Vulnerability check (on dev mode) + if: github.ref != 'refs/heads/main' + uses: ansys/actions/check-vulnerabilities@v6 + with: + python-version: ${{ env.MAIN_PYTHON_VERSION }} + python-package-name: ${{ env.PACKAGE_NAME }} + token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} + dev-mode: true + branch-name: if: github.event_name == 'pull_request' name: Check the name of the branch From f64ecf062473a207ad27a8cc0c3cdb5da4be7373 Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot Date: Tue, 28 May 2024 11:11:14 +0000 Subject: [PATCH 4/5] Adding changelog entry: 58.added.md --- doc/changelog.d/58.added.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changelog.d/58.added.md b/doc/changelog.d/58.added.md index 9a015af8..66e50ac8 100644 --- a/doc/changelog.d/58.added.md +++ b/doc/changelog.d/58.added.md @@ -1 +1 @@ -feat: Add changelog \ No newline at end of file +feat: add changelog and vulnerability check \ No newline at end of file From 2478200e003d4ce7567ff98d14162c8f78cad073 Mon Sep 17 00:00:00 2001 From: afernand Date: Tue, 28 May 2024 13:13:54 +0200 Subject: [PATCH 5/5] fix: Version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 14a3cdca..7318bd95 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi" [project] name = "ansys-tools-visualization-interface" -version = "0.2.0" +version = "0.3.dev0" description = "A Python visualization interface for PyAnsys libraries" readme = "README.rst" requires-python = ">=3.9,<4"