Skip to content

Commit 5838345

Browse files
Migrate github workflow to pyansys/actions. (#81)
* initial commit for the actions change * Add order for workflow * rename the worflow name * Update .github/workflows/ci_cd.yml Co-authored-by: Maxime Rey <[email protected]> * SKip the release by commenting * SKip the release by commenting Co-authored-by: Maxime Rey <[email protected]>
1 parent 2401a0a commit 5838345

File tree

1 file changed

+38
-110
lines changed

1 file changed

+38
-110
lines changed

.github/workflows/ci_cd.yml

Lines changed: 38 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,12 @@ concurrency:
1919

2020
jobs:
2121

22-
2322
style:
2423
name: Code style
2524
runs-on: ubuntu-latest
2625
steps:
27-
- uses: actions/checkout@v3
28-
29-
- name: Set up Python
30-
uses: actions/setup-python@v4
26+
- name: PyAnsys code style checks
27+
uses: pyansys/actions/code-style@v1
3128
with:
3229
python-version: ${{ env.MAIN_PYTHON_VERSION }}
3330

@@ -41,24 +38,26 @@ jobs:
4138
name: Documentation Style Check
4239
runs-on: ubuntu-latest
4340
steps:
44-
- uses: actions/checkout@v3
41+
- name: PyAnsys documentation style checks
42+
uses: pyansys/actions/doc-style@v1
43+
with:
44+
token: ${{ secrets.GITHUB_TOKEN }}
4545

46-
- name: Running Vale
47-
uses: errata-ai/vale-action@reviewdog
48-
env:
49-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
46+
docs-build:
47+
48+
name: Doc building
49+
runs-on: ubuntu-latest
50+
needs: docs-style
51+
steps:
52+
- name: "Run Ansys documentation building action"
53+
uses: pyansys/actions/doc-build@v1
5054
with:
51-
files: doc
52-
reporter: github-pr-check
53-
level: error
54-
filter_mode: nofilter
55-
fail_on_error: true
56-
vale_flags: "--config=doc/.vale.ini"
55+
python-version: ${{ env.MAIN_PYTHON_VERSION }}
5756

5857
tests:
5958
name: Build and testing
6059
runs-on: ubuntu-latest
61-
needs: [style,docs]
60+
needs: [style,docs-build]
6261

6362
steps:
6463
- uses: actions/checkout@v3
@@ -105,99 +104,28 @@ jobs:
105104
path: dist/
106105
retention-days: 7
107106

108-
docs:
109-
name: Documentation
110-
runs-on: ubuntu-latest
111-
needs: [docs-style]
112-
113-
steps:
114-
- uses: actions/checkout@v3
115-
116-
- name: Set up Python
117-
uses: actions/setup-python@v4
118-
with:
119-
python-version: ${{ env.MAIN_PYTHON_VERSION }}
120-
121-
- name: Install OS packages
122-
run: |
123-
sudo apt update
124-
sudo apt install zip pandoc libgl1-mesa-glx xvfb texlive-latex-extra latexmk
125-
126-
- name: Install library
127-
run: pip install .
128-
129-
- name: Build HTML
130-
run: |
131-
pip install .[doc]
132-
make -C doc html SPHINXOPTS="-W"
133-
134-
- name: Generate the PDF documentation
135-
run: |
136-
make -C doc pdf
137-
138-
- name: Upload HTML documentation
139-
uses: actions/upload-artifact@v3
140-
with:
141-
name: HTML-Documentation
142-
path: doc/build/html
143-
retention-days: 7
144-
145-
- name: Upload PDF Documentation
146-
uses: actions/upload-artifact@v3
147-
with:
148-
name: Documentation-pdf
149-
path: doc/build/latex/*.pdf
150-
retention-days: 7
107+
release:
151108

152-
Release:
153-
if: contains(github.ref, 'refs/tags')
154-
needs: [tests, style, docs]
109+
name: "Release project to private PyPI, public PyPI and GitHub"
110+
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
111+
needs: [tests]
155112
runs-on: ubuntu-latest
156113
steps:
157-
- name: Set up Python
158-
uses: actions/setup-python@v4
159-
with:
160-
python-version: 3.9
161-
162-
- uses: actions/checkout@v3
163-
164-
- uses: actions/download-artifact@v3
165-
with:
166-
name: ansys-pyoptics-wheel
167-
168-
- uses: actions/download-artifact@v3
169-
with:
170-
name: Documentation-pdf
171-
172-
- uses: actions/download-artifact@v3
173-
with:
174-
name: Documentation-html
175-
path: ~/html
176-
177-
# list current directory
178-
- name: List directory structure
179-
run: ls -R
180-
181-
- name: Deploy
182-
uses: JamesIves/[email protected]
183-
with:
184-
BRANCH: gh-pages
185-
FOLDER: ~/html
186-
CLEAN: true
187-
188-
# note how we use the PyPI tokens
189-
- name: Upload to Azure PyPi (disabled)
190-
run: |
191-
pip install twine
192-
# twine upload --skip-existing ./**/*.whl
193-
env:
194-
TWINE_USERNAME: __token__
195-
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
196-
197-
- name: Release
198-
uses: softprops/action-gh-release@v1
199-
with:
200-
files: |
201-
./**/*.whl
202-
./**/*.zip
203-
./**/*.pdf
114+
# - name: "Release to the private PyPI repository"
115+
# uses: pyansys/actions/release-pypi-private@v1
116+
# with:
117+
# library-name: ${{ env.PACKAGE_NAME }}
118+
# twine-username: "__token__"
119+
# twine-token: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}
120+
#
121+
# - name: "Release to the public PyPI repository"
122+
# uses: pyansys/actions/release-pypi-public@v1
123+
# with:
124+
# library-name: ${{ env.PACKAGE_NAME }}
125+
# twine-username: "__token__"
126+
# twine-token: ${{ secrets.PYPI_TOKEN }}
127+
#
128+
- name: "Release to GitHub"
129+
uses: pyansys/actions/release-github@v1
130+
with:
131+
library-name: ${{ env.PACKAGE_NAME }}

0 commit comments

Comments
 (0)