Skip to content

D335: Open sourcing process: use ansys-api-edb #807

D335: Open sourcing process: use ansys-api-edb

D335: Open sourcing process: use ansys-api-edb #807

Workflow file for this run

name: GitHub CI
on:
pull_request:
push:
tags:
- '*'
branches:
- develop
- release-*
workflow_dispatch:
env:
DOCUMENTATION_CNAME: 'edb.core.docs.pyansys.com'
MAIN_PYTHON_VERSION: '3.10'
PIP_EXTRA_INDEX_URL: 'https://${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}@pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/simple/'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
style:
name: Code style
runs-on: ubuntu-latest
steps:
- name: PyAnsys code style checks
uses: ansys/actions/code-style@v4
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
doc-style:
name: Documentation Style Check
runs-on: ubuntu-latest
steps:
- name: PyAnsys documentation style checks
uses: ansys/actions/doc-style@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
tests:
name: Tests and coverage
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
python-version: ['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 .[tests]
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
# 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.8
- name: Install dependencies
run: |
python -m pip install --upgrade .[doc] tox
- 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.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip flit twine
- 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.8
- 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