Skip to content

[pre-commit.ci] pre-commit autoupdate #648

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #648

name: Actions
# repo specific gh actions
env:
SHELLOPTS: 'errexit:pipefail'
PACKAGE_NAME: ansys-mapdl-reader
PYVISTA_OFF_SCREEN: true
PYMAPDL_PORT: 21000 # default won't work on GitHub runners
PYMAPDL_DB_PORT: 21001 # default won't work on GitHub runners
PYMAPDL_START_INSTANCE: FALSE
DOCKER_PACKAGE: ghcr.io/pyansys/pymapdl/mapdl
DOCUMENTATION_CNAME: reader.docs.pyansys.com
on:
pull_request:
push:
tags:
- "*"
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
doc_build:
name: Build documentation
runs-on: ubuntu-latest
steps:
- name: Setup headless display
uses: pyvista/setup-headless-display-action@v2
- name: Build project documentation
uses: ansys/actions/[email protected]
with:
dependencies: 'pandoc'
skip-dependencies-cache: true
use-python-cache: false
python-version: "3.10"
doc-deploy-dev:
name: Upload development documentation
runs-on: ubuntu-latest
needs: [doc_build]
if: github.ref == 'refs/heads/main'
steps:
- uses: ansys/actions/doc-deploy-dev@v4
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
build:
name: Build and Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'requirements/*.txt'
- name: Build ManyLinux wheel
if: ${{ runner.os == 'Linux' }}
run: |
docker run \
--rm -v `pwd`:/io \
quay.io/pypa/manylinux2014_x86_64 \
/io/.ci/build_wheels.sh ${{ matrix.python-version }}
- name: Build wheel on Windows
if: ${{ runner.os == 'Windows' }}
run: |
pip install build
python -m build
- name: Validate wheel
run: |
pip install twine
twine check dist/*
- name: Install on Linux
if: ${{ runner.os == 'Linux' }}
run: |
pip install wheel
pip install dist/*.whl
pip list
- name: Install on Windows Powershell
if: ${{ runner.os == 'Windows' }}
run: |
pip install wheel
pip install (get-item .\dist\*.whl)
pip list
- name: Setup headless display
uses: pyvista/setup-headless-display-action@v2
- name: Install test requirements
run: pip install -r requirements/requirements_test.txt
- name: Test
run: pytest -v tests/ --durations=0
- uses: codecov/codecov-action@v3
if: ${{ runner.os == 'Linux' && matrix.python-version == '3.9' }}
name: 'Upload coverage to Codecov'
- name: Upload wheel
uses: actions/upload-artifact@v3
with:
name: ${{ env.PACKAGE_NAME }}-${{ runner.os }}-${{ matrix.python-version }}
path: dist/
retention-days: 7
mac_build:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
name: Build wheels on MacOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/[email protected]
- name: List generated wheels
run: |
ls ./wheelhouse/*
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
# pymapdl_tests:
# name: PyMAPDL Unit Testing
# runs-on: ubuntu-latest
# needs: build
# strategy:
# matrix:
# mapdl-version: ['v21.1.1', 'v21.2.1', 'v22.1.0']
# steps:
# - name: Checkout PyMAPDL
# uses: actions/checkout@v4
# with:
# repository: 'pyansys/pymapdl' #checking out main. Not release
# - name: Display structure of downloaded PyMAPDL files
# run: ls -R
# - name: Downloading artifacts
# uses: actions/download-artifact@v3
# - name: Display structure of downloaded artifact files
# run: ls -R
# - name: Setup Python
# uses: actions/setup-python@v2
# with:
# python-version: 3.8
# - name: Install OS packages
# run: |
# sudo apt update
# sudo apt install libgl1-mesa-glx xvfb
# - name: Linux pip cache
# uses: actions/cache@v3
# with:
# path: ~/.cache/pip
# key: Python-${{ runner.os }}-3.8-${{ hashFiles('setup.py') }}-${{ hashFiles('requirements_*.txt') }}
# restore-keys: |
# Python-${{ runner.os }}-3.8
# - name: Test virtual framebuffer
# run: |
# pip install -r .ci/requirements_test_xvfb.txt
# xvfb-run python .ci/display_test.py
# - name: Install ansys-mapdl-core
# run: |
# python -m pip install --upgrade pip
# pip install .
# xvfb-run python -c "from ansys.mapdl import core as pymapdl; print(pymapdl.Report())"
# - name: Install ansys-mapdl-reader
# run: |
# pip install ansys-mapdl-reader-${{ runner.os }}-3.8/*.whl
# xvfb-run python -c "from ansys.mapdl import reader as pymapdl_reader; print(pymapdl_reader); print('Installation and smoke test correct')"
# - name: Login in Github Container registry
# uses: docker/login-action@v1
# with:
# registry: ghcr.io
# username: ${{ secrets.GH_USERNAME }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Pull, launch, and validate MAPDL service
# run: .ci/start_mapdl.sh
# env:
# LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
# MAPDL_IMAGE: ${{ env.DOCKER_PACKAGE }}:${{ matrix.mapdl-version }}
# - name: Unit Testing
# run: |
# pip install -r requirements/requirements_tests.txt
# xvfb-run pytest -v
# - name: Display MAPDL Logs
# if: always()
# run: cat log.txt
Release:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: [doc_build, build, mac_build]
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
# this downloads all artifacts
- uses: actions/download-artifact@v3
- name: Display structure of downloaded files
run: ls -R
- name: Compressing HTML documentation
uses: vimtor/[email protected]
with:
files: documentation-html
dest: documentation-html.zip
- name: Upload to Public PyPi
run: |
pip install twine
twine upload --skip-existing ./**/*.whl
twine upload --skip-existing ./**/*.tar.gz
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
- name: Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
files: |
./**/*.whl
./**/*.zip
./**/*.pdf
doc-deploy-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: ansys/actions/doc-deploy-stable@v4
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}