diff --git a/.github/workflows/snapshot-ci.yml b/.github/workflows/snapshot-ci.yml
index b53de95e73..bbf0f3a42a 100644
--- a/.github/workflows/snapshot-ci.yml
+++ b/.github/workflows/snapshot-ci.yml
@@ -1,4 +1,5 @@
name: Snapshot CI
+
env:
CORE_VERSION: ''
LOADFLOW_VERSION: ''
@@ -15,33 +16,27 @@ on:
push:
branches:
- snapshot_ci
+
jobs:
- buil_pypowsybl:
+ build_pypowsybl:
name: Build ${{ matrix.config.name }} ${{ matrix.python.name }} wheel
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- { name: ubuntu, os: ubuntu-latest, sed_inplace: "-i" }
- - { name: darwin, os: macos-12, macosx_deployment_target: "10.16", bdist_wheel_args: "--plat-name macosx-11.0-x86_64", sed_inplace: "-i ''" }
- - { name: darwin-arm64, os: macos-14, macosx_deployment_target: "11", bdist_wheel_args: "--plat-name macosx-11.0-arm64", sed_inplace: "-i ''" }
- - { name: windows, os: windows-2022, sed_inplace: "-i" }
+
python:
- { name: cp38, version: '3.8' }
- - { name: cp39, version: '3.9' }
- - { name: cp310, version: '3.10' }
- - { name: cp311, version: '3.11' }
- - { name: cp312, version: '3.12' }
+
steps:
- #SETUP JDK
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- #SETUP PYTHON
- name: Set up Python ${{ matrix.python.version }}
uses: actions/setup-python@v4
with:
@@ -50,7 +45,6 @@ jobs:
- name: Install Python dependencies
run: python -m pip install --upgrade pip
- #SETUP GRAALVM
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1.1.5
with:
@@ -58,252 +52,98 @@ jobs:
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
-
- #MISE EN CACHE DES DEPENDENCES
- - name: Cache Maven packages
- uses: actions/cache@v3
- with:
- path: ~/.m2
- key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
- restore-keys: ${{ runner.os }}-m2
-
- #BUILD CORE
- - name: Checkout core-sources
- uses: actions/checkout@v4
- with:
- repository: powsybl/powsybl-core
- ref: main
- - name: Build with Maven
- run: mvn -batch-mode --no-transfer-progress clean install -DskipTests
- shell: bash
-
- - name : Get core version
- run : echo "CORE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- shell: bash
-
-
-
- #BUILD LOADFLOW
- - name: Check for SNAPSHOT branch
- run: |
- SNAPSHOT_BRANCH=$(git ls-remote --heads https://github.com/powsybl/powsybl-open-loadflow.git | grep -E "refs/heads/$(echo $CORE_VERSION | grep -q SNAPSHOT && echo "$CORE_VERSION" || echo "$CORE_VERSION-SNAPSHOT")" | sed 's/.*refs\/heads\///')
- if [ -n "$SNAPSHOT_BRANCH" ]; then
- echo "SNAPSHOT VERSION EXIST: $SNAPSHOT_BRANCH"
- echo "SNAPSHOT_BRANCH=$SNAPSHOT_BRANCH" >> $GITHUB_ENV
- else
- echo "No SNAPSHOT branch found"
- echo "SNAPSHOT_BRANCH=main" >> $GITHUB_ENV
- fi
- shell: bash
-
- - name: Checkout loadflow-sources
- uses: actions/checkout@v4
- with:
- repository: powsybl/powsybl-open-loadflow
- ref: ${{ env.SNAPSHOT_BRANCH }}
-
- - name: Change core version
- run : sed ${{ matrix.config.sed_inplace }} 's|.*|'"$CORE_VERSION"'|' pom.xml
- shell: bash
-
- - name: Build with Maven
- run: |
- mvn -batch-mode --no-transfer-progress clean install -DskipTests
- shell: bash
-
- - name: Get loadflow version
- run : echo "LOADFLOW_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- shell: bash
-
-
-
- #BUILD DIAGRAM
- - name: Check for SNAPSHOT branch
- run: |
- SNAPSHOT_BRANCH=$(git ls-remote --heads https://github.com/powsybl/powsybl-diagram.git | grep -E "refs/heads/$(echo $CORE_VERSION | grep -q SNAPSHOT && echo "$CORE_VERSION" || echo "$CORE_VERSION-SNAPSHOT")" | sed 's/.*refs\/heads\///')
- if [ -n "$SNAPSHOT_BRANCH" ]; then
- echo "SNAPSHOT VERSION EXIST: $SNAPSHOT_BRANCH"
- echo "SNAPSHOT_BRANCH=$SNAPSHOT_BRANCH" >> $GITHUB_ENV
- else
- echo "No SNAPSHOT branch found"
- echo "SNAPSHOT_BRANCH=main" >> $GITHUB_ENV
- fi
- shell: bash
-
-
- - name: Checkout diagram-sources
- uses: actions/checkout@v4
- with:
- repository: powsybl/powsybl-diagram
- ref: ${{ env.SNAPSHOT_BRANCH }}
-
- - name: Change core version
- run : sed ${{ matrix.config.sed_inplace }} 's|.*|'"$CORE_VERSION"'|' pom.xml
- shell: bash
-
- - name: Build with Maven
- run: mvn -batch-mode --no-transfer-progress clean install -DskipTests
- shell: bash
-
- - name: Get diagram version
- run : echo "DIAGRAM_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- shell: bash
-
-
- #BUILD ENTSOE
- - name: Check for SNAPSHOT branch
- run: |
- SNAPSHOT_BRANCH=$(git ls-remote --heads https://github.com/powsybl/powsybl-entsoe.git | grep -E "refs/heads/$(echo $CORE_VERSION | grep -q SNAPSHOT && echo "$CORE_VERSION" || echo "$CORE_VERSION-SNAPSHOT")" | sed 's/.*refs\/heads\///')
- if [ -n "$SNAPSHOT_BRANCH" ]; then
- echo "SNAPSHOT VERSION EXIST: $SNAPSHOT_BRANCH"
- echo "SNAPSHOT_BRANCH=$SNAPSHOT_BRANCH" >> $GITHUB_ENV
- else
- echo "No SNAPSHOT branch found"
- echo "SNAPSHOT_BRANCH=main" >> $GITHUB_ENV
- fi
- shell: bash
-
- - name: Checkout entsoe-sources
- uses: actions/checkout@v4
- with:
- repository: powsybl/powsybl-entsoe
- ref: ${{ env.SNAPSHOT_BRANCH }}
-
- - name: Change core version
- run : sed ${{ matrix.config.sed_inplace }} 's|.*|'"$CORE_VERSION"'|' pom.xml
- shell: bash
-
- - name: Change open-loadflow version
- run : sed ${{ matrix.config.sed_inplace }} 's|.*|'"$LOADFLOW_VERSION"'|' pom.xml
- shell: bash
-
- - name: Build with Maven
- run: mvn -batch-mode --no-transfer-progress clean install -DskipTests
- shell: bash
-
- - name: Get entsoe version
- run : echo "ENTSOE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- shell: bash
-
-
- #BUILD OPENRAO
- - name: Check for SNAPSHOT branch
+ - name: Build and install dependencies
+ id: build_deps
+ env:
+ REPOS: >-
+ powsybl/powsybl-core
+ powsybl/powsybl-open-loadflow
+ powsybl/powsybl-diagram
+ powsybl/powsybl-entsoe
+ powsybl/powsybl-open-rao
+ powsybl/powsybl-dynawo
run: |
- SNAPSHOT_BRANCH=$(git ls-remote --heads https://github.com/powsybl/powsybl-open-rao.git | grep -E "refs/heads/$(echo $CORE_VERSION | grep -q SNAPSHOT && echo "$CORE_VERSION" || echo "$CORE_VERSION-SNAPSHOT")" | sed 's/.*refs\/heads\///')
- if [ -n "$SNAPSHOT_BRANCH" ]; then
- echo "SNAPSHOT VERSION EXIST: $SNAPSHOT_BRANCH"
- echo "SNAPSHOT_BRANCH=$SNAPSHOT_BRANCH" >> $GITHUB_ENV
- else
- echo "No SNAPSHOT branch found"
- echo "SNAPSHOT_BRANCH=main" >> $GITHUB_ENV
- fi
- shell: bash
-
- - name: Checkout open-rao-sources
- uses: actions/checkout@v4
- with:
- repository: powsybl/powsybl-open-rao
- ref: ${{ env.SNAPSHOT_BRANCH }}
-
- - name: Change core version
- run: sed ${{ matrix.config.sed_inplace }} 's|.*|'"$CORE_VERSION"'|' pom.xml
- shell: bash
-
- - name: Change entsoe version
- run: sed ${{ matrix.config.sed_inplace }} 's|.*|'"$ENTSOE_VERSION"'|' pom.xml
- shell: bash
-
- - name: Change open-loadflow version
- run: sed ${{ matrix.config.sed_inplace }} 's|.*|'"$LOADFLOW_VERSION"'|' pom.xml
- shell: bash
-
- - name: Build with Maven
- run: mvn -batch-mode --no-transfer-progress clean install -DskipTests
- shell: bash
-
- - name: Get open-rao version
- run : echo "OPENRAO_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- shell: bash
-
-
-
- #BUILD DYNAWO
- - name: Check for SNAPSHOT branch
+ versions=""
+ for repo in $REPOS
+ do
+ echo "Processing $repo"
+ git clone https://github.com/$repo.git
+ cd $(basename $repo)
+
+ if [ "$repo" == "powsybl/powsybl-open-loadflow" ] || [ "$repo" = "powsybl/powsybl-diagram" ] || [ "$repo" = "powsybl/powsybl-dynawo" ]; then
+ sed ${{ matrix.config.sed_inplace }} 's|.*|'"$CORE_VERSION"'|' pom.xml
+ fi
+
+ if [ "$repo" = "powsybl/powsybl-entsoe" ]; then
+ sed ${{ matrix.config.sed_inplace }} 's|.*|'"$CORE_VERSION"'|' pom.xml
+ sed ${{ matrix.config.sed_inplace }} 's|.*|'"$LOADFLOW_VERSION"'|' pom.xml
+ fi
+
+ if [ "$repo" = "powsybl/powsybl-open-rao" ]; then
+ sed ${{ matrix.config.sed_inplace }} 's|.*|'"$CORE_VERSION"'|' pom.xml
+ sed ${{ matrix.config.sed_inplace }} 's|.*|'"$ENTSOE_VERSION"'|' pom.xml
+ sed ${{ matrix.config.sed_inplace }} 's|.*|'"$LOADFLOW_VERSION"'|' pom.xml
+ fi
+
+ mvn -batch-mode --no-transfer-progress clean install -DskipTests
+
+ VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
+ repo_name=$(echo $repo | cut -d'/' -f2 | tr '-' '_' | tr '[:lower:]' '[:upper:]')
+ versions="${versions}${repo_name}_VERSION=${VERSION}\n"
+
+ cd ..
+ done
+ echo -e "$versions" >> $GITHUB_OUTPUT
+ shell: bash
+
+ - name: Set version variables
run: |
- SNAPSHOT_BRANCH=$(git ls-remote --heads https://github.com/powsybl/powsybl-dynawo.git | grep -E "refs/heads/$(echo $CORE_VERSION | grep -q SNAPSHOT && echo "$CORE_VERSION" || echo "$CORE_VERSION-SNAPSHOT")" | sed 's/.*refs\/heads\///')
- if [ -n "$SNAPSHOT_BRANCH" ]; then
- echo "SNAPSHOT VERSION EXIST: $SNAPSHOT_BRANCH"
- echo "SNAPSHOT_BRANCH=$SNAPSHOT_BRANCH" >> $GITHUB_ENV
- else
- echo "No SNAPSHOT branch found"
- echo "SNAPSHOT_BRANCH=main" >> $GITHUB_ENV
- fi
- shell: bash
-
- - name: Checkout dynawo-sources
- uses: actions/checkout@v4
- with:
- repository: powsybl/powsybl-dynawo
- ref: ${{ env.SNAPSHOT_BRANCH }}
-
- - name: Change core version
- run: sed ${{ matrix.config.sed_inplace }} 's|.*|'"$CORE_VERSION"'|' pom.xml
- shell: bash
-
- - name: Build with Maven
- run: mvn -batch-mode --no-transfer-progress clean install -DskipTests
- shell: bash
-
- - name: Get dynawo version
- run : echo "DYNAWO_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- shell: bash
-
-
- #CHECKOUT_PYPOWSYBL_DEPENCIES
- - name: Checkout powsybl-depencies
+ echo "${{ steps.build_deps.outputs.POWSYBL_CORE_VERSION }}" >> $GITHUB_ENV
+ echo "${{ steps.build_deps.outputs.POWSYBL_OPEN_LOADFLOW_VERSION }}" >> $GITHUB_ENV
+ echo "${{ steps.build_deps.outputs.POWSYBL_DIAGRAM_VERSION }}" >> $GITHUB_ENV
+ echo "${{ steps.build_deps.outputs.POWSYBL_ENTSOE_VERSION }}" >> $GITHUB_ENV
+ echo "${{ steps.build_deps.outputs.POWSYBL_OPEN_RAO_VERSION }}" >> $GITHUB_ENV
+ echo "${{ steps.build_deps.outputs.POWSYBL_DYNAWO_VERSION }}" >> $GITHUB_ENV
+
+ - name: Checkout powsybl-dependencies
uses: actions/checkout@v4
with:
repository: powsybl/powsybl-dependencies
ref: main
- - name: Get dependencies version
- run: echo "DEPENDENCIES_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- shell: bash
- #UPDATE/INSTALL_PYPOWSYBL_DEPENCIES
- name: Update dependencies versions
run: |
- mvn versions:set-property -Dproperty=powsybl-open-loadflow.version -DnewVersion=$LOADFLOW_VERSION -DgenerateBackupPoms=false
- mvn versions:set-property -Dproperty=powsybl-core.version -DnewVersion=$CORE_VERSION -DgenerateBackupPoms=false
- mvn versions:set-property -Dproperty=powsybl-diagram.version -DnewVersion=$DIAGRAM_VERSION -DgenerateBackupPoms=false
- mvn versions:set-property -Dproperty=powsybl-dynawo.version -DnewVersion=$DYNAWO_VERSION -DgenerateBackupPoms=false
- mvn versions:set-property -Dproperty=powsybl-entsoe.version -DnewVersion=$ENTSOE_VERSION -DgenerateBackupPoms=false
- mvn versions:set-property -Dproperty=powsybl-open-rao.version -DnewVersion=$OPENRAO_VERSION -DgenerateBackupPoms=false
+ mvn versions:set-property -Dproperty=powsybl-open-loadflow.version -DnewVersion=$POWSYBL_OPEN_LOADFLOW_VERSION -DgenerateBackupPoms=false
+ mvn versions:set-property -Dproperty=powsybl-core.version -DnewVersion=$POWSYBL_CORE_VERSION -DgenerateBackupPoms=false
+ mvn versions:set-property -Dproperty=powsybl-diagram.version -DnewVersion=$POWSYBL_DIAGRAM_VERSION -DgenerateBackupPoms=false
+ mvn versions:set-property -Dproperty=powsybl-dynawo.version -DnewVersion=$POWSYBL_DYNAWO_VERSION -DgenerateBackupPoms=false
+ mvn versions:set-property -Dproperty=powsybl-entsoe.version -DnewVersion=$POWSYBL_ENTSOE_VERSION -DgenerateBackupPoms=false
+ mvn versions:set-property -Dproperty=powsybl-open-rao.version -DnewVersion=$POWSYBL_OPEN_RAO_VERSION -DgenerateBackupPoms=false
shell: bash
- name: Install powsybl-dependencies
- run : mvn -batch-mode --no-transfer-progress clean install -DskipTests
+ run: |
+ mvn -batch-mode --no-transfer-progress clean install -DskipTests
+ echo "DEPENDENCIES_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
shell: bash
-
- #BUILD PYPOWSYBL
- - name: Checkout sources
+ - name: Checkout PyPowSyBl
uses: actions/checkout@v4
with:
submodules: true
- name: Change java-pom.xml
working-directory: ./java
- run : mvn versions:set-property -Dproperty=powsybl-dependencies.version -DnewVersion=$DEPENDENCIES_VERSION -DgenerateBackupPoms=false
+ run: mvn versions:set-property -Dproperty=powsybl-dependencies.version -DnewVersion=$DEPENDENCIES_VERSION -DgenerateBackupPoms=false
shell: bash
- name: Install dependencies
run: pip3 install -r requirements.txt
- name: Build wheel
- run: python3 setup.py bdist_wheel
+ run: python3 setup.py bdist_wheel ${{ matrix.config.bdist_wheel_args }}
shell: bash
-
- name: Install wheel
run: python -m pip install dist/*.whl --user
shell: bash
@@ -312,7 +152,7 @@ jobs:
working-directory: ./tests
run: pytest
- - name: check pypowsybl versions
+ - name: Check pypowsybl versions
working-directory: ./tests
run: python3 basic_import_test.py
@@ -322,5 +162,27 @@ jobs:
name: pypowsybl-wheel-${{ matrix.config.name }}-${{ matrix.python.name }}
path: dist/*.whl
+ package:
+ name: Package wheels
+ runs-on: ubuntu-latest
+ needs: [build_pypowsybl]
+
+ 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
\ No newline at end of file