T237 SI Setup notebook example #770
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: GitHub CI | |
on: | |
pull_request: | |
push: | |
tags: | |
- '*' | |
branches: | |
- develop | |
- release-* | |
workflow_dispatch: | |
env: | |
DOCUMENTATION_CNAME: 'edb.docs.pyansys.com' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
style: | |
name: Code style | |
runs-on: ubuntu-latest | |
steps: | |
- uses: ansys/actions/code-style@v4 | |
with: | |
python-version: 3.7 | |
tests: | |
name: Tests and coverage | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-latest, ubuntu-latest] | |
python-version: ['3.7', '3.8', '3.9', '3.10'] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade -r requirements/requirements_tox.txt | |
python -m pip install --upgrade tox-gh-actions | |
- name: Test with tox | |
# Only the tox environment specified in the tox.ini gh-actions is run | |
run: tox -e test -- --ignore=tests/e2e | |
doc-style: | |
name: Documentation | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Check documentation style" | |
uses: ansys/actions/doc-style@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# TODO: convert to ansys/actions/doc-build | |
doc-build: | |
name: Build documentation | |
runs-on: ubuntu-latest | |
needs: [doc-style] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.7 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade -r requirements/requirements_tox.txt | |
- name: Generate the documentation with tox | |
run: tox -e doc | |
- name: Upload HTML Documentation | |
uses: actions/upload-artifact@v2 | |
with: | |
name: HTML-Documentation | |
path: .tox/doc_out | |
retention-days: 7 | |
build: | |
name: Build library | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.7 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip flit | |
python -m pip install -r protos/requirements/requirements_build.txt | |
python -m pip install -r requirements/requirements_build.txt | |
- name: Build API | |
run: | | |
cd protos | |
python setup.py develop | |
python setup.py bdist_wheel | |
cp -a dist/. ../dist/ | |
- name: Build Core | |
run: | | |
flit build | |
- name: Validate libraries | |
run: | | |
python -m twine check dist/* | |
- name: Zip libraries | |
run: | | |
cd dist | |
zip -r pyedb.zip * | |
- name: Upload develop libraries | |
if: github.event_name == 'push' && (github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/release-') || contains(github.ref, 'refs/tags')) | |
uses: actions/upload-artifact@v2 | |
with: | |
name: pyedb | |
path: dist/pyedb.zip | |
retention-days: 14 | |
release: | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags') | |
needs: [build, tests, doc-build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Python | |
uses: actions/[email protected] | |
with: | |
python-version: 3.7 | |
- uses: actions/checkout@v2 | |
- uses: actions/download-artifact@v3 | |
- name: Display structure of downloaded files | |
run: ls -R | |
- name: Generate release notes | |
uses: docker://pandoc/core:2.9 | |
with: | |
args: --output=release_notes.md doc/source/api/release_notes.rst | |
- name: Publish release | |
uses: softprops/action-gh-release@v1 | |
with: | |
body_path: release_notes.md | |
files: ./**/pyedb.zip | |
token: ${{ secrets.PYANSYS_PYEDB_BOT_TOKEN }} | |
prerelease: true | |
- name: Notify Success | |
uses: skitionek/notify-microsoft-teams@master | |
if: success() | |
with: | |
webhook_url: ${{ secrets.MS_TEAMS_PUBLIC }} | |
needs: ${{ toJson(needs) }} | |
job: ${{ toJson(job) }} | |
steps: ${{ toJson(steps) }} | |
overwrite: "{ | |
title: `New release has been published at https://github.com/ansys/pyedb/releases`, | |
}" | |
- name: Notify Failure | |
uses: skitionek/notify-microsoft-teams@master | |
if: failure() | |
with: | |
webhook_url: ${{ secrets.MS_TEAMS_DEV }} | |
needs: ${{ toJson(needs) }} | |
job: ${{ toJson(job) }} | |
steps: ${{ toJson(steps) }} | |
overwrite: "{ | |
title: `Release FAILED!`, | |
}" | |
doc-deploy-dev: | |
name: "Deploy development documentation" | |
# Deploy development only when merging or pushing to the 'main' branch | |
if: github.event_name == 'push' && !contains(github.ref, 'refs/tags') | |
runs-on: ubuntu-latest | |
needs: [doc-build, build] | |
steps: | |
- uses: ansys/actions/doc-deploy-dev@v4 | |
with: | |
cname: ${{ env.DOCUMENTATION_CNAME }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
doc-artifact-name: HTML-Documentation | |
doc-deploy-stable: | |
name: "Deploy stable documentation" | |
# Deploy release documentation when creating a new tag | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags') | |
runs-on: ubuntu-latest | |
needs: release | |
steps: | |
- uses: ansys/actions/doc-deploy-stable@v4 | |
with: | |
cname: ${{ env.DOCUMENTATION_CNAME }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
doc-artifact-name: HTML-Documentation | |