Fixing DynamicScrapper #1335
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# check spelling, codestyle | |
name: GitHub CI | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
tags: | |
- "*" | |
branches: | |
- main | |
env: | |
MAIN_PYTHON_VERSION: '3.10' | |
PACKAGE_NAME: 'ansys-math-core' | |
PACKAGE_NAMESPACE: 'ansys.math.core' | |
DOCKER_PACKAGE: ghcr.io/ansys/mapdl | |
DOCKER_IMAGE_VERSION_DOCS_BUILD: v23.1.0 | |
DOCUMENTATION_CNAME: 'math.docs.pyansys.com' | |
PYMAPDL_START_INSTANCE: FALSE | |
PYMAPDL_PORT: 21000 # default won't work on GitHub runners | |
PYMAPDL_DB_PORT: 21001 # default won't work on GitHub runners | |
RESET_PIP_CACHE: 0 | |
RESET_AUTOSUMMARY_CACHE: 0 | |
RESET_EXAMPLES_CACHE: 0 | |
RESET_DOC_BUILD_CACHE: 0 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
code-style: | |
name: "Code style" | |
runs-on: ubuntu-latest | |
steps: | |
- name: PyAnsys code style checks | |
uses: ansys/actions/code-style@v5 | |
with: | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
doc-style: | |
name: "Documentation Style Check" | |
runs-on: ubuntu-latest | |
steps: | |
- name: "PyAnsys documentation style checks" | |
uses: ansys/actions/doc-style@v5 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
smoke-tests: | |
name: "Build and Smoke tests" | |
runs-on: ${{ matrix.os }} | |
needs: [code-style] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: ['3.8', '3.9', '3.10', '3.11'] | |
# Only perform wheelhouse builds for Windows and macOS when releasing | |
should-release: | |
- ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }} | |
exclude: | |
- should-release: false | |
os: macos-latest | |
- should-release: false | |
os: windows-latest | |
steps: | |
- name: "Build wheelhouse and perform smoke test" | |
uses: ansys/actions/build-wheelhouse@v5 | |
with: | |
library-name: ${{ env.PACKAGE_NAME }} | |
library-namespace: ${{ env.PACKAGE_NAMESPACE }} | |
operating-system: ${{ matrix.os }} | |
python-version: ${{ matrix.python-version }} | |
build-test: | |
name: "Build and unit testing" | |
runs-on: ubuntu-latest | |
needs: [smoke-tests] | |
strategy: | |
matrix: | |
mapdl-version: ['v23.1.0', 'v23.2.0', 'v24.1.0'] | |
steps: | |
- name: "Install Git and checkout project" | |
uses: actions/checkout@v4 | |
- name: "Setup Python" | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
- name: "Install OS packages" | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y pandoc xvfb libgl1-mesa-glx | |
- name: "Cache pip" | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: Python-v${{ env.RESET_PIP_CACHE }}-${{ runner.os }}-${{ matrix.mapdl-version }}-${{ hashFiles('pyproject.toml') }} | |
restore-keys: | | |
Python-v${{ env.RESET_PIP_CACHE }}-${{ runner.os }}-${{ matrix.mapdl-version }} | |
- name: "Install ansys-mapdl-core" | |
run: | | |
python -m pip install ansys-mapdl-core | |
- name: "Login in Github container registry" | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.GH_USERNAME }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Pull, launch, and validate MAPDL service" | |
run: .ci/start_mapdl.sh | |
if: ${{ !contains( matrix.mapdl-version, 'ubuntu') }} | |
env: | |
LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }} | |
MAPDL_IMAGE: ${{ env.DOCKER_PACKAGE }}:${{ matrix.mapdl-version }} | |
- name: "Pull, launch, and validate Ubuntu MAPDL service from private" | |
run: .ci/start_mapdl_ubuntu.sh | |
if: ${{ contains( matrix.mapdl-version, 'ubuntu') }} | |
env: | |
LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }} | |
MAPDL_IMAGE: ${{ env.DOCKER_PACKAGE }}:${{ matrix.mapdl-version }} | |
- name: "Unit testing requirements installation" | |
run: | | |
python -m pip install .[tests] | |
- name: "Unit testing" | |
run: | | |
pytest -v --durations=10 --maxfail=10 \ | |
--reruns 7 --reruns-delay 3 --only-rerun MapdlExitedError --only-rerun EmptyRecordError \ | |
--cov=ansys.math.core --cov-report=xml:${{ matrix.mapdl-version }}-remote.xml \ | |
--cov-report=html --cov-report term | |
- name: "Upload coverage to Codecov" | |
uses: codecov/codecov-action@v4 | |
with: | |
name: ${{ matrix.mapdl-version }}-remote.xml | |
flags: remote,${{ matrix.mapdl-version }} | |
- name: "Upload coverage artifacts" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.mapdl-version }}-remote.xml | |
path: ./${{ matrix.mapdl-version }}-remote.xml | |
- name: "Display files structure" | |
if: always() | |
run: | | |
mkdir logs-${{ matrix.mapdl-version }} && echo "Successfully generated directory ${{ matrix.mapdl-version }}" | |
echo "::group:: Display files structure" && ls -R && echo "::endgroup::" | |
ls -R > ./logs-${{ matrix.mapdl-version }}/files_structure.txt | |
- name: "Display docker files structures" | |
if: always() | |
run: | | |
echo "::group:: Display files structure" && docker exec mapdl /bin/bash -c "ls -R" && echo "::endgroup::" | |
docker exec mapdl /bin/bash -c "ls -R" > ./logs-${{ matrix.mapdl-version }}/docker_files_structure.txt | |
- name: "Collect MAPDL logs on failure" | |
if: ${{ always() && !contains( matrix.mapdl-version, 'ubuntu') }} | |
run: | | |
docker exec mapdl /bin/bash -c "mkdir -p /mapdl_logs && echo 'Successfully created directory inside docker container'" | |
docker exec mapdl /bin/bash -c "if compgen -G 'file*.out' > /dev/null ;then cp -f /file*.out /mapdl_logs && echo 'Successfully copied out files.'; fi" | |
docker exec mapdl /bin/bash -c "if compgen -G 'file*.err' > /dev/null ;then cp -f /file*.err /mapdl_logs && echo 'Successfully copied err files.'; fi" | |
docker exec mapdl /bin/bash -c "if compgen -G 'file*.log' > /dev/null ;then cp -f /file*.log /mapdl_logs && echo 'Successfully copied log files.'; fi" | |
docker exec mapdl /bin/bash -c "if compgen -G '*.crash' > /dev/null ;then cp -f /*.crash /mapdl_logs && echo 'Successfully copied crash files.'; fi" | |
docker cp mapdl:/mapdl_logs/. ./logs-${{ matrix.mapdl-version }}/. | |
- name: "Collect MAPDL logs on failure for ubuntu image" | |
if: ${{ always() && contains( matrix.mapdl-version,'ubuntu') }} | |
run: | | |
docker exec mapdl /bin/bash -c "mkdir -p /mapdl_logs && echo 'Successfully created directory inside docker container'" | |
docker exec mapdl /bin/bash -c "if compgen -G '/jobs/file*.out' > /dev/null ;then cp -f /jobs/file*.out /mapdl_logs && echo 'Successfully copied out files.'; fi" | |
docker exec mapdl /bin/bash -c "if compgen -G '/jobs/file*.err' > /dev/null ;then cp -f /jobs/file*.err /mapdl_logs && echo 'Successfully copied err files.'; fi" | |
docker exec mapdl /bin/bash -c "if compgen -G '/jobs/file*.log' > /dev/null ;then cp -f /jobs/file*.log /mapdl_logs && echo 'Successfully copied log files.'; fi" | |
docker exec mapdl /bin/bash -c "if compgen -G '/jobs/*.crash' > /dev/null ;then cp -f /jobs/*.crash /mapdl_logs && echo 'Successfully copied crash files.'; fi" | |
docker cp mapdl:/mapdl_logs/. ./logs-${{ matrix.mapdl-version }}/. | |
- name: "Tar logs" | |
if: always() | |
run: | | |
cp log.txt ./logs-${{ matrix.mapdl-version }}/log.txt | |
tar cvzf ./logs-${{ matrix.mapdl-version }}.tgz ./logs-${{ matrix.mapdl-version }} | |
- name: "Upload logs to GitHub" | |
if: always() | |
uses: actions/upload-artifact@master | |
with: | |
name: logs-${{ matrix.mapdl-version }}.tgz | |
path: ./logs-${{ matrix.mapdl-version }}.tgz | |
- name: "Display MAPDL Logs" | |
if: always() | |
run: cat log.txt | |
- name: "List main files" | |
if: always() | |
run: | | |
if compgen -G './logs-${{ matrix.mapdl-version }}/*.err' > /dev/null ;then for f in ./logs-${{ matrix.mapdl-version }}/*.err; do echo "::group:: Error file $f" && cat $f && echo "::endgroup::" ; done; fi | |
if compgen -G './logs-${{ matrix.mapdl-version }}/*.log' > /dev/null ;then for f in ./logs-${{ matrix.mapdl-version }}/*.log; do echo "::group:: Log file $f" && cat $f && echo "::endgroup::" ; done; fi | |
if compgen -G './logs-${{ matrix.mapdl-version }}/*.out' > /dev/null ;then for f in ./logs-${{ matrix.mapdl-version }}/*.out; do echo "::group:: Output file $f" && cat $f && echo "::endgroup::" ; done; fi | |
doc-build: | |
name: "Doc building" | |
runs-on: ubuntu-latest | |
needs: [doc-style] | |
outputs: | |
ANSYSMATH_VERSION: ${{ steps.version.outputs.ANSYSMATH_VERSION }} | |
env: | |
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 | |
steps: | |
- name: "Install Git and checkout project" | |
uses: actions/checkout@v4 | |
- name: "Setup Python" | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
- name: "Cache pip" | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: Python-v${{ env.RESET_PIP_CACHE }}-Linux-${{ env.MAIN_PYTHON_VERSION }}-${{ hashFiles('pyproject.toml') }} | |
restore-keys: | | |
Python-v${{ env.RESET_PIP_CACHE }}-Linux-${{ env.MAIN_PYTHON_VERSION }} | |
- name: "Install ansys-math-core and documentation requirements" | |
run: | | |
pip install .[doc] | |
- name: "Login in Github container registry" | |
uses: docker/[email protected] | |
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 }}:${{ env.DOCKER_IMAGE_VERSION_DOCS_BUILD }}' | |
- name: "Retrieve AnsysMath version" | |
id: version | |
run: | | |
echo "ANSYSMATH_VERSION=$(python -c 'from ansys.math.core import __version__; print(__version__)')" >> $GITHUB_OUTPUT | |
echo "AnsysMath version is: $(python -c "from ansys.math.core import __version__; print(__version__)")" | |
- name: "Cache examples" | |
uses: actions/cache@v4 | |
with: | |
path: doc/source/examples | |
key: Examples-v${{ env.RESET_EXAMPLES_CACHE }}-${{ steps.version.outputs.ANSYSMATH_VERSION }}-${{ github.sha }} | |
restore-keys: | | |
Examples-v${{ env.RESET_EXAMPLES_CACHE }}-${{ steps.version.outputs.ANSYSMATH_VERSION }} | |
- name: "Cache docs build directory" | |
uses: actions/cache@v4 | |
with: | |
path: doc/_build | |
key: doc-build-v${{ env.RESET_DOC_BUILD_CACHE }}-${{ steps.version.outputs.ANSYSMATH_VERSION }}-${{ github.sha }} | |
restore-keys: | | |
doc-build-v${{ env.RESET_DOC_BUILD_CACHE }}-${{ steps.version.outputs.ANSYSMATH_VERSION }} | |
- name: "Cache autosummary" | |
uses: actions/cache@v4 | |
with: | |
path: doc/source/**/_autosummary/*.rst | |
key: autosummary-v${{ env.RESET_AUTOSUMMARY_CACHE }}-${{ steps.version.outputs.ANSYSMATH_VERSION }}-${{ github.sha }} | |
restore-keys: | | |
autosummary-v${{ env.RESET_AUTOSUMMARY_CACHE }}-${{ steps.version.outputs.ANSYSMATH_VERSION }} | |
- name: "Run Ansys documentation building action" | |
uses: ansys/actions/doc-build@v5 | |
with: | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
skip-install: true | |
checkout: false | |
sphinxopts: -j auto --keep-going | |
requires-xvfb: true | |
skip-json-build: true | |
dependencies: pandoc | |
package: | |
name: "Package library" | |
needs: [doc-build, build-test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Build library source and wheel artifacts" | |
uses: ansys/actions/build-library@v5 | |
with: | |
library-name: ${{ env.PACKAGE_NAME }} | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
doc-deploy-dev: | |
name: "Deploy development documentation" | |
# Deploy development only when merging to main | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
needs: [package] | |
steps: | |
- name: "Deploy the latest documentation" | |
uses: ansys/actions/doc-deploy-dev@v5 | |
with: | |
cname: ${{ env.DOCUMENTATION_CNAME }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
release: | |
name: "Release project to public PyPI and GitHub" | |
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: ansys/actions/release-pypi-public@v5 | |
with: | |
library-name: ${{ env.PACKAGE_NAME }} | |
twine-username: "__token__" | |
twine-token: ${{ secrets.PYPI_TOKEN }} | |
- name: "Release to GitHub" | |
uses: ansys/actions/release-github@v5 | |
with: | |
library-name: ${{ env.PACKAGE_NAME }} | |
doc-deploy-stable: | |
name: "Deploy stable documentation" | |
# Deploy release documentation when creating a new tag | |
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@v5 | |
with: | |
cname: ${{ env.DOCUMENTATION_CNAME }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} |