add regulating element for generator, vsc and svc creation (#683) #187
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
name: Full CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*.*.*' | |
jobs: | |
manylinux_build: | |
name: Build linux ${{ matrix.python.name }} wheel | |
runs-on: ubuntu-latest | |
container: quay.io/pypa/manylinux_2_24_x86_64:2022-12-26-0d38463 | |
strategy: | |
matrix: | |
python: | |
- { | |
name: cp38, | |
abi: cp38, | |
version: '3.8', | |
} | |
- { | |
name: cp39, | |
abi: cp39, | |
version: '3.9', | |
} | |
- { | |
name: cp310, | |
abi: cp310, | |
version: '3.10', | |
} | |
- { | |
name: cp311, | |
abi: cp311, | |
version: '3.11', | |
} | |
steps: | |
- name: Install Linux packages | |
run: | | |
echo "deb http://archive.debian.org/debian stretch main contrib non-free" > /etc/apt/sources.list | |
apt-get update | |
apt install -y wget | |
- name: Install Maven | |
run: | | |
wget https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.tar.gz -P /tmp | |
tar xf /tmp/apache-maven-*.tar.gz -C /opt | |
echo /opt/apache-maven-3.9.6/bin >> $GITHUB_PATH | |
- name: Setup GraalVM | |
uses: graalvm/setup-graalvm@v1 | |
with: | |
java-version: '17' | |
distribution: 'graalvm' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
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 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 | |
if: matrix.python.name == 'cp39' | |
run: | | |
pip3 uninstall -y pypowsybl | |
python3 setup.py develop | |
- name: Generate coverage | |
if: matrix.python.name == 'cp39' | |
run: | | |
coverage run -m pytest tests/ | |
coverage xml | |
- name: Linting | |
if: matrix.python.name == 'cp39' | |
run: pylint pypowsybl | |
- name: Sonar analysis | |
if: matrix.python.name == 'cp39' | |
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 doctest | |
- name: Upload wheel | |
uses: actions/upload-artifact@v3 | |
with: | |
name: pypowsybl-wheel-linux-${{ matrix.python.name }} | |
path: wheelhouse/*.whl | |
macos_windows_build: | |
name: Build ${{ matrix.config.name }} ${{ matrix.python.name }} wheel | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
matrix: | |
config: | |
- { | |
name: darwin, | |
os: macos-11, | |
} | |
- { | |
name: windows, | |
os: windows-2022, | |
} | |
python: | |
- { | |
name: cp38, | |
version: '3.8', | |
} | |
- { | |
name: cp39, | |
version: '3.9', | |
} | |
- { | |
name: cp310, | |
version: '3.10', | |
} | |
- { | |
name: cp311, | |
version: '3.11', | |
} | |
steps: | |
- name: Setup GraalVM | |
uses: graalvm/setup-graalvm@v1 | |
with: | |
java-version: '17' | |
distribution: 'graalvm' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
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: "10.16" # to ensure pip finds wheel when Big Sur is configured to return 10.16 as version instead of 11.0 | |
run: python setup.py bdist_wheel | |
- name: Install wheel | |
shell: bash | |
run: python -m pip install dist/*.whl --user | |
- 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 doctest | |
- name: Upload wheel | |
uses: actions/upload-artifact@v3 | |
with: | |
name: pypowsybl-wheel-${{ matrix.config.name }}-${{ matrix.python.name }} | |
path: dist/*.whl | |
package: | |
name: Package wheels | |
runs-on: ubuntu-latest | |
needs: [manylinux_build, macos_windows_build] | |
steps: | |
- name: Download wheels | |
uses: actions/download-artifact@v3 | |
with: | |
path: download | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: pypowsybl-wheels | |
path: | | |
download/**/*.whl | |
- name: Release on PyPi | |
if: startsWith(github.ref, 'refs/tags/') | |
shell: bash | |
run: | | |
python -m pip install --user --upgrade twine | |
python -m twine upload --username __token__ --password ${{ secrets.PYPI_TOKEN }} download/*/*.whl |