Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve backend #3

Merged
merged 6 commits into from
Jan 29, 2024
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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.github/* @Samuelopez-ansys @gmalinve @SMoraisAnsys
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"
8 changes: 8 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
documentation:
- doc/source/**/*
maintenance:
- .github/**/*
- .flake8
- pyproject.toml
dependencies:
- requirements/*
27 changes: 27 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
- 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
191 changes: 191 additions & 0 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
name: "CI"
on:
pull_request:
push:
tags:
- "v*.*.*"
branches:
- main
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'

env:
MAIN_PYTHON_VERSION: '3.10'
DOCUMENTATION_CNAME: 'aedt.common.toolkit.docs.pyansys.com'
LIBRARY_NAME: 'ansys-aedt-toolkits-common'
LIBRARY_NAMESPACE: 'ansys.aedt.toolkits.common'
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}

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@v4
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
use-python-cache: false

doc-style:
name: "Documentation style"
runs-on: ubuntu-latest
steps:
- uses: ansys/actions/doc-style@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

doc-build:
name: "Build documentation"
runs-on: ubuntu-latest
needs: doc-style
steps:
- uses: ansys/actions/doc-build@v4
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
check-links: false

smoke-tests:
name: "Build and Smoke tests"
strategy:
fail-fast: false
matrix:
os: [ windows-latest, ubuntu-latest ]
python-version: [ '3.8', '3.10' ]
runs-on: ${{ matrix.os }}
needs: [ code-style ]
steps:
- uses: ansys/actions/build-wheelhouse@v4
with:
library-name: ${{ env.LIBRARY_NAME }}
operating-system: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}

tests_windows_aedt:
name: "Windows Tests AEDT"
strategy:
matrix:
python-version: [ '3.8', '3.10' ]
fail-fast: false
runs-on: [self-hosted, pyaedt, toolkits, Windows]
needs: [smoke-tests]
steps:
- uses: actions/checkout@v4

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

- name: Create Python venv
run: |
python -m venv .venv
.\.venv\Scripts\Activate.ps1

- name: Install packages for testing
run: |
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
pip install --upgrade build wheel
pip install .[tests]
env:
ANSYSLMD_LICENSE_FILE: 1055@${{ secrets.LICENSE_SERVER }}

- name: Test AEDT common
timeout-minutes: 5
run: |
.\.venv\Scripts\Activate.ps1
pytest -v -m aedt_common --cov

- name: AEDT Test
timeout-minutes: 5
run: |
.\.venv\Scripts\Activate.ps1
pytest -v -m aedt --cov --cov-append

- name: "Combine coverage files"
run: |
.\.venv\Scripts\Activate.ps1
python -m coverage html -d .cov\total-html
python -m coverage xml -o .cov\total.xml

- name: "Upload coverage results"
if: ${{ matrix.python-version == env.MAIN_PYTHON_VERSION }}
uses: actions/upload-artifact@v3
with:
path: .cov/total-html
name: html-total-coverage

- name: "Upload coverage report to codecov"
if: ${{ matrix.python-version == env.MAIN_PYTHON_VERSION }}
uses: codecov/codecov-action@v3
with:
file: .cov/total.xml
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

build-library:
name: "Build library artifacts"
runs-on: ubuntu-latest
needs: [ doc-build, tests_windows_aedt ]
steps:
- uses: ansys/actions/build-library@v4
with:
library-name: ${{ env.LIBRARY_NAME }}
python-version: ${{ env.MAIN_PYTHON_VERSION }}

release:
name: "Release"
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: build-library
runs-on: ubuntu-latest
steps:

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

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

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

doc-deploy-dev:
name: "Deploy development documentation"
runs-on: ubuntu-latest
needs: build-library
if: github.event_name == 'push'
steps:
- uses: ansys/actions/doc-deploy-dev@v4
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}

doc-deploy-stable:
name: "Deploy stable documentation"
runs-on: ubuntu-latest
needs: release
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
steps:
- uses: ansys/actions/doc-deploy-stable@v4
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
85 changes: 85 additions & 0 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Labeler
on:
pull_request:
push:
branches: [ main ]
paths:
- '../labels.yml'

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

jobs:

label-syncer:
name: Syncer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: micnncim/action-label-syncer@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

labeler:
name: Set labels
needs: [label-syncer]
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:

# Label based on modified files
- name: Label based on changed files
uses: actions/labeler@v4
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
sync-labels: ''

# Label based on branch name
- uses: actions-ecosystem/action-add-labels@v1
if: |
startsWith(github.event.pull_request.head.ref, 'doc') ||
startsWith(github.event.pull_request.head.ref, 'docs')
with:
labels: documentation

- uses: actions-ecosystem/action-add-labels@v1
if: |
startsWith(github.event.pull_request.head.ref, 'maint') ||
startsWith(github.event.pull_request.head.ref, 'no-ci') ||
startsWith(github.event.pull_request.head.ref, 'ci')
with:
labels: maintenance

- uses: actions-ecosystem/action-add-labels@v1
if: startsWith(github.event.pull_request.head.ref, 'feat')
with:
labels: |
enhancement

- uses: actions-ecosystem/action-add-labels@v1
if: |
startsWith(github.event.pull_request.head.ref, 'fix') ||
startsWith(github.event.pull_request.head.ref, 'patch')
with:
labels: bug

commenter:
runs-on: ubuntu-latest
steps:
- name: Suggest to add labels
uses: peter-evans/create-or-update-comment@v3
# Execute only when no labels have been applied to the pull request
if: toJSON(github.event.pull_request.labels.*.name) == '{}'
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
Please add one of the following labels to add this contribution to the Release Notes :point_down:
- [bug](https://github.com/pyansys/pyaedt-toolkits.git/pulls?q=label%3Abug+)
- [documentation](https://github.com/pyansys/pyaedt-toolkits.git/pulls?q=label%3Adocumentation+)
- [enhancement](https://github.com/pyansys/pyaedt-toolkits.git/pulls?q=label%3Aenhancement+)
- [good first issue](https://github.com/pyansys/pyaedt-toolkits.git/pulls?q=label%3Agood+first+issue)
- [maintenance](https://github.com/pyansys/pyaedt-toolkits.git/pulls?q=label%3Amaintenance+)
- [release](https://github.com/pyansys/pyaedt-toolkits.git/pulls?q=label%3Arelease+)
10 changes: 6 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ share/python-wheels/
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# Usually these files are written by a python script from a motor
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
Expand Down Expand Up @@ -75,7 +75,6 @@ instance/

# Sphinx documentation
doc/_build/
_autosummary

# PyBuilder
.pybuilder/
Expand Down Expand Up @@ -153,13 +152,16 @@ cython_debug/
# vscode
.vscode

batch.log

# PyCharm
# JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
# JetBrains specific motor is maintainted in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# End of https://www.toptal.com/developers/gitignore/api/python

.idea/
.idea/
.venv/
Loading
Loading