Skip to content

Commit

Permalink
Revert "Snapshot CI"
Browse files Browse the repository at this point in the history
This reverts commit 30c332d

Signed-off-by: Leclerc Clement <clement.leclerc@rte-france.com>
  • Loading branch information
clementleclercRTE committed Oct 14, 2024
1 parent 674cfc5 commit 51e5f18
Show file tree
Hide file tree
Showing 10 changed files with 266 additions and 26 deletions.
230 changes: 230 additions & 0 deletions .github/workflows/dependencies-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
name: Snapshot CI
env :
DEPENDENCIES_VERSION : ""
CORE_VERSION : ""
LOADFLOW_VERSION : ""
DIAGRAM_VERSION : ""
ENTSOE_VERSION : ""
DYNAWO_VERSION: ""

on:
push:
branches:
# on all branches except main where full build will be run
- '*'
- '!main'

jobs:
build_dependencies:
name: Build OS ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]

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
uses: actions/setup-python@v4
with:
python-version: '3.8'

- name: Install Python dependencies
run: python -m pip install --upgrade pip

#SETUP GRAALVM
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1.1.5
with:
java-version: '17'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}


#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 clean install -DskipTests
- name : Get core version
run : |
echo "CORE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV*
cat pom.xml || true
#BUILD LOADFLOW
- name: Check for SNAPSHOT branch
run: |
SNAPSHOT_BRANCH=$(git ls-remote --heads https://github.com/powsybl/powsybl-open-loadflow.git| grep 'refs/heads/.*SNAPSHOT' | sed 's/.*refs\/heads\///')
if [ -n "$SNAPSHOT_BRANCH" ]; then
echo "SNAPSHOT VERSION EXIST: $SNAPSHOT_BRANCH"
echo "SNAPSHOT_EXIST=true" >> $GITHUB_ENV
echo "SNAPSHOT_BRANCH=$SNAPSHOT_BRANCH" >> $GITHUB_ENV
else
echo "No SNAPSHOT branch found"
echo "SNAPSHOT_EXIST=false" >> $GITHUB_ENV
echo "SNAPSHOT_BRANCH=main" >> $GITHUB_ENV
fi
- name: Checkout loadflow-sources
uses: actions/checkout@v4
with:
repository: powsybl/powsybl-open-loadflow
ref: ${{ env.SNAPSHOT_BRANCH }}
- name: Change core version
run : mvn versions:set-property -Dproperty=powsybl-core.version -DnewVersion=$CORE_VERSION -DgenerateBackupPoms=false
- name: Build with Maven
run: |
cat pom.xml || true
mvn --batch-mode clean install -DskipTests
- name: Get loadflow version
run : echo "LOADFLOW_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV


#BUILD DIAGRAM
- name: Check for SNAPSHOT branch
run: |
SNAPSHOT_BRANCH=$(git ls-remote --heads https://github.com/powsybl/powsybl-diagram.git | grep 'refs/heads/.*SNAPSHOT' | sed 's/.*refs\/heads\///')
if [ -n "$SNAPSHOT_BRANCH" ]; then
echo "SNAPSHOT VERSION EXIST: $SNAPSHOT_BRANCH"
echo "SNAPSHOT_EXIST=true" >> $GITHUB_ENV
echo "SNAPSHOT_BRANCH=$SNAPSHOT_BRANCH" >> $GITHUB_ENV
else
echo "No SNAPSHOT branch found"
echo "SNAPSHOT_EXIST=false" >> $GITHUB_ENV
echo "SNAPSHOT_BRANCH=main" >> $GITHUB_ENV
fi
- name: Checkout diagram-sources
uses: actions/checkout@v4
with:
repository: powsybl/powsybl-diagram
ref: ${{ env.SNAPSHOT_BRANCH }}
- name: Change core version
run : mvn versions:set-property -Dproperty=powsybl-core.version -DnewVersion=$CORE_VERSION -DgenerateBackupPoms=false
- name: Build with Maven
run: |
cat pom.xml || true
mvn --batch-mode clean install -DskipTests
- name: Get diagram version
run : echo "DIAGRAM_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV

#BUILD ENTSOE
- name: Check for SNAPSHOT branch
run: |
SNAPSHOT_BRANCH=$(git ls-remote --heads https://github.com/powsybl/powsybl-entsoe.git | grep 'refs/heads/.*SNAPSHOT' | sed 's/.*refs\/heads\///')
if [ -n "$SNAPSHOT_BRANCH" ]; then
echo "SNAPSHOT VERSION EXIST: $SNAPSHOT_BRANCH"
echo "SNAPSHOT_EXIST=true" >> $GITHUB_ENV
echo "SNAPSHOT_BRANCH=$SNAPSHOT_BRANCH" >> $GITHUB_ENV
else
echo "No SNAPSHOT branch found"
echo "SNAPSHOT_EXIST=false" >> $GITHUB_ENV
echo "SNAPSHOT_BRANCH=main" >> $GITHUB_ENV
fi
- name: Checkout entsoe-sources
uses: actions/checkout@v4
with:
repository: powsybl/powsybl-entsoe
ref: ${{ env.SNAPSHOT_BRANCH }}
- name: Change core version
run : mvn versions:set-property -Dproperty=powsybl-core.version -DnewVersion=$CORE_VERSION -DgenerateBackupPoms=false
- name: Change open-loadflow version
run : mvn versions:set-property -Dproperty=powsyblopenloadflow.version -DnewVersion=$LOADFLOW_VERSION -DgenerateBackupPoms=false
- name: Build with Maven
run: |
cat pom.xml || true
mvn clean --batch-mode clean install -DskipTests
- name: Get entsoe version
run : echo "ENTSOE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV

#BUILD DYNAWO
- name: Check for SNAPSHOT branch
run: |
SNAPSHOT_BRANCH=$(git ls-remote --heads https://github.com/powsybl/powsybl-dynawo.git | grep 'refs/heads/.*SNAPSHOT' | sed 's/.*refs\/heads\///')
if [ -n "$SNAPSHOT_BRANCH" ]; then
echo "SNAPSHOT VERSION EXIST: $SNAPSHOT_BRANCH"
echo "SNAPSHOT_EXIST=true" >> $GITHUB_ENV
echo "SNAPSHOT_BRANCH=$SNAPSHOT_BRANCH" >> $GITHUB_ENV
else
echo "No SNAPSHOT branch found"
echo "SNAPSHOT_EXIST=false" >> $GITHUB_ENV
echo "SNAPSHOT_BRANCH=main" >> $GITHUB_ENV
fi
- name: Checkout dynawo-sources
uses: actions/checkout@v4
with:
repository: powsybl/powsybl-dynawo
ref: ${{ env.SNAPSHOT_BRANCH }}
- name: Change core version
run : mvn versions:set-property -Dproperty=powsybl-core.version -DnewVersion=$CORE_VERSION -DgenerateBackupPoms=false
- name: Build with Maven
run: |
cat pom.xml || true
mvn --batch-mode clean install -DskipTests
- name: Get dynawo version
run : echo "DYNAWO_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV

#CHECKOUT_PYPOWSYBL_DEPENCIES
- name: Checkout powsybl-depencies
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

#UPDATE/INSTALL_PYPOWSYBL_DEPENCIES
- name: Update dependencies versions
run: |
mvn versions:set-property -Dproperty=powsybl-core.version -DnewVersion=$CORE_VERSION -DgenerateBackupPoms=false
mvn versions:set-property -Dproperty=powsybl-open-loadflow.version -DnewVersion=$LOADFLOW_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
cat pom.xml || true
- name: Install powsybl-dependencies
run: mvn clean install


#BUILD PYPOWSYBL
- name: Checkout sources
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
cat pom.xml || true
- name: Install dependencies
run: pip3 install -r requirements.txt

- name: Build wheel
run: |
python3 setup.py bdist_wheel
- name: Install wheel
run: pip3 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 in subdir to use installed lib, not sources
run: pytest




4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pip# PyPowSyBl
# PyPowSyBl

[![Actions Status](https://github.com/powsybl/pypowsybl/workflows/CI/badge.svg)](https://github.com/powsybl/pypowsybl/actions)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=powsybl_pypowsybl&metric=alert_status)](https://sonarcloud.io/dashboard?id=powsybl_pypowsybl)
Expand Down Expand Up @@ -107,7 +107,7 @@ mode of installation:

```bash
pip install -e .
# or, to build the C extension with debug $JAVAsymbols:
# or, to build the C extension with debug symbols:
python setup.py build --debug develop --user
```

Expand Down
2 changes: 1 addition & 1 deletion java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<junit-jupiter.version>5.10.0</junit-jupiter.version>
<mapdb.version>3.0.8</mapdb.version>
<maven-dependency-plugin.version>3.6.0</maven-dependency-plugin.version>
<powsybl-dependencies.version>2024.2.0-SNAPSHOT</powsybl-dependencies.version>
<powsybl-dependencies.version>2024.3.0-SNAPSHOT</powsybl-dependencies.version>
<powsybl-open-reac.version>0.7.0</powsybl-open-reac.version>
<zstdjni.version>1.5.5-3</zstdjni.version>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.powsybl.dataframe.update.StringSeries;
import com.powsybl.dataframe.update.UpdatingDataframe;
import com.powsybl.dynamicsimulation.DynamicModel;
import com.powsybl.dynawaltz.models.generators.SynchronizedGeneratorBuilder;
import com.powsybl.dynawo.models.generators.SynchronizedGeneratorBuilder;
import com.powsybl.iidm.network.Network;
import com.powsybl.python.dynamic.PythonDynamicModelsSupplier;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,8 @@ public Set<String> listNames(String regex) throws IOException {
}
return names;
}
@Override
public boolean isDataExtension(String ext) {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
package com.powsybl.python.dynamic;

import com.powsybl.commons.report.ReportNode;
import com.powsybl.dynamicsimulation.Curve;
import com.powsybl.dynamicsimulation.CurvesSupplier;
import com.powsybl.dynawaltz.curves.DynawoCurvesBuilder;
import com.powsybl.dynamicsimulation.OutputVariable;
import com.powsybl.dynamicsimulation.OutputVariablesSupplier;
import com.powsybl.dynawo.outputvariables.DynawoOutputVariablesBuilder;
import com.powsybl.iidm.network.Network;

import java.util.Collection;
Expand All @@ -20,16 +20,16 @@
/**
* @author Nicolas Pierre <nicolas.pierre@artelys.com>
*/
public class CurveMappingSupplier implements CurvesSupplier {
public class CurveMappingSupplier implements OutputVariablesSupplier {

private final List<Curve> curves;
private final List<OutputVariable> outputvariables;

public CurveMappingSupplier() {
curves = new LinkedList<>();
outputvariables = new LinkedList<>();
}

public void addCurve(String dynamicId, String variable) {
curves.addAll(new DynawoCurvesBuilder().dynamicModelId(dynamicId).variable(variable).build());
outputvariables.addAll(new DynawoOutputVariablesBuilder().dynamicModelId(dynamicId).variable(variable).build());
}

public void addCurves(String dynamicId, Collection<String> variablesCol) {
Expand All @@ -39,13 +39,13 @@ public void addCurves(String dynamicId, Collection<String> variablesCol) {
}

@Override
public List<Curve> get(Network network, ReportNode reportNode) {
public List<OutputVariable> get(Network network, ReportNode reportNode) {
return get(network);
}

@Override
public List<Curve> get(Network network) {
return curves;
public List<OutputVariable> get(Network network) {
return outputvariables;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.powsybl.commons.report.ReportNode;
import com.powsybl.dynamicsimulation.EventModel;
import com.powsybl.dynamicsimulation.EventModelsSupplier;
import com.powsybl.dynawaltz.models.events.EventDisconnectionBuilder;
import com.powsybl.dynawo.models.events.EventDisconnectionBuilder;
import com.powsybl.iidm.network.Network;
import com.powsybl.iidm.network.TwoSides;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
import com.powsybl.commons.report.ReportNode;
import com.powsybl.dynamicsimulation.DynamicModel;
import com.powsybl.dynamicsimulation.DynamicModelsSupplier;
import com.powsybl.dynawaltz.models.automationsystems.overloadmanagments.DynamicOverloadManagementSystemBuilder;
import com.powsybl.dynawaltz.models.generators.SynchronizedGeneratorBuilder;
import com.powsybl.dynawaltz.models.loads.BaseLoadBuilder;
import com.powsybl.dynawaltz.models.loads.LoadOneTransformerBuilder;
import com.powsybl.dynawo.models.automationsystems.overloadmanagments.DynamicOverloadManagementSystemBuilder;
import com.powsybl.dynawo.models.generators.SynchronizedGeneratorBuilder;
import com.powsybl.dynawo.models.loads.BaseLoadBuilder;
import com.powsybl.dynawo.models.loads.LoadOneTransformerBuilder;
import com.powsybl.iidm.network.Network;
import com.powsybl.iidm.network.TwoSides;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,10 @@ public InputStream newInputStream(String fileName) {
public Set<String> listNames(String regex) {
throw new UnsupportedOperationException();
}

@Override
public boolean isDataExtension(String ext) {
return true;
}

}
14 changes: 7 additions & 7 deletions tests/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -1027,19 +1027,19 @@ def test_dangling_lines():
# test boundary point columns
n = pp.network.create_micro_grid_be_network()
dangling_lines = n.get_dangling_lines(attributes=['p', 'q',
'boundary_p', 'boundary_q', 'boundary_v_mag', 'boundary_v_angle'])
'boundary_p', 'boundary_q'])
expected = pd.DataFrame(
index=pd.Series(name='id', data=['17086487-56ba-4979-b8de-064025a6b4da',
'78736387-5f60-4832-b3fe-d50daf81b0a6',
'b18cd1aa-7808-49b9-a7cf-605eaf07b006',
'a16b4a6c-70b1-4abf-9a9d-bd0fa47f9fe4',
'ed0c5d75-4a54-43c8-b782-b20d7431630b']),
columns=['p', 'q', 'boundary_p', 'boundary_q', 'boundary_v_mag', 'boundary_v_angle'],
data=[[-25.77, -2.82, 27.36, -0.42, 225.49, -5.58],
[-36.59, 54.18, 46.81, -79.19, 411.15, -6.58],
[-82.84, 138.45, 90.03, -148.60, 410.88, -6.57],
[-23.83, 1.27, 26.80, -1.48, 224.96, -5.63],
[-36.85, 80.68, 43.68, -84.87, 412.61, -6.74]])
columns=['p', 'q', 'boundary_p', 'boundary_q'],
data=[[-25.77, -2.82, 27.36, -0.42],
[-36.59, 54.18, 46.81, -79.19],
[-82.84, 138.45, 90.03, -148.60],
[-23.83, 1.27, 26.80, -1.48],
[-36.85, 80.68, 43.68, -84.87]])


print(dangling_lines)
Expand Down

0 comments on commit 51e5f18

Please sign in to comment.