snapshot ci #38
Workflow file for this run
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: Snapshot CI | |
env: | |
CORE_VERSION: '' | |
LOADFLOW_VERSION: '' | |
DIAGRAM_VERSION: '' | |
ENTSOE_VERSION: '' | |
OPENRAO_VERSION: '' | |
DYNAWO_VERSION: '' | |
DEPENDENCIES_VERSION: '' | |
on: | |
push: | |
branches: | |
# on all branches except main where full build will be run | |
- '*' | |
- '!main' | |
jobs: | |
build_dependencies: | |
name: Build linux ${{ matrix.python.name }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python: | |
- name: python3.8, | |
version: '3.8' | |
- name: python3.9, | |
version: '3.9' | |
fail-fast: false | |
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: | |
python-version: ${{ matrix.python.version }} | |
- 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 }} | |
#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 | |
- name : Get core version | |
run : echo "CORE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV | |
#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 | |
- name: Checkout loadflow-sources | |
uses: actions/checkout@v4 | |
with: | |
repository: powsybl/powsybl-open-loadflow | |
ref: ${{ env.SNAPSHOT_BRANCH }} | |
- 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 | |
- 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 | |
- name: Checkout diagram-sources | |
uses: actions/checkout@v4 | |
with: | |
repository: powsybl/powsybl-diagram | |
ref: ${{ env.SNAPSHOT_BRANCH }} | |
- 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 | |
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 | |
- name: Checkout entsoe-sources | |
uses: actions/checkout@v4 | |
with: | |
repository: powsybl/powsybl-entsoe | |
ref: ${{ env.SNAPSHOT_BRANCH }} | |
- 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 -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 | |
- 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 -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 -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 | |
- name: Checkout dynawo-sources | |
uses: actions/checkout@v4 | |
with: | |
repository: powsybl/powsybl-dynawo | |
ref: ${{ env.SNAPSHOT_BRANCH }} | |
- 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 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-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 | |
- name: Install powsybl-dependencies | |
run : mvn -batch-mode --no-transfer-progress clean install -DskipTests | |
#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 tests | |
working-directory: ./tests # Run in subdir to use installed lib, not sources | |
run: pytest | |
- name: Upload wheel | |
uses: actions/upload-artifact@v3 | |
with: | |
name: pypowsybl-wheel-linux-${{ matrix.python.name }} | |
path: dist/*.whl | |
- name: check pypowsybl versions | |
working-directory: ./tests | |
run: python3 basic_import_test.py | |