Skip to content

Commit b9e9a19

Browse files
committed
ci(workflows): improve jobs
1 parent 8e9bec3 commit b9e9a19

File tree

1 file changed

+58
-72
lines changed

1 file changed

+58
-72
lines changed

.github/workflows/cicd.yml

Lines changed: 58 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,19 @@ env:
1717

1818
jobs:
1919

20-
update-changelog:
21-
name: Update CHANGELOG (on release)
22-
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
20+
changelog-fragment:
21+
name: Create changelog fragment
2322
runs-on: ubuntu-latest
2423
permissions:
2524
contents: write
2625
pull-requests: write
2726
steps:
28-
- uses: ansys/actions/doc-deploy-changelog@c2fa7c93f6883114e0e643599431b33d29f0b13f # v10.1.4
27+
- uses: ansys/actions/
2928
with:
3029
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
3130
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
3231
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
3332

34-
# TODO uncomment after the first public release
35-
# check-vulnerabilities:
36-
# name: "Check library vulnerabilities"
37-
# runs-on: ubuntu-latest
38-
# steps:
39-
# - uses: ansys/actions/[email protected]
40-
# with:
41-
# python-version: ${{ env.MAIN_PYTHON_VERSION }}
42-
# token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
43-
# python-package-name: ${{ env.PACKAGE_NAME }}
44-
# dev-mode: ${{ github.ref != 'refs/heads/main' }}
45-
4633
code-style:
4734
name: Code style
4835
runs-on: ubuntu-latest
@@ -51,80 +38,71 @@ jobs:
5138
with:
5239
python-version: ${{ env.MAIN_PYTHON_VERSION }}
5340

54-
docs-style:
55-
name: Documentation Style Check
41+
doc-style:
42+
name: Doc style
5643
runs-on: ubuntu-latest
5744
steps:
5845
- uses: ansys/actions/doc-style@c2fa7c93f6883114e0e643599431b33d29f0b13f # v10.1.4
5946
with:
6047
token: ${{ secrets.GITHUB_TOKEN }}
6148

49+
actions-style:
50+
name: Actions style
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: ansys/actions/check-actions-security@c2fa7c93f6883114e0e643599431b33d29f0b13f # v10.1.4
54+
with:
55+
generate-summary: true
56+
token: ${{ secrets.GITHUB_TOKEN }}
57+
auditing-level: high
58+
6259
wheelhouse:
6360
name: Wheelhouse / ${{ matrix.os }} /
6461
runs-on: ${{ matrix.os }}
62+
needs: code-style
6563
strategy:
6664
fail-fast: false
6765
matrix:
6866
os: [ubuntu-latest, windows-latest, macos-latest]
69-
python-version: ['3.10', '3.11', '3.12']
67+
python: ['3.10', '3.11', '3.12']
7068
steps:
7169
- uses: ansys/actions/build-wheelhouse@c2fa7c93f6883114e0e643599431b33d29f0b13f # v10.1.4
7270
with:
7371
library-name: ${{ env.PACKAGE_NAME }}
7472
operating-system: ${{ matrix.os }}
75-
python-version: ${{ matrix.python-version }}
73+
python-version: ${{ matrix.python }}
7674
whitelist-license-check: termcolor # Has MIT license, but it's not recognized
7775

7876
tests:
7977
name: Testing
8078
runs-on: ubuntu-latest
8179
needs: wheelhouse
80+
strategy:
81+
fail-fast: false
82+
matrix:
83+
os: [ubuntu-latest, windows-latest, macos-latest]
84+
python: ['3.10', '3.11', '3.12']
8285
env:
8386
ANSYS_LOCAL: false
8487
ON_UBUNTU: true
8588
steps:
8689
- uses: ansys/actions/tests-pytest@c2fa7c93f6883114e0e643599431b33d29f0b13f # v10.1.4
87-
- name: Checkout repository
88-
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
89-
90-
- name: Set up Python
91-
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4.9.1
92-
with:
93-
python-version: ${{ env.MAIN_PYTHON_VERSION }}
94-
cache: pip
95-
96-
- name: Install uv and create venv
97-
run: |
98-
python -m pip install --upgrade pip
99-
pip install uv
100-
- name: Install project dependencies
101-
run: |
102-
uv sync --extra tests
103-
- name: Run tests
104-
run: |
105-
uv sync --extra tests --no-dev
106-
uv pip install tests/launcher/pkg_with_entrypoint
107-
uv run pytest
108-
109-
# - uses: codecov/codecov-action@v5
110-
# name: 'Upload coverage to CodeCov'
111-
# with:
112-
# token: ${{ secrets.CODECOV_TOKEN }}
90+
# uv pip install tests/launcher/pkg_with_entrypoint
11391

11492
doc-build:
11593
name: Build documentation
116-
needs: [docs-style]
94+
needs: doc-style
11795
runs-on: ubuntu-latest
11896
steps:
11997
- uses: ansys/actions/doc-build@c2fa7c93f6883114e0e643599431b33d29f0b13f # v10.1.4
12098
with:
12199
python-version: ${{ env.MAIN_PYTHON_VERSION }}
122-
check-links: false # Delete after first release
100+
check-links: false
123101

124-
package:
125-
name: Package library
102+
build-library:
103+
name: Build library
126104
runs-on: ubuntu-latest
127-
needs: [tests, doc-build]
105+
needs: [doc-build, tests]
128106
steps:
129107
- uses: ansys/actions/build-library@c2fa7c93f6883114e0e643599431b33d29f0b13f # v10.1.4
130108
with:
@@ -134,51 +112,59 @@ jobs:
134112
release:
135113
name: Release project
136114
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }}
137-
needs: [package]
115+
needs: build-library
138116
runs-on: ubuntu-latest
139117
environment: release
140118
permissions:
141119
id-token: write
142120
contents: write
143121
steps:
144-
- name: Download the library artifacts from build-library step
122+
- name: Download artifacts
145123
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
146124
with:
147125
name: ${{ env.PACKAGE_NAME }}-artifacts
148126
path: ${{ env.PACKAGE_NAME }}-artifacts
149127

150-
# TODO uncomment after the first public release
151-
# - name: "Upload artifacts to PyPI using trusted publisher"
152-
# uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
153-
# with:
154-
# repository-url: "https://upload.pypi.org/legacy/"
155-
# print-hash: true
156-
# packages-dir: ${{ env.PACKAGE_NAME }}-artifacts
157-
# skip-existing: false
158-
159-
- name: Release to the private PyPI repository
160-
uses: ansys/actions/release-pypi-private@495ca3d79c1627f5b96c469cfbe799718e9dc35f # v9.0.13
128+
- name: Release to the public PyPI
129+
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
161130
with:
162-
library-name: ansys-tools-common
163-
twine-username: __token__
164-
twine-token: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}
131+
repository-url: https://upload.pypi.org/legacy/
132+
print-hash: true
133+
packages-dir: ${{ env.PACKAGE_NAME }}-artifacts
134+
skip-existing: false
165135

166136
- name: Release to GitHub
167137
uses: ansys/actions/release-github@c2fa7c93f6883114e0e643599431b33d29f0b13f # v10.1.4
168138
with:
169139
token: ${{ secrets.GITHUB_TOKEN }}
170140
library-name: ${{ env.PACKAGE_NAME }}
171141

172-
upload_docs_release:
173-
name: Upload release documentation
142+
doc-deploy-stable:
143+
name: Deploy stable docs
174144
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
175145
runs-on: ubuntu-latest
176-
needs: [release]
146+
needs: release
177147
steps:
178-
- name: Deploy the stable documentation
179-
uses: ansys/actions/doc-deploy-stable@c2fa7c93f6883114e0e643599431b33d29f0b13f # v10.1.4
148+
- uses: ansys/actions/doc-deploy-stable@c2fa7c93f6883114e0e643599431b33d29f0b13f # v10.1.4
180149
with:
181150
cname: ${{ env.DOCUMENTATION_CNAME }}
182151
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
183152
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
184153
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
154+
155+
deploy-changelog:
156+
name: Deploy changelog
157+
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
158+
runs-on: ubuntu-latest
159+
needs: doc-deploy-stable
160+
permissions:
161+
contents: write
162+
pull-requests: write
163+
steps:
164+
- uses: ansys/actions/doc-deploy-changelog@c2fa7c93f6883114e0e643599431b33d29f0b13f # v10.1.4
165+
with:
166+
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
167+
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
168+
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
169+
170+

0 commit comments

Comments
 (0)