Skip to content

Commit c8a4e71

Browse files
chore: add a composite action to simplify workflows (#141)
Co-authored-by: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com>
1 parent 8c4c2c8 commit c8a4e71

8 files changed

Lines changed: 52 additions & 34 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: "Load Visor env"
2+
description: "Export shared Visor CI constants as env vars for downstream steps."
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Export shared env vars
8+
shell: bash
9+
run: |
10+
{
11+
echo "MAIN_PYTHON_VERSION=3.11"
12+
echo "PACKAGE_NAME=ansys-visor-viewer"
13+
echo "POETRY_VERSION=2.3.2"
14+
echo "NODE_VERSION=22.12.0"
15+
} >> "$GITHUB_ENV"
16+
17+

‎.github/dependabot.yml‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ updates:
1919
open-pull-requests-limit: 5
2020
labels:
2121
- "maintenance"
22-
- "dependencies"
2322
commit-message:
2423
prefix: "chore(actions):"
2524
groups:
@@ -36,7 +35,6 @@ updates:
3635
open-pull-requests-limit: 5
3736
labels:
3837
- "maintenance"
39-
- "dependencies"
4038
commit-message:
4139
prefix: "build(deps):"
4240
ignore:
@@ -64,7 +62,6 @@ updates:
6462
open-pull-requests-limit: 3
6563
labels:
6664
- "maintenance"
67-
- "dependencies"
6865
commit-message:
6966
prefix: "build(npm):"
7067
ignore:
@@ -88,7 +85,6 @@ updates:
8885
open-pull-requests-limit: 3
8986
labels:
9087
- "maintenance"
91-
- "dependencies"
9288
commit-message:
9389
prefix: "build(dash):"
9490
ignore:
@@ -112,7 +108,6 @@ updates:
112108
open-pull-requests-limit: 2
113109
labels:
114110
- "maintenance"
115-
- "dependencies"
116111
commit-message:
117112
prefix: "build(docker):"
118113
groups:
@@ -129,7 +124,6 @@ updates:
129124
open-pull-requests-limit: 2
130125
labels:
131126
- "maintenance"
132-
- "dependencies"
133127
commit-message:
134128
prefix: "build(docker):"
135129
groups:
@@ -146,7 +140,6 @@ updates:
146140
open-pull-requests-limit: 2
147141
labels:
148142
- "maintenance"
149-
- "dependencies"
150143
commit-message:
151144
prefix: "build(docker):"
152145
groups:

‎.github/workflows/build_and_package.yml‎

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ on:
1212
branches:
1313
- main
1414
env:
15-
MAIN_PYTHON_VERSION: "3.11"
16-
POETRY_VERSION: "2.3.2"
17-
PACKAGE_NAME: "ansys-visor-viewer"
18-
1915
# For Solutions private PyPI:
2016
POETRY_HTTP_BASIC_SOLUTIONS_PRIVATE_PYPI_USERNAME: "PAT"
2117
POETRY_HTTP_BASIC_SOLUTIONS_PRIVATE_PYPI_PASSWORD: ${{ secrets.SOLUTIONS_PRIVATE_PYPI_PASSWORD }}
@@ -46,15 +42,18 @@ jobs:
4642
- name: Checkout repository
4743
uses: actions/checkout@v4
4844

45+
- name: Load Visor env
46+
uses: ./.github/actions/load-visor-env
47+
4948
- name: Set up Python
50-
uses: actions/setup-python@v4
49+
uses: actions/setup-python@v5
5150
with:
5251
python-version: ${{ env.MAIN_PYTHON_VERSION }}
5352

5453
- name: Set up Node.js
55-
uses: actions/setup-node@v1
54+
uses: actions/setup-node@v4
5655
with:
57-
node-version: '22.12.0'
56+
node-version: ${{ env.NODE_VERSION }}
5857

5958
- name: Install visor-client npm dependencies
6059
working-directory: src/ansys/visor/visor-client
@@ -86,9 +85,12 @@ jobs:
8685
- name: Checkout repository
8786
uses: actions/checkout@v4
8887

88+
- name: Load Visor env
89+
uses: ./.github/actions/load-visor-env
90+
8991
# Set up Python
9092
- name: Set up Python
91-
uses: actions/setup-python@v4
93+
uses: actions/setup-python@v5
9294
with:
9395
python-version: ${{ env.MAIN_PYTHON_VERSION }}
9496

@@ -116,9 +118,9 @@ jobs:
116118
117119
# Node.js package build
118120
- name: Set up Node.js
119-
uses: actions/setup-node@v1
121+
uses: actions/setup-node@v4
120122
with:
121-
node-version: '22.12.0'
123+
node-version: ${{ env.NODE_VERSION }}
122124

123125
- name: Install visor-client npm dependencies
124126
working-directory: src/ansys/visor/visor-client
@@ -220,6 +222,7 @@ jobs:
220222

221223
outputs:
222224
package_version: ${{ steps.set_package_version.outputs.package_version }}
225+
package_name: ${{ env.PACKAGE_NAME }}
223226

224227
release:
225228
name: Release project
@@ -238,22 +241,22 @@ jobs:
238241
- name: "Download the library artifacts from build-library step"
239242
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
240243
with:
241-
name: ${{ env.PACKAGE_NAME }}-artifacts
242-
path: ${{ env.PACKAGE_NAME }}-artifacts
244+
name: ${{ needs.build.outputs.package_name }}-artifacts
245+
path: ${{ needs.build.outputs.package_name }}-artifacts
243246

244247
- name: "Upload artifacts to PyPI using trusted publisher"
245248
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
246249
with:
247250
repository-url: "https://upload.pypi.org/legacy/"
248251
print-hash: true
249-
packages-dir: ${{ env.PACKAGE_NAME }}-artifacts
252+
packages-dir: ${{ needs.build.outputs.package_name }}-artifacts
250253
skip-existing: false
251254

252255
- name: Release to GitHub
253256
uses: ansys/actions/release-github@7e89e00c5619374a1da8c2e876309d8b15ff0559 # v11.0.3
254257
with:
255258
token: ${{ secrets.GITHUB_TOKEN }}
256-
library-name: ${{ env.PACKAGE_NAME }}
259+
library-name: ${{ needs.build.outputs.package_name }}
257260
only-code: true
258261

259262

‎.github/workflows/check-pr-docs-build.yml‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ on:
1010
- main
1111

1212

13-
env:
14-
DOCUMENTATION_CNAME: 'visor.docs.pyansys.com'
15-
MAIN_PYTHON_VERSION: '3.11'
16-
17-
1813
concurrency:
1914
group: ${{ github.workflow }}-${{ github.ref }}
2015
cancel-in-progress: true
@@ -25,6 +20,12 @@ jobs:
2520
name: Build docs
2621
runs-on: ubuntu-latest
2722
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Load Visor env
27+
uses: ./.github/actions/load-visor-env
28+
2829
# Install Xvfb and Mesa for headless OpenGL rendering (needed for VTK and similar libraries)
2930
- name: Install Xvfb and Mesa
3031
run: |
@@ -45,6 +46,7 @@ jobs:
4546
DISPLAY: ":99" # Use the virtual X server started by Xvfb
4647
VTK_DEFAULT_RENDER_WINDOW_OFFSCREEN: "1" # Force VTK to use offscreen rendering
4748
with:
49+
checkout: false
4850
python-version: ${{ env.MAIN_PYTHON_VERSION }}
4951
check-links: false
5052
sphinxopts: '-j auto'

‎.github/workflows/nightly-docs.yml‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ on:
1010

1111
env:
1212
DOCUMENTATION_CNAME: 'visor.docs.pyansys.com'
13-
MAIN_PYTHON_VERSION: '3.11'
1413
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1514

1615
concurrency:
@@ -22,6 +21,12 @@ jobs:
2221
name: Build docs
2322
runs-on: ubuntu-latest
2423
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
27+
- name: Load Visor env
28+
uses: ./.github/actions/load-visor-env
29+
2530
# Install Xvfb and Mesa for headless OpenGL rendering (needed for VTK and similar libraries)
2631
- name: Install Xvfb and Mesa
2732
run: |
@@ -42,6 +47,7 @@ jobs:
4247
DISPLAY: ":99" # Use the virtual X server started by Xvfb
4348
VTK_DEFAULT_RENDER_WINDOW_OFFSCREEN: "1" # Force VTK to use offscreen rendering
4449
with:
50+
checkout: false
4551
python-version: ${{ env.MAIN_PYTHON_VERSION }}
4652
check-links: false
4753
sphinxopts: '-j auto'

‎.github/workflows/nightly-tests.yml‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ on:
55
- cron: '0 23 * * *'
66
workflow_dispatch:
77

8-
env:
9-
MAIN_PYTHON_VERSION: '3.11'
10-
11-
128
jobs:
139
nightly_test:
1410
name: Testing

‎.github/workflows/python-tests.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ on:
1414
permissions:
1515
contents: read
1616

17-
env:
18-
POETRY_VERSION: '2.3.2'
19-
2017
jobs:
2118
test:
2219
runs-on: ubuntu-latest
@@ -29,6 +26,9 @@ jobs:
2926
- name: Checkout repository
3027
uses: actions/checkout@v4
3128

29+
- name: Load Visor env
30+
uses: ./.github/actions/load-visor-env
31+
3232
- name: Set up Python ${{ matrix.python-version }}
3333
uses: actions/setup-python@v5
3434
with:

‎doc/changelog.d/141.maintenance.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add a composite action to simplify workflows

0 commit comments

Comments
 (0)