Skip to content

Commit

Permalink
snapshot ci
Browse files Browse the repository at this point in the history
Signed-off-by: Leclerc Clement <clement.leclerc@rte-france.com>
  • Loading branch information
clementleclercRTE committed Oct 1, 2024
1 parent 8b31c92 commit 3fee89d
Showing 1 changed file with 65 additions and 178 deletions.
243 changes: 65 additions & 178 deletions .github/workflows/dependencies-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,251 +8,138 @@ on:
- '!main'

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


setup:
runs-on: 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
build_core:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Checkout core-sources
uses: actions/checkout@v4
with:
repository: powsybl/powsybl-core
ref: main
fetch-depth: 1
- name: Build with Maven
run: mvn -batch-mode --no-transfer-progress clean install -DskipTests
- name : Get core version
run : |
echo "CORE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
run: mvn -batch-mode --no-transfer-progress clean install -DskipTests
- name: Get core version
run: echo "CORE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
outputs:
core_version: ${{ env.CORE_VERSION }}

#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' | head -n 1 | 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
- name: Checkout loadflow-sources
uses: actions/checkout@v4
with:
repository: powsybl/powsybl-open-loadflow
ref: ${{ env.SNAPSHOT_BRANCH }}
fetch-depth: 1
- name: Change core version
run : |
sed -i 's|<powsybl-core.version>.*</powsybl-core.version>|<powsybl-core.version>'"$CORE_VERSION"'</powsybl-core.version>|' pom.xml
- name: Build with Maven
run: |
mvn -batch-mode --no-transfer-progress clean install -DskipTests
- name: Get loadflow version
run : echo "LOADFLOW_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV


#BUILD DIAGRAM
build_components:
needs: build_core
runs-on: ubuntu-latest
strategy:
matrix:
component: [ open-loadflow, diagram, entsoe, open-rao, dynawo ]
steps:
- name: Check for SNAPSHOT branch
run: |
SNAPSHOT_BRANCH=$(git ls-remote --heads https://github.com/powsybl/powsybl-diagram.git | grep 'refs/heads/.*SNAPSHOT' | head -n 1 | sed 's/.*refs\/heads\///')
SNAPSHOT_BRANCH=$(git ls-remote --sort=-committerdate --heads https://github.com/powsybl/powsybl-${{ matrix.component }}.git | grep 'refs/heads/.*SNAPSHOT' | head -n 1 | 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
- name: Checkout diagram-sources
- name: Checkout ${{ matrix.component }}-sources
uses: actions/checkout@v4
with:
repository: powsybl/powsybl-diagram
repository: powsybl/powsybl-${{ matrix.component }}
ref: ${{ env.SNAPSHOT_BRANCH }}
fetch-depth: 1
- name: Change core version
run : |
sed -i 's|<powsybl-core.version>.*</powsybl-core.version>|<powsybl-core.version>'"$CORE_VERSION"'</powsybl-core.version>|' pom.xml
- name: Build with Maven
run: |
mvn -batch-mode --no-transfer-progress 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
- name: Update dependencies
run: |
SNAPSHOT_BRANCH=$(git ls-remote --heads https://github.com/powsybl/powsybl-entsoe.git | grep 'refs/heads/.*SNAPSHOT' | head -n 1 | 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
sed -i 's|<powsybl-core.version>.*</powsybl-core.version>|<powsybl-core.version>${{ needs.build_core.outputs.core_version }}</powsybl-core.version>|' pom.xml
if [ "${{ matrix.component }}" = "entsoe" ]; then
sed -i 's|<powsyblcore.version>.*</powsyblcore.version>|<powsyblcore.version>'"$CORE_VERSION"'</powsyblcore.version>|' pom.xml
sed -i 's|<powsyblopenloadflow.version>.*</powsyblopenloadflow.version>|<powsyblopenloadflow.version>'"$LOADFLOW_VERSION"'</powsyblopenloadflow.version>|' pom.xml
fi
- name: Checkout entsoe-sources
uses: actions/checkout@v4
with:
repository: powsybl/powsybl-entsoe
ref: ${{ env.SNAPSHOT_BRANCH }}
fetch-depth: 1
- name: Change core version
run : |
sed -i 's|<powsyblcore.version>.*</powsyblcore.version>|<powsyblcore.version>'"$CORE_VERSION"'</powsyblcore.version>|' pom.xml
- name: Change open-loadflow version
run : |
sed -i 's|<powsyblopenloadflow.version>.*</powsyblopenloadflow.version>|<powsyblopenloadflow.version>'"$LOADFLOW_VERSION"'</powsyblopenloadflow.version>|' pom.xml
- name: Build with Maven
run: |
cat pom.xml || true
mvn -batch-mode --no-transfer-progress clean install -DskipTests
- name: Get entsoe version
run : echo "ENTSOE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV

#BUILD OPENRAO
- name: Check for SNAPSHOT branch
run: |
SNAPSHOT_BRANCH=$(git ls-remote --heads https://github.com/powsybl/powsybl-open-rao.git | grep 'refs/heads/.*SNAPSHOT' | head -n 1 | 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
if [ "${{ matrix.component }}" = "open-rao" ]; then
sed -i 's|<powsybl.core.version>.*</powsybl.core.version>|<powsybl.core.version>'"$CORE_VERSION"'</powsybl.core.version>|' pom.xml
sed -i 's|<powsybl.entsoe.version>.*</powsybl.entsoe.version>|<powsybl.entsoe.version>'"$ENTSOE_VERSION"'</powsybl.entsoe.version>|' pom.xml
sed -i 's|<powsybl.openloadflow.version>.*</powsybl.openloadflow.version>|<powsybl.openloadflow.version>'"$LOADFLOW_VERSION"'</powsybl.openloadflow.version>|' pom.xml
fi
- name: Checkout open-rao-sources
uses: actions/checkout@v4
with:
repository: powsybl/powsybl-open-rao
ref: ${{ env.SNAPSHOT_BRANCH }}
fetch-depth: 1
- name: Change core version
run: |
sed -i 's|<powsybl.core.version>.*</powsybl.core.version>|<powsybl.core.version>'"$CORE_VERSION"'</powsybl.core.version>|' pom.xml
- name: Change entsoe version
run: |
sed -i 's|<powsybl.entsoe.version>.*</powsybl.entsoe.version>|<powsybl.entsoe.version>'"$ENTSOE_VERSION"'</powsybl.entsoe.version>|' pom.xml
- name: Change open-loadflow version
run: |
sed -i 's|<powsybl.openloadflow.version>.*</powsybl.openloadflow.version>|<powsybl.openloadflow.version>'"$LOADFLOW_VERSION"'</powsybl.openloadflow.version>|' pom.xml
- name: Build with Maven
run: |
mvn -batch-mode --no-transfer-progress clean install -DskipTests
- name: Get open-rao version
run : echo "OPENRAO_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' | head -n 1 | 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
- name: Checkout dynawo-sources
uses: actions/checkout@v4
with:
repository: powsybl/powsybl-dynawo
ref: ${{ env.SNAPSHOT_BRANCH }}
fetch-depth: 1
- name: Change core version
run: |
sed -i 's|<powsybl-core.version>.*</powsybl-core.version>|<powsybl-core.version>'"$CORE_VERSION"'</powsybl-core.version>|' pom.xml
- name: Build with Maven
run: |
cat pom.xml || true
mvn -batch-mode --no-transfer-progress clean install -DskipTests
- name: Get dynawo version
run : echo "DYNAWO_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
run: mvn -batch-mode --no-transfer-progress clean install -DskipTests
- name: Get ${{ matrix.component }} version
run: echo "${{ upper(matrix.component) }}_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
outputs:
loadflow_version: ${{ env.LOADFLOW_VERSION }}
diagram_version: ${{ env.DIAGRAM_VERSION }}
entsoe_version: ${{ env.ENTSOE_VERSION }}
open_rao_version: ${{ env.OPEN_RAO_VERSION }}
dynawo_version: ${{ env.DYNAWO_VERSION }}


#CHECKOUT_PYPOWSYBL_DEPENCIES
- name: Checkout powsybl-depencies
build_dependencies:
needs: build_components
runs-on: ubuntu-latest
steps:
- 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

#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
cat pom.xml || true
mvn versions:set-property -Dproperty=powsybl-open-loadflow.version -DnewVersion=${{ needs.build_components.outputs.loadflow_version }} -DgenerateBackupPoms=false
mvn versions:set-property -Dproperty=powsybl-core.version -DnewVersion=${{ needs.build_core.outputs.core_version }} -DgenerateBackupPoms=false
mvn versions:set-property -Dproperty=powsybl-diagram.version -DnewVersion=${{ needs.build_components.outputs.diagram_version }} -DgenerateBackupPoms=false
mvn versions:set-property -Dproperty=powsybl-dynawo.version -DnewVersion=${{ needs.build_components.outputs.dynawo_version }} -DgenerateBackupPoms=false
mvn versions:set-property -Dproperty=powsybl-entsoe.version -DnewVersion=${{ needs.build_components.outputs.entsoe_version }} -DgenerateBackupPoms=false
mvn versions:set-property -Dproperty=powsybl-open-rao.version -DnewVersion=${{ needs.build_components.outputs.open_rao_version }} -DgenerateBackupPoms=false
- name: Install powsybl-dependencies
run : mvn -batch-mode --no-transfer-progress clean install -DskipTests

run: mvn -batch-mode --no-transfer-progress clean install -DskipTests
- name: Get dependencies version
run: echo "DEPENDENCIES_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
outputs:
dependencies_version: ${{ env.DEPENDENCIES_VERSION }}

#BUILD PYPOWSYBL
build_and_test_pypowsybl:
needs: build_dependencies
runs-on: ubuntu-latest
steps:
- 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
run: |
mvn versions:set-property -Dproperty=powsybl-dependencies.version -DnewVersion=${{ needs.build_dependencies.outputs.dependencies_version }} -DgenerateBackupPoms=false
- name: Install dependencies
run: pip3 install -r requirements.txt

- name: Build wheel
run: |
python3 setup.py bdist_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




working-directory: ./tests
run: pytest

0 comments on commit 3fee89d

Please sign in to comment.