Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/requirements"
directory: "/"
schedule:
interval: "daily"
labels:
Expand Down
291 changes: 91 additions & 200 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ on:

env:
MAIN_PYTHON_VERSION: '3.10'
PACKAGE_NAME: 'ansys-stk-core'
IMPORT_NAME: 'ansys.stk.core'
LIBRARY_NAME: 'ansys-stk-core'
LIBRARY_NAMESPACE: 'ansys.stk.core'
DOCUMENTATION_CNAME: 'stk.docs.pyansys.com'


concurrency:
Expand All @@ -19,230 +20,120 @@ concurrency:

jobs:

style:
name: Code style
code-style:
name: "Code style checks"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
- name: "Run code style checks"
uses: pyansys/actions/code-style@v1
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip flit tox
- name: Test with tox
run: tox -e style

doc-style:
name: Documentation style
name: "Documentation style checks"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Running Vale
uses: errata-ai/vale-action@reviewdog
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
files: doc
reporter: github-pr-check
level: error
filter_mode: nofilter
fail_on_error: true
vale_flags: "--config=doc/.vale.ini"

tests:
name: Tests
needs: [style]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
cfg:
- {python-version: "3.6", toxenv: "py36"}
- {python-version: "3.7", toxenv: "py37"}
- {python-version: "3.8", toxenv: "py38"}
- {python-version: "3.9", toxenv: "py39"}
- {python-version: "3.10", toxenv: "py310-cov"}
fail-fast: false
- name: "Run code style checks"
uses: pyansys/actions/doc-style@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

doc-build:
name: "Build project documentation"
runs-on: ubuntu-latest
needs: doc-style
steps:
- name: Clone repository
uses: actions/checkout@v3

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

- name: Install dependencies
run: |
python -m pip install --upgrade pip tox
- name: Test with tox
run: tox -e ${{ matrix.cfg.toxenv }}

- name: Install package
run: |
python -m pip install -r requirements/requirements_build.txt
python -m pip install .
- name: Store version
run: |
echo "::set-output name=PACKAGE_VERSION::$(python -c "from ${{ env.IMPORT_NAME }} import __version__; print(__version__)")"
id: version

- name: Generate wheelhouse
run: |
pip wheel . -w wheelhouse
- name: Zip wheelhouse
uses: vimtor/action-zip@v1
with:
files: wheelhouse
dest: ${{ env.PACKAGE_NAME }}-v${{ steps.version.outputs.PACKAGE_VERSION }}-wheelhouse-${{ runner.os }}-${{ matrix.cfg.python-version }}.zip

- name: Upload Wheelhouse
uses: actions/upload-artifact@v3
- name: "Building project documentation"
uses: pyansys/actions/doc-build@v1
with:
name: ${{ env.PACKAGE_NAME }}-v${{ steps.version.outputs.PACKAGE_VERSION }}-wheelhouse-${{ runner.os }}-${{ matrix.cfg.python-version }}
path: '*.zip'
retention-days: 7
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- name: Upload coverage results as artifacts
uses: actions/upload-artifact@v3
if: |
(matrix.cfg.python-version == env.MAIN_PYTHON_VERSION) &&
(runner.os == 'Linux')
doc-deploy-dev:
name: "Deploy developers documentation"
runs-on: ubuntu-latest
if: github.event_name == 'push' && contains(github.ref, 'refs/heads/main')
needs: doc-build
steps:
- name: "Deploy development documentation"
uses: pyansys/actions/doc-deploy-dev@v1
with:
name: HTML-Coverage
path: .cov/html
retention-days: 7
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}

docs:
name: Documentation
doc-deploy-stable:
name: "Deploy stable documentation"
runs-on: ubuntu-latest
needs: [doc-style]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: doc-deploy-dev
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
- name: "Deploy stable documentation"
uses: pyansys/actions/doc-deploy-stable@v1
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install pandoc
python -m pip install --upgrade pip tox
- name: Generate the documentation with tox
run: |
tox -e doc
- name: Upload documentation as artifact
uses: actions/upload-artifact@v3
with:
name: HTML-Documentation
path: .tox/doc_out
retention-days: 7
tests:
name: "Test Python ${{ matrix.cfg.python-version }} in ${{ matrix.os }} "
runs-on: ${{ matrix.os }}
needs: code-style
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
cfg:
- {python-version: '3.7', extra-args: ''}
- {python-version: '3.8', extra-args: ''}
- {python-version: '3.9', extra-args: ''}
- {python-version: '3.10', extra-args: '--cov=ansys.stk --cov-report=term --cov-report=html:.cov/html'}

build:
name: Build library
needs: [tests, docs]
runs-on: ubuntu-latest
fail-fast: false
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
- name: "Run test suite with pytest"
uses: pyansys/actions/tests-pytest@v1
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- name: Install dependencies and build the library
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements/requirements_build.txt
python -m build
python -m twine check dist/*
python-version: ${{ matrix.cfg.python-version }}
pytest-extra-args: ${{ matrix.cfg.extra-args }}

- name: Upload wheel and binaries as artifacts
- name: "Upload coverage results"
uses: actions/upload-artifact@v3
if: matrix.cfg.python-version == env.MAIN_PYTHON_VERSION && matrix.os == 'ubuntu-latest'
with:
name: ${{ env.PACKAGE_NAME }}-packages
path: dist/
name: coverage-html
path: .cov/html
retention-days: 7

release_pkg:
name: Release project
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- uses: actions/download-artifact@v3

- name: Display structure of downloaded files
run: ls --recursive

# TODO: Explicit state which files are pushed to private PyPI
# - name: Upload to private PyPi
# run: |
# pip install twine
# python -m twine upload --skip-existing ./**/*.whl
# python -m twine upload --skip-existing ./**/*.tar.gz
# env:
# TWINE_USERNAME: PAT
# TWINE_PASSWORD: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}
# TWINE_REPOSITORY_URL: https://pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/upload

# TODO: Explicit state which files are released in GitHub
# - name: Release in GitHub
# uses: softprops/action-gh-release@v1
# with:
# files: |
# ./**/*.whl
# ./**/*.tar.gz
# ./**/*.zip

release_docs:
name: Release documentation
if: (github.event_name == 'push' && contains(github.ref, 'refs/tags')) || (github.ref == 'refs/heads/main')
build-library:
name: "Build library artifacts"
runs-on: ubuntu-latest
needs: [build]
needs: [doc-deploy-stable, tests]
steps:
- uses: actions/checkout@v3

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

- name: Get Bot Application Token
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v2
with:
application_id: ${{ secrets.BOT_APPLICATION_ID }}
application_private_key: ${{ secrets.BOT_APPLICATION_PRIVATE_KEY }}

- name: Deploy documentation to pystk-dev-docs repository
if: github.ref == 'refs/heads/main'
uses: JamesIves/github-pages-deploy-action@v4.4.1
with:
repository-name: pyansys/pystk-dev-docs
token: ${{ steps.get_workflow_token.outputs.token }}
branch: gh-pages
folder: HTML-Documentation
clean: true
single-commit: true

- name: Deploy documentation to pystk-docs repository
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
uses: JamesIves/github-pages-deploy-action@v4.4.1
- name: "Build library source and wheel artifacts"
uses: pyansys/actions/build-library@v1
with:
repository-name: pyansys/pystk-docs
token: ${{ steps.get_workflow_token.outputs.token }}
branch: gh-pages
folder: HTML-Documentation
clean: true
single-commit: true
library-name: ${{ env.LIBRARY_NAME }}

# release:
# name: "Release to private and public PyPI and to GitHub"
# if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
# runs-on: ubuntu-latest
# needs: [build-library]
# steps:

# - name: "Release to the private PyPI repository"
# uses: pyansys/actions/release-pypi-private@v1
# with:
# library-name: ${{ env.LIBRARY_NAME }}
# twine-username: "__token__"
# twine-token: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}

# - name: "Release to the public PyPI repository"
# uses: pyansys/actions/release-pypi-public@main
# with:
# library-name: ${{ env.LIBRARY_NAME }}
# twine-username: "__token__"
# twine-token: ${{ secrets.PYPI_TOKEN }}

# - name: "Release to GitHub"
# uses: pyansys/actions/release-github@main
# with:
# library-name: ${{ env.LIBRARY_NAME }}
8 changes: 7 additions & 1 deletion doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ help:

# Customized clean due to examples gallery
clean:
rm -rf $(BUILDDIR)/*
rm -rf $(BUILDDIR)
rm -rf $(SOURCEDIR)/examples
find . -type d -name "_autosummary" -exec rm -rf {} +

# Customized pdf fov svg format images
pdf:
@$(SPHINXBUILD) -M latex "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
cd $(BUILDDIR)/latex && latexmk -r latexmkrc -pdf *.tex -interaction=nonstopmode || true
(test -f $(BUILDDIR)/latex/*.pdf && echo pdf exists) || exit 1
12 changes: 10 additions & 2 deletions doc/make.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@ECHO OFF
@echo OFF
setlocal

pushd %~dp0

Expand All @@ -12,6 +13,7 @@ set BUILDDIR=_build

if "%1" == "" goto help
if "%1" == "clean" goto clean
if "%1" == "pdf" goto pdf

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
Expand All @@ -30,12 +32,18 @@ if errorlevel 9009 (
goto end

:clean
rmdir /s /q %BUILDDIR% > /NUL 2>&1
rmdir /s /q %BUILDDIR% > /NUL 2>&1
for /d /r %SOURCEDIR% %%d in (_autosummary) do @if exist "%%d" rmdir /s /q "%%d"
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:pdf
%SPHINXBUILD% -M latex %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
cd "%BUILDDIR%\latex"
for %%f in (*.tex) do (
pdflatex "%%f" --interaction=nonstopmode)

:end
popd
Loading