Skip to content

Migrate github workflow to pyansys/actions. #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 38 additions & 110 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,12 @@ concurrency:

jobs:


style:
name: Code style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
- name: PyAnsys code style checks
uses: pyansys/actions/code-style@v1
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

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

- name: Running Vale
uses: errata-ai/vale-action@reviewdog
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
docs-build:

name: Doc building
runs-on: ubuntu-latest
needs: docs-style
steps:
- name: "Run Ansys documentation building action"
uses: pyansys/actions/doc-build@v1
with:
files: doc
reporter: github-pr-check
level: error
filter_mode: nofilter
fail_on_error: true
vale_flags: "--config=doc/.vale.ini"
python-version: ${{ env.MAIN_PYTHON_VERSION }}

tests:
name: Build and testing
runs-on: ubuntu-latest
needs: [style,docs]
needs: [style,docs-build]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -105,99 +104,28 @@ jobs:
path: dist/
retention-days: 7

docs:
name: Documentation
runs-on: ubuntu-latest
needs: [docs-style]

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- name: Install OS packages
run: |
sudo apt update
sudo apt install zip pandoc libgl1-mesa-glx xvfb texlive-latex-extra latexmk

- name: Install library
run: pip install .

- name: Build HTML
run: |
pip install .[doc]
make -C doc html SPHINXOPTS="-W"

- name: Generate the PDF documentation
run: |
make -C doc pdf

- name: Upload HTML documentation
uses: actions/upload-artifact@v3
with:
name: HTML-Documentation
path: doc/build/html
retention-days: 7

- name: Upload PDF Documentation
uses: actions/upload-artifact@v3
with:
name: Documentation-pdf
path: doc/build/latex/*.pdf
retention-days: 7
release:

Release:
if: contains(github.ref, 'refs/tags')
needs: [tests, style, docs]
name: "Release project to private PyPI, public PyPI and GitHub"
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: [tests]
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9

- uses: actions/checkout@v3

- uses: actions/download-artifact@v3
with:
name: ansys-pyoptics-wheel

- uses: actions/download-artifact@v3
with:
name: Documentation-pdf

- uses: actions/download-artifact@v3
with:
name: Documentation-html
path: ~/html

# list current directory
- name: List directory structure
run: ls -R

- name: Deploy
uses: JamesIves/[email protected]
with:
BRANCH: gh-pages
FOLDER: ~/html
CLEAN: true

# note how we use the PyPI tokens
- name: Upload to Azure PyPi (disabled)
run: |
pip install twine
# twine upload --skip-existing ./**/*.whl
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}

- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
./**/*.whl
./**/*.zip
./**/*.pdf
# - name: "Release to the private PyPI repository"
# uses: pyansys/actions/release-pypi-private@v1
# with:
# library-name: ${{ env.PACKAGE_NAME }}
# twine-username: "__token__"
# twine-token: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}
#
# - name: "Release to the public PyPI repository"
# uses: pyansys/actions/release-pypi-public@v1
# with:
# library-name: ${{ env.PACKAGE_NAME }}
# twine-username: "__token__"
# twine-token: ${{ secrets.PYPI_TOKEN }}
#
- name: "Release to GitHub"
uses: pyansys/actions/release-github@v1
with:
library-name: ${{ env.PACKAGE_NAME }}