Skip to content
This repository was archived by the owner on Nov 17, 2025. It is now read-only.

Commit ed55fe9

Browse files
germa89RobPasMue
andauthored
Getting CICD ready for release (#17)
* Adding coverage * Adding some env var * Getting CICD in place. * Adding PDF building * Updating coverage * Fixing Vale * Fixing vale again * FEAT: minor edits to CI/CD --------- Co-authored-by: Roberto Pastor Muela <[email protected]>
1 parent fce58f0 commit ed55fe9

File tree

6 files changed

+131
-115
lines changed

6 files changed

+131
-115
lines changed

.github/workflows/ci_cd.yml

Lines changed: 99 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,60 @@
1-
# check spelling, codestyle
21
name: GitHub CI
32

4-
# run only on main branch. This avoids duplicated actions on PRs
53
on:
4+
workflow_dispatch:
65
pull_request:
76
push:
87
tags:
98
- "*"
109
branches:
1110
- main
1211

12+
env:
13+
MAIN_PYTHON_VERSION: '3.10'
14+
PACKAGE_NAME: 'ansys-tools-path'
15+
PACKAGE_NAMESPACE: 'ansys.tools.path'
16+
DOCUMENTATION_CNAME: 'path.tools.docs.pyansys.com'
17+
1318
jobs:
1419
style:
15-
name: Pre-commit Check
20+
name: Code style
1621
runs-on: ubuntu-latest
17-
1822
steps:
19-
- uses: actions/checkout@v3
20-
- name: Setup Python
21-
uses: actions/setup-python@v4
23+
- name: PyAnsys code style checks
24+
uses: pyansys/actions/code-style@v4
2225
with:
23-
python-version: 3.8
24-
25-
- name: Install pre-commit requirements
26-
run: |
27-
pip install pre-commit
28-
29-
- name: Run pre-commit
30-
run: |
31-
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
26+
python-version: ${{ env.MAIN_PYTHON_VERSION }}
3227

33-
main:
28+
smoke-tests:
29+
name: "Build and smoke tests"
30+
runs-on: ${{ matrix.os }}
31+
needs: [style]
32+
if: github.ref != 'refs/heads/main'
33+
timeout-minutes: 20
34+
strategy:
35+
fail-fast: false
36+
matrix:
37+
os: [ubuntu-latest, windows-latest, macos-latest]
38+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
39+
# Only perform wheelhouse builds for macOS when releasing
40+
should-release:
41+
- ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }}
42+
exclude:
43+
- should-release: false
44+
os: macos-latest
45+
steps:
46+
- name: "Build wheelhouse and perform smoke test"
47+
uses: pyansys/actions/build-wheelhouse@v4
48+
with:
49+
library-name: ${{ env.PACKAGE_NAME }}
50+
library-namespace: ${{ env.PACKAGE_NAMESPACE }}
51+
operating-system: ${{ matrix.os }}
52+
python-version: ${{ matrix.python-version }}
53+
54+
build-tests:
3455
name: Build and Testing
3556
runs-on: ubuntu-latest
57+
needs: [smoke-tests]
3658
timeout-minutes: 20
3759
container:
3860
image: ghcr.io/pyansys/mapdl:v22.2-ubuntu
@@ -49,124 +71,91 @@ jobs:
4971
- name: Setup Python
5072
uses: actions/setup-python@v4
5173
with:
52-
python-version: 3.8
53-
54-
- name: Create wheel
55-
run: |
56-
python -m pip install build
57-
python -m build --wheel
58-
59-
- name: Validate wheel
60-
run: |
61-
python -m pip install twine
62-
python -m twine check dist/*
74+
python-version: ${{ env.MAIN_PYTHON_VERSION }}
6375

6476
- name: Install library, with test extra
65-
run: python -m pip install $(echo dist/*)[test]
77+
run: python -m pip install .[test]
6678

6779
- name: Unit testing
6880
run: |
6981
cd tests # so we're testing the install, not local
70-
python -m pytest -vx --cov=ansys.tools.path --cov-report=html
82+
python -m pytest -vx --cov=${{ env.PACKAGE_NAMESPACE }} --cov-report=term --cov-report=xml:.cov/coverage.xml --cov-report=html:.cov/html
7183
7284
- name: Upload coverage reports to Codecov
7385
uses: codecov/codecov-action@v3
74-
75-
- name: Upload wheel
76-
uses: actions/upload-artifact@v3
7786
with:
78-
name: ansys-product-library-wheel
79-
path: dist/
80-
retention-days: 7
87+
files: .cov/coverage.xml
8188

82-
docs:
83-
name: Build Documentation
89+
docs-style:
90+
name: PyAnsys documentation style check using Vale
8491
runs-on: ubuntu-latest
85-
8692
steps:
87-
- uses: actions/checkout@v3
88-
- name: Setup Python
89-
uses: actions/setup-python@v4
93+
- name: PyAnsys documentation style checks
94+
uses: pyansys/actions/doc-style@v4
9095
with:
91-
python-version: 3.8
96+
token: ${{ secrets.GITHUB_TOKEN }}
9297

93-
- name: Install library, with docs extra
94-
run: |
95-
pip install .[doc]
96-
97-
- name: Build HTML
98-
run: |
99-
make -C doc html SPHINXOPTS="-W"
100-
101-
# - name: Build PDF Documentation
102-
# run: |
103-
# sudo apt update
104-
# sudo apt-get install -y texlive-latex-extra latexmk
105-
# make -C doc latexpdf
106-
107-
- name: Upload HTML Documentation
108-
uses: actions/upload-artifact@v3
109-
with:
110-
name: Documentation-html
111-
path: doc/_build/html
112-
retention-days: 7
113-
114-
# - name: Upload PDF Documentation
115-
# uses: actions/upload-artifact@v3
116-
# with:
117-
# name: Documentation-pdf
118-
# path: doc/build/latex/*.pdf
119-
# retention-days: 7
120-
121-
Release:
122-
if: contains(github.ref, 'refs/tags')
123-
needs: [main, style, docs]
98+
docs:
99+
name: Documentation
124100
runs-on: ubuntu-latest
101+
needs: [docs-style]
125102
steps:
126-
- name: Set up Python
127-
uses: actions/setup-python@v4
103+
- name: "Run Ansys documentation building action"
104+
uses: pyansys/actions/doc-build@v4
128105
with:
129-
python-version: 3.9
130-
131-
- uses: actions/checkout@v3
106+
python-version: ${{ env.MAIN_PYTHON_VERSION }}
107+
dependencies: "build-essential zip pandoc texlive-latex-extra latexmk texlive-pstricks"
132108

133-
- uses: actions/download-artifact@v3
109+
package:
110+
name: Package library
111+
needs: [build-tests, docs]
112+
runs-on: ubuntu-latest
113+
steps:
114+
- name: Build library source and wheel artifacts
115+
uses: pyansys/actions/build-library@v4
134116
with:
135-
name: ansys-product-library-wheel
117+
library-name: ${{ env.PACKAGE_NAME }}
118+
python-version: ${{ env.MAIN_PYTHON_VERSION }}
136119

137-
- uses: actions/download-artifact@v3
120+
release:
121+
name: Release project
122+
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }}
123+
needs: [package]
124+
runs-on: ubuntu-latest
125+
steps:
126+
- name: Release to the public PyPI repository
127+
uses: pyansys/actions/release-pypi-public@v4
138128
with:
139-
name: Documentation-pdf
129+
library-name: ${{ env.PACKAGE_NAME }}
130+
twine-username: "__token__"
131+
twine-token: ${{ secrets.PYPI_TOKEN }}
140132

141-
- uses: actions/download-artifact@v3
133+
- name: Release to GitHub
134+
uses: pyansys/actions/release-github@v4
142135
with:
143-
name: Documentation-html
144-
path: ~/html
145-
146-
# list current directory
147-
- name: List directory structure
148-
run: ls -R
136+
library-name: ${{ env.PACKAGE_NAME }}
149137

150-
- name: Deploy
151-
uses: JamesIves/[email protected]
138+
upload_docs_dev:
139+
name: Upload dev documentation
140+
if: ${{ github.ref == 'refs/heads/main' }}
141+
runs-on: ubuntu-latest
142+
needs: [package]
143+
steps:
144+
- name: Deploy the latest documentation
145+
uses: pyansys/actions/doc-deploy-dev@v4
152146
with:
153-
BRANCH: gh-pages
154-
FOLDER: ~/html
155-
CLEAN: true
156-
157-
# note how we use the PyPI tokens
158-
- name: Upload to Azure PyPi (disabled)
159-
run: |
160-
pip install twine
161-
# twine upload --skip-existing ./**/*.whl
162-
env:
163-
TWINE_USERNAME: __token__
164-
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
147+
cname: ${{ env.DOCUMENTATION_CNAME }}
148+
token: ${{ secrets.GITHUB_TOKEN }}
165149

166-
- name: Release
167-
uses: softprops/action-gh-release@v1
150+
upload_docs_release:
151+
name: Upload release documentation
152+
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }}
153+
runs-on: ubuntu-latest
154+
needs: [release]
155+
steps:
156+
- name: Deploy the stable documentation
157+
uses: pyansys/actions/doc-deploy-stable@v4
168158
with:
169-
files: |
170-
./**/*.whl
171-
./**/*.zip
172-
./**/*.pdf
159+
cname: ${{ env.DOCUMENTATION_CNAME }}
160+
token: ${{ secrets.GITHUB_TOKEN }}
161+
python-version: ${{ env.MAIN_PYTHON_VERSION }}

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ questions or submissions to this repository.
1212

1313
For contributing to this project, please refer to the [PyAnsys Developer's Guide].
1414
Further information about contributing to ansys-tools-path can be found in
15-
[ansys-tools-path github page](hhttps://github.com/pyansys/ansys-tools-path).
15+
[ansys-tools-path github page](https://github.com/pyansys/ansys-tools-path).
1616

1717
[PyAnsys Developer's Guide]: https://dev.docs.pyansys.com/

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ For developers
6767
Installing ``ansys-tools-path`` in developer mode allows
6868
you to modify the source and enhance it.
6969

70-
Before contributing to the project, please refer to the `PyAnsys Developer's guide`_. You will
71-
need to follow these steps:
70+
Before contributing to the project, please refer to the `PyAnsys Developer's guide`_.
71+
You need to follow these steps:
7272

7373
#. Start by cloning this repository:
7474

codecov.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
comment:
2+
layout: "diff"
3+
behavior: default
4+
require_changes: true # Avoid coverage comment if no files are changed.
5+
6+
coverage:
7+
range: 70..100
8+
round: down
9+
precision: 2
10+
status:
11+
project:
12+
default:
13+
target: 85%
14+
patch:
15+
default:
16+
# basic
17+
target: 90%
18+
if_not_found: success
19+
if_ci_failed: error
20+
if_no_uploads: error
21+
threshold: 4% # Because some tests are flaky.

doc/Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,18 @@ help:
1313

1414
.PHONY: help Makefile
1515

16+
17+
# customized pdf due to svg issue
18+
pdf:
19+
@$(SPHINXBUILD) -M latex "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
20+
cd $(BUILDDIR)/latex && latexmk -r latexmkrc -pdf *.tex -interaction=nonstopmode || true
21+
(test -f $(BUILDDIR)/latex/ansys-tools*.pdf && echo pdf exists) || exit 1
22+
1623
# Catch-all target: route all unknown targets to Sphinx using the new
1724
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
1825
%: Makefile
1926
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
2027

21-
2228
# Customized clean due to examples gallery
2329
clean:
2430
rm -rf $(BUILDDIR)/*

doc/source/_static/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Static files will be found here (like images and other assets).
1+
Static files are found here (like images and other assets).

0 commit comments

Comments
 (0)