Skip to content

Commit

Permalink
Improve testing and CI/CD (#201)
Browse files Browse the repository at this point in the history
  • Loading branch information
viseshrp authored Dec 13, 2024
1 parent 960213a commit 82b592f
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 16 deletions.
26 changes: 16 additions & 10 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
# with:
# token: ${{ secrets.GITHUB_TOKEN }}

smoke-tests:
smoketest:
name: Build and smoke tests
runs-on: ${{ matrix.os }}
needs: [ style ]
Expand All @@ -54,16 +54,22 @@ jobs:
os: [ ubuntu-latest, windows-latest ]
python-version: [ '3.10', '3.11', '3.12', '3.13' ]
steps:
- name: Build wheelhouse and perform smoke test
- name: Build wheelhouse
uses: ansys/actions/build-wheelhouse@v8
with:
library-name: ${{ env.PACKAGE_NAME }}
operating-system: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}

- name: Install library
run: python --version && python -m pip install ${{ env.install_target }}

- name: Run smoketest
run: make smoketest

test:
name: Testing
needs: [ smoke-tests ]
needs: [ smoketest ]
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand Down Expand Up @@ -109,7 +115,7 @@ jobs:
docs:
name: Build docs
runs-on: ubuntu-latest
# needs: [docs-style]
# needs: [docs-style]
steps:
- name: Run Ansys documentation building action
uses: ansys/actions/doc-build@v8
Expand All @@ -120,7 +126,7 @@ jobs:

package:
name: Package library
needs: [ test, docs ]
needs: [ test ]
runs-on: ubuntu-latest
steps:
- name: Build library source and wheel artifacts
Expand Down Expand Up @@ -152,7 +158,7 @@ jobs:
name: Upload dev documentation
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: [ package ]
needs: [ docs, package ]
steps:
- name: Deploy the latest documentation
uses: ansys/actions/doc-deploy-dev@v8
Expand All @@ -167,7 +173,7 @@ jobs:
name: Upload release documentation
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs: [ release ]
needs: [ docs, release ]
steps:
- name: Deploy the stable documentation
uses: ansys/actions/doc-deploy-stable@v8
Expand All @@ -181,15 +187,15 @@ jobs:
build-failure:
name: Teams notify on failure
if: failure() && (github.event_name == 'pull_request' || github.ref == 'refs/heads/main' || github.ref_type == 'tag')
needs: [ style, test ]
needs: [ package ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Microsoft Teams Notification
uses: jdcargile/[email protected]
with:
github-token: ${{ github.token }} # this will use the runner's token.
ms-teams-webhook-uri: ${{ secrets.MS_TEAMS_WEBHOOK_URI }}
notification-summary: GitHub CI failure - ${{ github.event.pull_request.title }}
ms-teams-webhook-uri: ${{ secrets.MS_TEAMS_WEBHOOK_URI_CI }}
notification-summary: CI build failure
notification-color: dc3545
timezone: America/New_York
7 changes: 3 additions & 4 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ env:
PACKAGE_NAME: 'ansys-dynamicreporting-core'
PACKAGE_NAMESPACE: 'ansys.dynamicreporting.core'


jobs:

nightly_test:
Expand Down Expand Up @@ -73,15 +72,15 @@ jobs:
build-failure:
name: Teams notify on failure
if: failure()
needs: [ nightly_test, nightly_and_upload ]
needs: [ nightly_and_upload ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Microsoft Teams Notification
uses: jdcargile/[email protected]
with:
github-token: ${{ github.token }}
ms-teams-webhook-uri: ${{ secrets.MS_TEAMS_WEBHOOK_URI }}
notification-summary: Nightly failure
ms-teams-webhook-uri: ${{ secrets.MS_TEAMS_WEBHOOK_URI_NIGHTLY }}
notification-summary: Nightly build failure
notification-color: dc3545
timezone: America/New_York
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ test:
pytest -rvx --setup-show --cov=ansys.dynamicreporting.core --cov-report html:coverage-html --cov-report term --cov-report xml:coverage.xml

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

clean:
rm -rf dist build
Expand Down
2 changes: 2 additions & 0 deletions codegen/rename_whl.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
if len(chunks) == 5:
chunks.insert(2, date_tag)
new_name = "-".join(chunks)
print(f"Renaming {name} to {new_name}...")
os.rename(name, new_name)

for name in glob.glob("dist/*.tar.gz"):
chunks = name.split(".")
if len(chunks) == 5:
chunks[2] = f"{chunks[2]}-{date_tag}"
new_name = ".".join(chunks)
print(f"Renaming {name} to {new_name}...")
os.rename(name, new_name)
50 changes: 50 additions & 0 deletions tests/smoketest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# version
# ADR service core
from ansys.dynamicreporting.core import Item, Report, Service, __version__

# ADR serverless core
from ansys.dynamicreporting.core.serverless import (
ADR,
HTML,
Animation,
BasicLayout,
BoxLayout,
CarouselLayout,
DataFilterLayout,
Dataset,
File,
FooterLayout,
HeaderLayout,
Image,
)
from ansys.dynamicreporting.core.serverless import (
ItemsComparisonGenerator,
IteratorGenerator,
IteratorLayout,
PanelLayout,
PPTXLayout,
PPTXSlideLayout,
ReportLinkLayout,
Scene,
Session,
SliderLayout,
SQLQueryGenerator,
StatisticalGenerator,
String,
TabLayout,
Table,
TableMergeGenerator,
TableMergeRCFilterGenerator,
TableMergeValueFilterGenerator,
TableReduceGenerator,
TableSortFilterGenerator,
TagPropertyLayout,
Template,
TOCLayout,
Tree,
TreeMergeGenerator,
UserDefinedLayout,
)
from ansys.dynamicreporting.core.serverless import Item as ServerlessItem

print(__version__)

0 comments on commit 82b592f

Please sign in to comment.