Skip to content

Commit 9b95a75

Browse files
ci: Finish cicd (#34)
* maint: Complete CICD * maint: Add doc style action * fix: Doc style fixes * fix: PyMAPDL container name * fix: Ignore rst code blocks * fix: Vale ini * fix: Accept words * fix: Add changelog missing line, add private PyPI * fix: CICD file * fix: Missing changelog config * chore: adding changelog file 34.maintenance.md [dependabot-skip] * fix: Temporary allow vulnerability logs * fix: Remove changelog * fix: Upload reports * fix: remove vulnerabilites publication * fix: Vulnerability * fix: Tests * fix: Comment out vuln action until release * fix: Add TODOs for release --------- Co-authored-by: pyansys-ci-bot <[email protected]>
1 parent e42e069 commit 9b95a75

File tree

13 files changed

+254
-34
lines changed

13 files changed

+254
-34
lines changed

.github/workflows/cicd.yml

Lines changed: 86 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,36 @@ on:
1212
env:
1313
PACKAGE_NAME: ansys-tools-common
1414
MAIN_PYTHON_VERSION: 3.13
15-
DOCUMENTATION_CNAME: bookish-adventure-16g5prl.pages.github.io
15+
DOCUMENTATION_CNAME: tools.docs.pyansys.com
1616

1717
jobs:
18+
19+
update-changelog:
20+
name: "Update CHANGELOG (on release)"
21+
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
22+
runs-on: ubuntu-latest
23+
permissions:
24+
contents: write
25+
pull-requests: write
26+
steps:
27+
- uses: ansys/actions/doc-deploy-changelog@v10
28+
with:
29+
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
30+
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
31+
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
32+
33+
# TODO uncomment after the first public release
34+
# check-vulnerabilities:
35+
# name: "Check library vulnerabilities"
36+
# runs-on: ubuntu-latest
37+
# steps:
38+
# - uses: ansys/actions/[email protected]
39+
# with:
40+
# python-version: ${{ env.MAIN_PYTHON_VERSION }}
41+
# token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
42+
# python-package-name: ${{ env.PACKAGE_NAME }}
43+
# dev-mode: ${{ github.ref != 'refs/heads/main' }}
44+
1845
style:
1946
name: Code style
2047
runs-on: ubuntu-latest
@@ -40,8 +67,8 @@ jobs:
4067
python-version: ${{ matrix.python-version }}
4168
whitelist-license-check: "termcolor" # Has MIT license, but it's not recognized
4269

43-
build-tests:
44-
name: Build and Testing
70+
tests:
71+
name: Testing
4572
runs-on: ubuntu-latest
4673
needs: [smoke-tests]
4774
env:
@@ -75,8 +102,18 @@ jobs:
75102
# with:
76103
# token: ${{ secrets.CODECOV_TOKEN }}
77104

105+
docs-style:
106+
name: Documentation Style Check
107+
runs-on: ubuntu-latest
108+
steps:
109+
- name: PyAnsys documentation style checks
110+
uses: ansys/actions/doc-style@v10
111+
with:
112+
token: ${{ secrets.GITHUB_TOKEN }}
113+
78114
doc-build:
79115
name: Build documentation
116+
needs: [docs-style]
80117
runs-on: ubuntu-latest
81118
steps:
82119
- name: Build documentation
@@ -88,24 +125,62 @@ jobs:
88125
package:
89126
name: Package library
90127
runs-on: ubuntu-latest
91-
needs: [smoke-tests]
128+
needs: [tests, doc-build]
92129
steps:
93130
- name: Build library source and wheel artifacts
94131
uses: ansys/actions/build-library@v10
95132
with:
96133
library-name: ${{ env.PACKAGE_NAME }}
97134
python-version: ${{ env.MAIN_PYTHON_VERSION }}
98135

99-
upload_dev_docs:
100-
name: Upload dev documentation
101-
if: github.ref == 'refs/heads/main'
136+
release:
137+
name: Release project
138+
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }}
139+
needs: [package]
102140
runs-on: ubuntu-latest
103-
needs: [doc-build]
141+
environment: release
142+
permissions:
143+
id-token: write
144+
contents: write
104145
steps:
105-
- name: Deploy the latest documentation
106-
uses: ansys/actions/doc-deploy-dev@v10
146+
- name: "Download the library artifacts from build-library step"
147+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
148+
with:
149+
name: ${{ env.PACKAGE_NAME }}-artifacts
150+
path: ${{ env.PACKAGE_NAME }}-artifacts
151+
152+
# TODO uncomment after the first public release
153+
# - name: "Upload artifacts to PyPI using trusted publisher"
154+
# uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
155+
# with:
156+
# repository-url: "https://upload.pypi.org/legacy/"
157+
# print-hash: true
158+
# packages-dir: ${{ env.PACKAGE_NAME }}-artifacts
159+
# skip-existing: false
160+
161+
- name: "Release to the private PyPI repository"
162+
uses: ansys/actions/release-pypi-private@v9
163+
with:
164+
library-name: "ansys-api-meshing-maestro"
165+
twine-username: "__token__"
166+
twine-token: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}
167+
168+
- name: Release to GitHub
169+
uses: ansys/actions/release-github@v10
170+
with:
171+
token: ${{ secrets.GITHUB_TOKEN }}
172+
library-name: ${{ env.PACKAGE_NAME }}
173+
174+
upload_docs_release:
175+
name: Upload release documentation
176+
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
177+
runs-on: ubuntu-latest
178+
needs: [release]
179+
steps:
180+
- name: Deploy the stable documentation
181+
uses: ansys/actions/doc-deploy-stable@v10
107182
with:
108183
cname: ${{ env.DOCUMENTATION_CNAME }}
109184
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
110185
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
111-
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
186+
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}

.github/workflows/label.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Labeler
2+
on:
3+
pull_request:
4+
# opened, reopened, and synchronize are default for pull_request
5+
# edited - when PR title or body is changed
6+
# labeled - when labels are added to PR
7+
types: [opened, reopened, synchronize, edited, labeled]
8+
push:
9+
branches: [ main ]
10+
paths:
11+
- '../labels.yml'
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
19+
label-syncer:
20+
name: Syncer
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: write
24+
pull-requests: write
25+
steps:
26+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
27+
- uses: micnncim/action-label-syncer@3abd5ab72fda571e69fffd97bd4e0033dd5f495c # v1.3.0
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
31+
labeler:
32+
name: Set labels
33+
needs: [label-syncer]
34+
permissions:
35+
contents: read
36+
pull-requests: write
37+
runs-on: ubuntu-latest
38+
steps:
39+
40+
# Label based on modified files
41+
- name: Label based on changed files
42+
uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0
43+
with:
44+
repo-token: ${{ secrets.GITHUB_TOKEN }}
45+
sync-labels: true
46+
47+
# Label based on branch name
48+
- uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf # v1.1.3
49+
if: |
50+
startsWith(github.event.pull_request.head.ref, 'doc') ||
51+
startsWith(github.event.pull_request.head.ref, 'docs')
52+
with:
53+
labels: documentation
54+
github_token: ${{ secrets.GITHUB_TOKEN }}
55+
56+
- uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf # v1.1.3
57+
if: |
58+
startsWith(github.event.pull_request.head.ref, 'maint') ||
59+
startsWith(github.event.pull_request.head.ref, 'no-ci') ||
60+
startsWith(github.event.pull_request.head.ref, 'ci')
61+
with:
62+
labels: maintenance
63+
github_token: ${{ secrets.GITHUB_TOKEN }}
64+
65+
- uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf # v1.1.3
66+
if: startsWith(github.event.pull_request.head.ref, 'feat')
67+
with:
68+
github_token: ${{ secrets.GITHUB_TOKEN }}
69+
labels: |
70+
enhancement
71+
72+
- uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf # v1.1.3
73+
if: |
74+
startsWith(github.event.pull_request.head.ref, 'fix') ||
75+
startsWith(github.event.pull_request.head.ref, 'patch')
76+
with:
77+
github_token: ${{ secrets.GITHUB_TOKEN }}
78+
labels: bug
79+
80+
commenter:
81+
runs-on: ubuntu-latest
82+
permissions:
83+
contents: read
84+
pull-requests: write
85+
steps:
86+
- name: Suggest to add labels
87+
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
88+
# Execute only when no labels have been applied to the pull request
89+
if: toJSON(github.event.pull_request.labels.*.name) == '{}'
90+
with:
91+
issue-number: ${{ github.event.pull_request.number }}
92+
body: |
93+
Please add one of the following labels to add this contribution to the Release Notes :point_down:
94+
- [bug](https://github.com/ansys-internal/ansys-tools-common/pulls?q=label%3Abug+)
95+
- [documentation](https://github.com/ansys-internal/ansys-tools-common/pulls?q=label%3Adocumentation+)
96+
- [enhancement](https://github.com/ansys-internal/ansys-tools-common/pulls?q=label%3Aenhancement+)
97+
- [good first issue](https://github.com/ansys-internal/ansys-tools-common/pulls?q=label%3Agood+first+issue)
98+
- [maintenance](https://github.com/ansys-internal/ansys-tools-common/pulls?q=label%3Amaintenance+)
99+
- [release](https://github.com/ansys-internal/ansys-tools-common/pulls?q=label%3Arelease+)
100+
101+
changelog-fragment:
102+
name: "Create changelog fragment"
103+
needs: [labeler]
104+
permissions:
105+
contents: write
106+
pull-requests: write
107+
runs-on: ubuntu-latest
108+
steps:
109+
- uses: ansys/actions/doc-changelog@v10
110+
with:
111+
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
112+
use-conventional-commits: true
113+
use-default-towncrier-config: true
114+
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
115+
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}

.github/workflows/run_mapdl_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
build-tests:
1818
runs-on: ubuntu-22.04
1919
container:
20-
image: ghcr.io/ansys/pymapdl/mapdl:v22.2-ubuntu
20+
image: ghcr.io/ansys/mapdl:v22.2-ubuntu
2121
options: "-u=0:0 --entrypoint /bin/bash"
2222
credentials:
2323
username: ${{ secrets.GH_USERNAME }}

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This document contains the release notes for the project. See release notes for v{latest-version} and earlier
2+
in `CHANGELOG.md <https://github.com/ansys-internal/ansys-tools-common/blob/main/CHANGELOG.md>`_.
3+
<!-- towncrier release notes start -->

doc/.vale.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,6 @@ Vocab = ANSYS
2828
[*.{rst}]
2929
BasedOnStyles = Vale, Google
3030
Vale.Terms = NO
31-
Google.Headings = NO
31+
Google.Headings = NO
32+
SkippedScopes = script, style, pre, figure, code-block, literal-block
33+

doc/changelog.d/34.maintenance.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Finish cicd

doc/source/conf.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@
7070
},
7171
}
7272

73+
linkcheck_ignore = []
74+
75+
if switcher_version != "dev":
76+
linkcheck_ignore.append(f"https://github.com/ansys-internal/ansys-tools-common/releases/tag/v{__version__}")
77+
7378
# Sphinx extensions
7479
extensions = [
7580
"sphinx.ext.intersphinx",

doc/source/contributing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Contribute
66
Overall guidance on contributing to a PyAnsys library appears in the
77
`Contributing <https://dev.docs.pyansys.com/how-to/contributing.html>`_ topic
88
in the *PyAnsys developer's guide*. Ensure that you are thoroughly familiar
9-
with this guide before attempting to contribute to the Ansys tools common repo.
9+
with this guide before attempting to contribute to the Ansys tools common repository.
1010

1111
The following contribution information is specific to the Ansys tools common.
1212

doc/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ The Ansys tools project is a collection of tools for the PyAnsys ecosystem.
4747
getting_started/index
4848
user_guide/index
4949
api/index
50-
contributing
50+
contributing
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
(?i)Ansys
2-
pytest
32
ANS
4-
astroid
3+
astroid
4+
downloader
5+
mypy
6+
pytest
7+
pathing
8+
subprocess
9+
10+
11+
s.P
12+
e.M
13+
terminate
14+
kill

0 commit comments

Comments
 (0)