Skip to content

Miscellaneous doc fixes (#1130) #529

Miscellaneous doc fixes (#1130)

Miscellaneous doc fixes (#1130) #529

Workflow file for this run

name: Full CI
on:
push:
branches:
- main
- 'release-v**'
- 'full-sonar-analysis-**'
release:
types:
- published
permissions:
contents: write
jobs:
manylinux_complete_build:
name: Build linux native libraries and ${{ matrix.python.name }} wheel
runs-on: ubuntu-latest
container: quay.io/pypa/manylinux_2_28_x86_64:2024-11-16-d70d8cd
strategy:
matrix:
python:
- {
name: cp39,
abi: cp39,
version: '3.9'
}
steps:
- name: Install Linux Packages
run: dnf install -y wget
- name: Install Maven
run: |
wget -q https://dlcdn.apache.org/maven/maven-3/3.9.12/binaries/apache-maven-3.9.12-bin.tar.gz -P /tmp
tar xf /tmp/apache-maven-*.tar.gz -C /opt
echo /opt/apache-maven-3.9.12/bin >> $GITHUB_PATH
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: true
- name: Setup path
run: echo "/opt/python/${{ matrix.python.name }}-${{ matrix.python.abi }}/bin/" >> $GITHUB_PATH
- name: Install dependencies
run: pip3 install -r requirements.txt
- name: Build wheel
run: |
python3 setup.py bdist_wheel
auditwheel repair dist/*.whl
- name: Install wheel
run: pip3 install wheelhouse/*.whl --user
- name: Run basic pypowsybl import
working-directory: ./tests
run: python3 basic_import_test.py
- name: Run tests
working-directory: ./tests # Run in subdir to use installed lib, not sources
run: |
pytest
- name: Type checking
run: mypy -p pypowsybl
- name: Dev install # In order to generate coverage and linting, we need to install in sources
run: |
pip3 uninstall -y pypowsybl
python3 setup.py develop
- name: Generate coverage
run: |
coverage run -m pytest tests/
coverage xml
- name: Linting
run: pylint pypowsybl
- name: Sonar analysis
uses: sonarsource/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: |
-Dsonar.python.coverage.reportPaths=coverage.xml
- name: Run doc examples
working-directory: ./docs
run: make html doctest SPHINXOPTS="-W"
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: pypowsybl-wheel-linux-${{ matrix.python.name }}
path: wheelhouse/*.whl
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: binaries-linux.zip
retention-days: 1
path: |
dist/binaries.zip
- name: Upload release binaries
if: ${{ github.event_name == 'release' }}
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./dist/binaries.zip
asset_name: binaries-${{ github.event.release.tag_name }}-linux.zip
asset_content_type: application/zip
manylinux_python_build:
name: Build linux ${{ matrix.python.name }} wheel (without rebuilding native libraries)
runs-on: ubuntu-latest
needs: manylinux_complete_build
container: quay.io/pypa/manylinux_2_28_x86_64:2024-11-16-d70d8cd
strategy:
matrix:
python:
- {
name: cp310,
abi: cp310,
version: '3.10'
}
- {
name: cp311,
abi: cp311,
version: '3.11'
}
- {
name: cp312,
abi: cp312,
version: '3.12'
}
- {
name: cp313,
abi: cp313,
version: '3.13'
}
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: true
- name: Setup path
run: echo "/opt/python/${{ matrix.python.name }}-${{ matrix.python.abi }}/bin/" >> $GITHUB_PATH
- name: Install dependencies
run: pip3 install -r requirements.txt
- name: Download native libraries
uses: actions/download-artifact@v4
with:
name: binaries-linux.zip
- name: Set up native libraries
run: |
unzip binaries.zip
- name: Build wheel
env:
PYPOWSYBL_NATIVE_BUILD_DIR: ${{ github.workspace }}
run: |
python3 setup.py bdist_wheel
auditwheel repair dist/*.whl
- name: Install wheel
run: pip3 install wheelhouse/*.whl --user
- name: Run basic pypowsybl import
working-directory: ./tests
run: python3 basic_import_test.py
- name: Run tests
working-directory: ./tests # Run in subdir to use installed lib, not sources
run: |
pytest
- name: Type checking
run: mypy -p pypowsybl
- name: Run doc examples
working-directory: ./docs
run: make html doctest SPHINXOPTS="-W"
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: pypowsybl-wheel-linux-${{ matrix.python.name }}
path: wheelhouse/*.whl
macos_windows_complete_build:
name: Build ${{ matrix.config.name }} native libraries and ${{ matrix.python.name }} wheel
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- {
name: darwin,
os: macos-15-intel,
macosx_deployment_target: "10.16", # to ensure pip finds wheel when Big Sur is configured to return 10.16 as version instead of 11.0
bdist_wheel_args: "--plat-name macosx-11.0-x86_64", # needed to avoid the wheel to be named -universal2
}
- {
name: darwin-arm64,
os: macos-15-xlarge,
macosx_deployment_target: "11", # first arm64 version of macosx
bdist_wheel_args: "--plat-name macosx-11.0-arm64", # needed to avoid the wheel to be named -universal2
}
- {
name: windows,
os: windows-2022,
}
python:
- {
name: cp39,
version: '3.9',
}
steps:
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python.version }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Build wheel
env:
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.config.macosx_deployment_target }}
run: python setup.py bdist_wheel ${{ matrix.config.bdist_wheel_args }}
- name: Install wheel
shell: bash
run: python -m pip install dist/*.whl --user
- name: Run basic pypowsybl import
working-directory: ./tests
run: python3 basic_import_test.py
- name: Run tests
working-directory: ./tests
run: python3 -m pytest
- name: Type checking
run: mypy -p pypowsybl
- name: Run doc examples
working-directory: ./docs
run: make html doctest SPHINXOPTS="-W"
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: pypowsybl-wheel-${{ matrix.config.name }}-${{ matrix.python.name }}
path: dist/*.whl
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.config.name }}.zip
retention-days: 1
path: |
dist/binaries.zip
- name: Upload release binaries
if: ${{ github.event_name == 'release' }}
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./dist/binaries.zip
asset_name: binaries-${{ github.event.release.tag_name }}-${{ matrix.config.name }}.zip
asset_content_type: application/zip
macos_windows_python_build:
name: Build ${{ matrix.config.name }} ${{ matrix.python.name }} wheel (without rebuilding native libraries)
runs-on: ${{ matrix.config.os }}
needs: macos_windows_complete_build
strategy:
matrix:
config:
- {
name: darwin,
os: macos-15-intel,
macosx_deployment_target: "10.16", # to ensure pip finds wheel when Big Sur is configured to return 10.16 as version instead of 11.0
bdist_wheel_args: "--plat-name macosx-11.0-x86_64", # needed to avoid the wheel to be named -universal2
}
- {
name: darwin-arm64,
os: macos-15,
macosx_deployment_target: "11", # first arm64 version of macosx
bdist_wheel_args: "--plat-name macosx-11.0-arm64", # needed to avoid the wheel to be named -universal2
}
- {
name: windows,
os: windows-2022,
}
python:
- {
name: cp310,
version: '3.10',
}
- {
name: cp311,
version: '3.11',
}
- {
name: cp312,
version: '3.12',
}
- {
name: cp313,
version: '3.13',
}
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python.version }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Download native libraries
uses: actions/download-artifact@v4
with:
name: binaries-${{ matrix.config.name }}.zip
- name: Set up native libraries
run: |
unzip binaries.zip
- name: Build wheel
env:
PYPOWSYBL_NATIVE_BUILD_DIR: ${{ github.workspace }}
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.config.macosx_deployment_target }}
run: python setup.py bdist_wheel ${{ matrix.config.bdist_wheel_args }}
- name: Install wheel
shell: bash
run: python -m pip install dist/*.whl --user
- name: Run basic pypowsybl import
working-directory: ./tests
run: python3 basic_import_test.py
- name: Run tests
working-directory: ./tests
run: python3 -m pytest
- name: Type checking
run: mypy -p pypowsybl
- name: Run doc examples
working-directory: ./docs
run: make html doctest SPHINXOPTS="-W"
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: pypowsybl-wheel-${{ matrix.config.name }}-${{ matrix.python.name }}
path: dist/*.whl
package:
name: Package wheels
runs-on: ubuntu-latest
needs: [manylinux_complete_build, manylinux_python_build, macos_windows_complete_build, macos_windows_python_build]
steps:
- name: Download wheels
uses: actions/download-artifact@v4
with:
path: download
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: pypowsybl-wheels
path: |
download/**/*.whl
- name: Release on PyPi
if: ${{ github.event_name == 'release' }}
shell: bash
run: |
python -m pip install --user --upgrade twine packaging
python -m twine upload --username __token__ --password ${{ secrets.PYPI_TOKEN }} download/*/*.whl
build:
name: Run SonarCloud analysis for Java code
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Build with Maven (Ubuntu)
working-directory: ./java
run: >
mvn --batch-mode install
- name: Run SonarCloud analysis
working-directory: ./java
run: >
mvn --batch-mode -DskipTests sonar:sonar
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.organization=powsybl-ci-github
-Dsonar.projectKey=powsybl_pypowsybl-java
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}