1- # check spelling, codestyle
21name : GitHub CI
32
4- # run only on main branch. This avoids duplicated actions on PRs
53on :
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+
1318jobs :
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- 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 }}
0 commit comments