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

Use Trusted Publisher Workflow #223

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
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
119 changes: 37 additions & 82 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,51 +13,33 @@ env:
MAPDL_DOCKER_PACKAGE: 'ghcr.io/ansys/pymapdl/mapdl'
MAPDL_DOCKER_VERSION: 'v23.1.0'
DOCUMENTATION_CNAME: "manager.materials.docs.pyansys.com"
PACKAGE_NAME: "ansys-materials-manager"

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

jobs:

style:
name: Code style
code-style:
name: "Running code style checks"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip poetry tox
poetry config installer.modern-installation false
- name: Test with tox
run: tox -e style
- name: "Run PyAnsys code style checks"
uses: ansys/actions/[email protected]

docs-style:
name: Documentation Style Check
doc-style:
name: "Running documentation style checks"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Running Vale
uses: errata-ai/vale-action@reviewdog
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: "Running documentation style checks"
uses: ansys/actions/[email protected]
with:
files: doc
reporter: github-pr-check
level: error
filter_mode: nofilter
fail_on_error: true
vale_flags: "--config=doc/.vale.ini"
token: ${{ secrets.GITHUB_TOKEN }}

smoke-tests:
name: Build and Smoke tests
runs-on: ${{ matrix.os }}
needs: [style]
needs: [ code-style ]
strategy:
fail-fast: false
matrix:
Expand All @@ -68,15 +50,14 @@ jobs:
- name: Build wheelhouse and perform smoke test
uses: ansys/actions/build-wheelhouse@v6
with:
library-name: "ansys-materials-manager"
library-namespace: "ansys.materials.manager"
library-name: ${{ env.PACKAGE_NAME }}
operating-system: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}

tests:
name: Tests and coverage
runs-on: ${{ matrix.os }}
needs: [smoke-tests]
needs: [ smoke-tests ]
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
Expand Down Expand Up @@ -106,7 +87,7 @@ jobs:
mapdl-integration-tests:
name: Integration tests with MAPDL
runs-on: ubuntu-latest
needs: style
needs: [ code-style ]
if: ${{ github.actor != 'dependabot[bot]' }}
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -185,34 +166,19 @@ jobs:
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
docs:
name: Documentation

doc-build:
name: "Building library documentation"
runs-on: ubuntu-latest
needs: docs-style
needs: doc-style
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip poetry tox
poetry config installer.modern-installation false
- name: Generate the documentation with tox
run: tox -e doc

- name: Upload HTML Documentation
uses: actions/upload-artifact@v4
with:
name: documentation-html
path: .tox/doc_out/
retention-days: 7
- name: "Run Ansys documentation building action"
uses: ansys/actions/[email protected]

build:
name: Build library
runs-on: ubuntu-latest
needs: [docs, tests, mapdl-integration-tests]
needs: [ doc-build, tests, mapdl-integration-tests ]
steps:
- uses: actions/checkout@v4
- name: Set up Python
Expand All @@ -229,14 +195,15 @@ jobs:
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }}-artifacts
path: dist/
retention-days: 7

upload_dev_docs:
name: Upload dev documentation
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: [build]
needs: [ build ]
steps:
- name: Deploy the latest documentation
uses: ansys/actions/doc-deploy-dev@v6
Expand All @@ -246,43 +213,31 @@ jobs:
doc-artifact-name: "documentation-html"

release:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: build
name: Release project
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }}
needs: [ build ]
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
contents: write
steps:
- name: Set up Python
uses: actions/setup-python@v5
- name: Release to the public PyPI repository
uses: ansys/actions/release-pypi-public@v6
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- uses: actions/checkout@v4
- uses: actions/download-artifact@v4

- name: List directory structure
run: ls -R
library-name: ${{ env.PACKAGE_NAME }}
da1910 marked this conversation as resolved.
Show resolved Hide resolved
use-trusted-publisher: true

- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python -m pip install --upgrade pip twine
python -m twine upload --skip-existing ./**/*.whl
python -m twine upload --skip-existing ./**/*.tar.gz

- name: Release to GitHub
uses: softprops/action-gh-release@v2
uses: ansys/actions/release-github@v6
with:
files: |
./**/*.whl
./**/*.zip
./**/*.tar.gz
library-name: ${{ env.PACKAGE_NAME }}

upload_docs_release:
name: "Upload release documentation"
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs: [release]
needs: [ release ]
steps:
- name: Deploy the stable documentation
uses: ansys/actions/doc-deploy-stable@v6
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ repos:
rev: v2.2.2
hooks:
- id: codespell
args: ["--ignore-words", "doc/styles/config/vocabularies/ANSYS/accept.txt"]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
Expand Down
1 change: 1 addition & 0 deletions doc/.vale.ini
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ Vocab = ANSYS

# Apply the following styles
BasedOnStyles = Vale, Google
Vale.Terms = NO
7 changes: 0 additions & 7 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
extensions = [
"sphinx.ext.autodoc",
"autoapi.extension",
"sphinx.ext.autosummary",
"numpydoc",
"sphinx.ext.intersphinx",
"sphinx_copybutton",
Expand Down Expand Up @@ -83,9 +82,6 @@
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

# The suffix(es) of source filenames.
source_suffix = ".rst"

# The master toctree document.
master_doc = "index"

Expand All @@ -97,9 +93,6 @@
".md": "markdown",
}

# The master toctree document.
master_doc = "index"

# Configuration for Sphinx autoapi
autoapi_type = "python"
autoapi_dirs = ["../../src/ansys"]
Expand Down
2 changes: 1 addition & 1 deletion doc/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Adhere to code style

PyMaterials Manager follows the PEP8 standard as outlined in the `PyAnsys Development Guide
<dev_guide_pyansys_>`_ and implements style checking using
`pre-commit <precommit_>`_.
`pre-commit`_.

To ensure your code meets minimum code styling standards, run this code::

Expand Down
4 changes: 0 additions & 4 deletions doc/styles/.gitignore

This file was deleted.

Loading
Loading