Skip to content

ci: delete ARM workflow (not needed) #59

ci: delete ARM workflow (not needed)

ci: delete ARM workflow (not needed) #59

Workflow file for this run

name: CI
on:
push:
tags:
- "*"
branches:
- main
pull_request:
env:
LIBRARY_NAME: 'ansys-pythonnet'
MAIN_PYTHON_VERSION: '3.11'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
doc-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Doxygen Action
uses: mattnotmitt/[email protected]
with:
working-directory: "doc/"
- name: Build Sphinx documentation
run: |
pip install -r doc/requirements.txt
sphinx-build doc/source/ ./doc/build/html/
- name: Upload artifact
# Automatically uploads an artifact from the './_site' directory by default
uses: actions/upload-pages-artifact@v1
with:
path: doc/build/html/
tests:
name: Build and Test
runs-on: ${{ matrix.os.instance }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os:
- category: windows
platform: x86
instance: windows-latest
- category: windows
platform: x64
instance: windows-latest
- category: ubuntu
platform: x64
instance: ubuntu-latest
- category: macos
platform: x64
instance: macos-13
python: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Set Environment on macOS
uses: maxim-lobanov/setup-xamarin@v1
if: ${{ matrix.os.category == 'macos' }}
with:
mono-version: latest
- name: Checkout code
uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
architecture: ${{ matrix.os.platform }}
- name: Install dependencies
run: |
pip install --upgrade -r requirements.txt
pip install numpy # for tests
- name: Build and Install
run: |
pip install -v .
- name: Set Python DLL path and PYTHONHOME (non Windows)
if: ${{ matrix.os.category != 'windows' }}
run: |
echo PYTHONNET_PYDLL=$(python -m find_libpython) >> $GITHUB_ENV
echo PYTHONHOME=$(python -c 'import sys; print(sys.prefix)') >> $GITHUB_ENV
- name: Set Python DLL path and PYTHONHOME (Windows)
if: ${{ matrix.os.category == 'windows' }}
run: |
Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append -InputObject "PYTHONNET_PYDLL=$(python -m find_libpython)"
Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append -InputObject "PYTHONHOME=$(python -c 'import sys; print(sys.prefix)')"
- name: Embedding tests
run: dotnet test --runtime any-${{ matrix.os.platform }} --logger "console;verbosity=detailed" src/embed_tests/
env:
MONO_THREADS_SUSPEND: preemptive # https://github.com/mono/mono/issues/21466
- name: Python Tests (Mono)
if: ${{ matrix.os.category != 'windows' }}
run: pytest --runtime mono
# TODO: Run these tests on Windows x86
- name: Python Tests (.NET Core)
if: ${{ matrix.os.platform == 'x64' }}
run: pytest --runtime coreclr
- name: Python Tests (.NET Framework)
if: ${{ matrix.os.category == 'windows' }}
run: pytest --runtime netfx
- name: Python tests run from .NET
run: dotnet test --runtime any-${{ matrix.os.platform }} src/python_tests_runner/
- name: Perf tests
if: ${{ (matrix.python == '3.8') && (matrix.os.platform == 'x64') }}
run: |
pip install --force --no-deps --target src/perf_tests/baseline/ pythonnet==2.5.2
dotnet test --configuration Release --runtime any-${{ matrix.os.platform }} --logger "console;verbosity=detailed" src/perf_tests/
- name: "Build library source and wheel artifacts"
run: |
python -m pip install build twine wheel
python -m build && python -m twine check dist/*
- name: "Upload distribution artifact"
uses: actions/[email protected]
with:
name: ${{ env.LIBRARY_NAME }}-py${{ matrix.python}}-${{ matrix.os }}-${{ matrix.platform }}-artifacts
path: dist/
retention-days: 7
build-library:
name: "Build library basic example"
runs-on: ubuntu-latest
needs: [doc-build, tests]
steps:
- uses: ansys/actions/build-library@v4
with:
library-name: ${{ env.LIBRARY_NAME }}
release:
name: "Release"
runs-on: ubuntu-latest
needs: [build-library]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
steps:
- name: "Checkout project"
uses: actions/checkout@v4
- name: "Install Python ${{ env.MAIN_PYTHON_VERSION }}"
uses: actions/setup-python@v4
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: "Install Python requirements"
run: |
python -m pip install twine
- name: "Download the library artifacts from build-library step"
uses: actions/download-artifact@v3
with:
name: ${{ env.LIBRARY_NAME }}-artifacts
path: ${{ env.LIBRARY_NAME }}-artifacts
- name: "Release to the public PyPI repository"
run: |
python -m twine upload --verbose --skip-existing ${{ env.LIBRARY_NAME }}-artifacts/*.whl
python -m twine upload --verbose --skip-existing ${{ env.LIBRARY_NAME }}-artifacts/*.tar.gz
env:
TWINE_USERNAME: '__token__'
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
TWINE_REPOSITORY_URL: 'https://upload.pypi.org/legacy/'