ci: prepare deployment #113
Workflow file for this run
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: | |
- main | |
- sync/* | |
workflow_dispatch: | |
env: | |
MAIN_PYTHON_VERSION: '3.10' | |
PYTHON_VERSION: '3.10' | |
LIBRARY_NAME: 'ansys-scadeone-core' | |
DOCUMENTATION_CNAME: 'scadeone.docs.pyansys.com' | |
PACKAGE_NAMESPACE: 'ansys.scadeone.core' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
code-style: | |
name: Code style | |
runs-on: ubuntu-latest | |
steps: | |
- uses: ansys/actions/code-style@v8 | |
with: | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
doc-style: | |
name: Doc style | |
runs-on: ubuntu-latest | |
steps: | |
- uses: ansys/actions/doc-style@v8 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
doc-build: | |
name: Doc building | |
needs: [doc-style] | |
runs-on: [windows-latest] | |
steps: | |
- uses: ansys/actions/doc-build@v8 | |
with: | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
sphinxopts: -j auto -W | |
add-pdf-html-docs-as-assets: false | |
smoke-test: | |
name: Smoke test | |
needs: code-style | |
runs-on: [ubuntu-latest] | |
steps: | |
- uses: ansys/actions/tests-pytest@v8 | |
with: | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
pytest-postargs: 'tests/test_smoke.py' | |
build-library: | |
name: Build | |
if: ${{ !contains(github.event.pull_request.title, '[skip tests]') }} | |
needs: [smoke-test, doc-build] | |
runs-on: [ubuntu-latest] | |
steps: | |
- uses: ansys/actions/build-library@v8 | |
with: | |
library-name: ${{ env.LIBRARY_NAME }} | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
doc-deploy-dev: | |
name: "Deploy development documentation" | |
# Deploy development only when merging or pushing to the 'main' branch | |
runs-on: ubuntu-latest | |
needs: [build-library] | |
if: github.event_name == 'push' && !contains(github.ref, 'refs/tags') | |
steps: | |
- uses: ansys/actions/doc-deploy-dev@v8 | |
with: | |
doc-artifact-name: 'documentation-html' | |
cname: ${{ env.DOCUMENTATION_CNAME }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} | |
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} | |
release: | |
name: "Release project" | |
runs-on: ubuntu-latest | |
needs: [build-library] | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags') | |
steps: | |
- name: "Release to public PyPI" | |
uses: ansys/actions/release-pypi-public@v8 | |
with: | |
library-name: ${{ env.LIBRARY_NAME }} | |
twine-username: "__token__" | |
twine-token: ${{ secrets.PYPI_TOKEN }} | |
- name: "Release to GitHub" | |
uses: ansys/actions/release-github@v8 | |
with: | |
library-name: ${{ env.LIBRARY_NAME }} | |
additional-artifacts: 'examples' | |
doc-deploy-stable: | |
name: "Deploy stable documentation" | |
# Deploy release documentation when creating a new tag | |
runs-on: ubuntu-latest | |
needs: [release] | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags') | |
steps: | |
- uses: ansys/actions/doc-deploy-stable@v8 | |
with: | |
doc-artifact-name: 'documentation-html' | |
cname: ${{ env.DOCUMENTATION_CNAME }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} | |
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} |