Skip to content

Commit 82b592f

Browse files
authored
Improve testing and CI/CD (#201)
1 parent 960213a commit 82b592f

File tree

5 files changed

+72
-16
lines changed

5 files changed

+72
-16
lines changed

.github/workflows/ci_cd.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
# with:
4545
# token: ${{ secrets.GITHUB_TOKEN }}
4646

47-
smoke-tests:
47+
smoketest:
4848
name: Build and smoke tests
4949
runs-on: ${{ matrix.os }}
5050
needs: [ style ]
@@ -54,16 +54,22 @@ jobs:
5454
os: [ ubuntu-latest, windows-latest ]
5555
python-version: [ '3.10', '3.11', '3.12', '3.13' ]
5656
steps:
57-
- name: Build wheelhouse and perform smoke test
57+
- name: Build wheelhouse
5858
uses: ansys/actions/build-wheelhouse@v8
5959
with:
6060
library-name: ${{ env.PACKAGE_NAME }}
6161
operating-system: ${{ matrix.os }}
6262
python-version: ${{ matrix.python-version }}
6363

64+
- name: Install library
65+
run: python --version && python -m pip install ${{ env.install_target }}
66+
67+
- name: Run smoketest
68+
run: make smoketest
69+
6470
test:
6571
name: Testing
66-
needs: [ smoke-tests ]
72+
needs: [ smoketest ]
6773
runs-on: ${{ matrix.os }}
6874
strategy:
6975
matrix:
@@ -109,7 +115,7 @@ jobs:
109115
docs:
110116
name: Build docs
111117
runs-on: ubuntu-latest
112-
# needs: [docs-style]
118+
# needs: [docs-style]
113119
steps:
114120
- name: Run Ansys documentation building action
115121
uses: ansys/actions/doc-build@v8
@@ -120,7 +126,7 @@ jobs:
120126

121127
package:
122128
name: Package library
123-
needs: [ test, docs ]
129+
needs: [ test ]
124130
runs-on: ubuntu-latest
125131
steps:
126132
- name: Build library source and wheel artifacts
@@ -152,7 +158,7 @@ jobs:
152158
name: Upload dev documentation
153159
if: github.ref == 'refs/heads/main'
154160
runs-on: ubuntu-latest
155-
needs: [ package ]
161+
needs: [ docs, package ]
156162
steps:
157163
- name: Deploy the latest documentation
158164
uses: ansys/actions/doc-deploy-dev@v8
@@ -167,7 +173,7 @@ jobs:
167173
name: Upload release documentation
168174
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
169175
runs-on: ubuntu-latest
170-
needs: [ release ]
176+
needs: [ docs, release ]
171177
steps:
172178
- name: Deploy the stable documentation
173179
uses: ansys/actions/doc-deploy-stable@v8
@@ -181,15 +187,15 @@ jobs:
181187
build-failure:
182188
name: Teams notify on failure
183189
if: failure() && (github.event_name == 'pull_request' || github.ref == 'refs/heads/main' || github.ref_type == 'tag')
184-
needs: [ style, test ]
190+
needs: [ package ]
185191
runs-on: ubuntu-latest
186192
steps:
187193
- uses: actions/checkout@v4
188194
- name: Microsoft Teams Notification
189195
uses: jdcargile/[email protected]
190196
with:
191197
github-token: ${{ github.token }} # this will use the runner's token.
192-
ms-teams-webhook-uri: ${{ secrets.MS_TEAMS_WEBHOOK_URI }}
193-
notification-summary: GitHub CI failure - ${{ github.event.pull_request.title }}
198+
ms-teams-webhook-uri: ${{ secrets.MS_TEAMS_WEBHOOK_URI_CI }}
199+
notification-summary: CI build failure
194200
notification-color: dc3545
195201
timezone: America/New_York

.github/workflows/nightly.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ env:
1010
PACKAGE_NAME: 'ansys-dynamicreporting-core'
1111
PACKAGE_NAMESPACE: 'ansys.dynamicreporting.core'
1212

13-
1413
jobs:
1514

1615
nightly_test:
@@ -73,15 +72,15 @@ jobs:
7372
build-failure:
7473
name: Teams notify on failure
7574
if: failure()
76-
needs: [ nightly_test, nightly_and_upload ]
75+
needs: [ nightly_and_upload ]
7776
runs-on: ubuntu-latest
7877
steps:
7978
- uses: actions/checkout@v4
8079
- name: Microsoft Teams Notification
8180
uses: jdcargile/[email protected]
8281
with:
8382
github-token: ${{ github.token }}
84-
ms-teams-webhook-uri: ${{ secrets.MS_TEAMS_WEBHOOK_URI }}
85-
notification-summary: Nightly failure
83+
ms-teams-webhook-uri: ${{ secrets.MS_TEAMS_WEBHOOK_URI_NIGHTLY }}
84+
notification-summary: Nightly build failure
8685
notification-color: dc3545
8786
timezone: America/New_York

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ test:
3131
pytest -rvx --setup-show --cov=ansys.dynamicreporting.core --cov-report html:coverage-html --cov-report term --cov-report xml:coverage.xml
3232

3333
smoketest:
34-
python -c "from ansys.dynamicreporting.core import __version__; print(__version__)"
35-
python -c "from ansys.dynamicreporting.core import Service"
34+
python tests/smoketest.py
3635

3736
clean:
3837
rm -rf dist build

codegen/rename_whl.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
if len(chunks) == 5:
99
chunks.insert(2, date_tag)
1010
new_name = "-".join(chunks)
11+
print(f"Renaming {name} to {new_name}...")
1112
os.rename(name, new_name)
1213

1314
for name in glob.glob("dist/*.tar.gz"):
1415
chunks = name.split(".")
1516
if len(chunks) == 5:
1617
chunks[2] = f"{chunks[2]}-{date_tag}"
1718
new_name = ".".join(chunks)
19+
print(f"Renaming {name} to {new_name}...")
1820
os.rename(name, new_name)

tests/smoketest.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# version
2+
# ADR service core
3+
from ansys.dynamicreporting.core import Item, Report, Service, __version__
4+
5+
# ADR serverless core
6+
from ansys.dynamicreporting.core.serverless import (
7+
ADR,
8+
HTML,
9+
Animation,
10+
BasicLayout,
11+
BoxLayout,
12+
CarouselLayout,
13+
DataFilterLayout,
14+
Dataset,
15+
File,
16+
FooterLayout,
17+
HeaderLayout,
18+
Image,
19+
)
20+
from ansys.dynamicreporting.core.serverless import (
21+
ItemsComparisonGenerator,
22+
IteratorGenerator,
23+
IteratorLayout,
24+
PanelLayout,
25+
PPTXLayout,
26+
PPTXSlideLayout,
27+
ReportLinkLayout,
28+
Scene,
29+
Session,
30+
SliderLayout,
31+
SQLQueryGenerator,
32+
StatisticalGenerator,
33+
String,
34+
TabLayout,
35+
Table,
36+
TableMergeGenerator,
37+
TableMergeRCFilterGenerator,
38+
TableMergeValueFilterGenerator,
39+
TableReduceGenerator,
40+
TableSortFilterGenerator,
41+
TagPropertyLayout,
42+
Template,
43+
TOCLayout,
44+
Tree,
45+
TreeMergeGenerator,
46+
UserDefinedLayout,
47+
)
48+
from ansys.dynamicreporting.core.serverless import Item as ServerlessItem
49+
50+
print(__version__)

0 commit comments

Comments
 (0)