Skip to content

Commit

Permalink
MAINT: Tech review (#78)
Browse files Browse the repository at this point in the history
Co-authored-by: Maxime Rey <[email protected]>
  • Loading branch information
RobPasMue and MaxJPRey authored Apr 24, 2023
1 parent 9e4421b commit 4a81c10
Show file tree
Hide file tree
Showing 43 changed files with 771 additions and 450 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[flake8]
exclude = venv, __init__.py, doc/_build
exclude = venv, .venv, __init__.py, doc/_build
select = W191, W291, W293, W391, E115, E117, E122, E124, E125, E225, E231, E301, E303, E501, F401, F403
count = True
max-complexity = 10
Expand Down
20 changes: 20 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
labels:
- "maintenance"
- "dependencies"
commit-message:
prefix: "MAINT"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
labels:
- "maintenance"
commit-message:
prefix: "MAINT"
14 changes: 14 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
documentation:
- doc/**/*
- README.rst
- CONTRIBUTING.md
maintenance:
- .github/**/*
- .flake8
- pyproject.toml
- tox.ini
- .gitignore
dependencies:
- pyproject.toml
testing:
- tests/*
35 changes: 35 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
- name: bug
description: Something isn't working
color: d42a34

- name: dependencies
description: Related with project dependencies
color: ffc0cb

- name: documentation
description: Improvements or additions to documentation
color: 0677ba

- name: enhancement
description: New features or code improvements
color: FFD827

- name: good first issue
description: Easy to solve for newcomers
color: 62ca50

- name: maintenance
description: Package and maintenance related
color: f78c37

- name: release
description: Anything related to an incoming release
color: ffffff

- name: PRIORITY
description: Issue/PR assigned with this tag must be given priority over the rest of the backlog
color: 7A1FCC

- name: testing
description: Anything related to tests
color: BFE4D6
46 changes: 0 additions & 46 deletions .github/workflows/build_documentation.yml

This file was deleted.

205 changes: 98 additions & 107 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,32 @@
name: GitHub CI
on:
pull_request:
workflow_dispatch:
push:
tags:
- "*"
branches:
- main

env:
MAIN_PYTHON_VERSION: '3.10'
PACKAGE_NAME: 'ansys-sherlock-core'
PACKAGE_NAMESPACE: 'ansys.sherlock.core'
DOCUMENTATION_CNAME: 'sherlock.docs.pyansys.com'
DOC_DEPLOYMENT_IMAGE_TAG: v23.2.0

jobs:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

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@v4
with:
python-version: 3.9

- name: Install style requirements
run: |
pip install -r requirements_style.txt --disable-pip-version-check
- name: Codespell
run: |
make codespell
continue-on-error: true

- name: flake8
run: |
make flake8
python-version: ${{ env.MAIN_PYTHON_VERSION }}

docs-style:
name: Documentation Style Check
Expand All @@ -45,115 +37,114 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}

smoke-tests:
name: Build and Smoke tests
runs-on: ${{ matrix.os }}
needs: [ style ]
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
python-version: [ '3.8', '3.9', '3.10', '3.11' ]
should-release:
- ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }}
exclude:
- should-release: false
os: macos-latest
steps:
- name: Build wheelhouse and perform smoke test
uses: pyansys/actions/build-wheelhouse@v4
with:
library-name: ${{ env.PACKAGE_NAME }}
library-namespace: ${{ env.PACKAGE_NAMESPACE }}
operating-system: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}

tests:
name: Tests and coverage
needs: [ smoke-tests ]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
python-version: ['3.8', '3.9', '3.10']
os: [ windows-latest, ubuntu-latest ]
python-version: [ '3.8', '3.9', '3.10', '3.11' ]
fail-fast: false

steps:
- uses: actions/checkout@v3

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

- name: Install dependencies
run: |
python -m pip install --upgrade pip poetry pytest
python -m pip install ansys-api-sherlock --index-url 'https://${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}@pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/simple/' --no-dependencies
- name: Install ansys-sherlock-core
run: |
pip install build
python -m build
pip install dist/ansys_sherlock-0.1.dev0-py3-none-any.whl
python -c "from ansys.sherlock import core as pysherlock; print('Successful import')"
- name: Test with pytest
# Only the tox environment specified in the tox.ini gh-actions is run
run: pytest
- name: Run pytest
uses: pyansys/actions/tests-pytest@v4
with:
python-version: ${{ matrix.python-version }}
pytest-extra-args: "--cov=ansys.sherlock --cov-report=term --cov-report=html:.cov/html --cov-report=xml:.cov/coverage.xml"

- name: Upload coverage results
uses: actions/upload-artifact@v3
if: env.MAIN_PYTHON_VERSION == matrix.python-version && 'ubuntu-latest' == matrix.os
with:
name: coverage-results
path: .cov
retention-days: 7

docs:
name: Documentation
runs-on: ubuntu-latest
needs: [ docs-style ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip flit tox
- name: Build Documentation
run: |
pip install -r requirements_docs.txt
cd doc
make html
touch build/html/.nojekyll
- name: Update HTML Documentation
uses: actions/upload-artifact@v3
with:
name: HTML-Documentation
path: doc/build/html
retention-days: 7

# - name: Deploy stable documentation
# uses: pyansys/actions/doc-deploy-stable@v3
# # The following commented condition should be uncommented when the release is public to ensure a stable user documentation.
# # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'dev')
# if: github.event_name == 'push' && contains(github.ref, 'refs/heads/main')
# with:
# doc-artifact-name: 'HTML-Documentation-tag-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}'
# decompress_artifact: true
# cname: ${{ env.DOCUMENTATION_CNAME }}
# token: ${{ secrets.GH_TOKEN }}

- name: Deploy
if: github.event_name == 'push' && contains(github.ref, 'refs/heads/main')
uses: JamesIves/[email protected]
- name: Run documentation building action
uses: pyansys/actions/doc-build@v4
with:
branch: gh-pages
folder: doc/build/html
clean: true
python-version: ${{ env.MAIN_PYTHON_VERSION }}

release:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: [ style, tests, docs ]
package:
name: Package library
needs: [ tests, docs ]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
- name: Build library source and wheel artifacts
uses: pyansys/actions/build-library@v4
with:
library-name: ${{ env.PACKAGE_NAME }}
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip build twine
- name: "Build library source and wheel artifacts"
uses: pyansys/actions/build-library@v3
with:
library-name: "ansys-sherlock"

- name: "Release to the private PyPI repository"
uses: pyansys/actions/release-pypi-private@v3

release:
name: Release project
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: [ package ]
runs-on: ubuntu-latest
steps:
- name: Release to the public PyPI repository
uses: pyansys/actions/release-pypi-public@v4
with:
library-name: "ansys-sherlock"
library-name: ${{ env.PACKAGE_NAME }}
twine-username: "__token__"
twine-token: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}
twine-token: ${{ secrets.PYPI_TOKEN }}

- name: Release to GitHub
uses: pyansys/actions/release-github@v4
with:
library-name: ${{ env.PACKAGE_NAME }}

upload_dev_docs:
name: Upload dev documentation
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: [ package ]
steps:
- name: Deploy the latest documentation
uses: pyansys/actions/doc-deploy-dev@v4
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}


upload_docs_release:
name: Upload release documentation
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs: [ release ]
steps:
- name: Deploy the stable documentation
uses: pyansys/actions/doc-deploy-stable@v4
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
python-version: ${{ env.MAIN_PYTHON_VERSION }}
Loading

0 comments on commit 4a81c10

Please sign in to comment.