snapshot ci #44
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 | |
on: | |
workflow_dispatch: | |
push: | |
schedule: | |
- cron: '0 3 * * *' | |
env: | |
SCRIPT_PATH: .pypowsybl/.github/workflows/script/check_snapshot_branch.sh | |
jobs: | |
buil_pypowsybl: | |
name: Build ${{ matrix.config.name }} ${{ matrix.python.name }} wheel | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
matrix: | |
config: | |
- { name: ubuntu, os: ubuntu-latest} | |
python: | |
- { name: cp38, version: '3.8' } | |
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 }} | |
#BUILD CORE | |
- name: Checkout core-sources | |
uses: actions/checkout@v4 | |
with: | |
repository: powsybl/powsybl-core | |
ref: main | |
path: powsybl-core | |
- name: Build with Maven | |
run: mvn -batch-mode --no-transfer-progress clean install -DskipTests | |
working-directory: ./powsybl-core | |
shell: bash | |
- name: Get core version | |
run: echo "CORE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV | |
working-directory: ./powsybl-core | |
shell: bash | |
#CHECKOUT PYPOSSYBL | |
- name: Checkout repository for script | |
uses: actions/checkout@v4 | |
with: | |
path: pypowsybl | |
submodules: true | |
#BUILD LOADFLOW | |
- name: Check SNAPSHOT branch | |
run : ${{ env.SCRIPT_PATH }} "https://github.com/powsybl/powsybl-open-loadflow.git" ${{ env.CORE_VERSION }} | |
- name: Checkout loadflow-sources | |
uses: actions/checkout@v4 | |
with: | |
repository: powsybl/powsybl-open-loadflow | |
ref: ${{ env.SNAPSHOT_BRANCH }} | |
path: powsybl-open-loadflow | |
- name: Change core version | |
run: | | |
if [ ${{ matrix.config.name }} == "ubuntu" ] ; then | |
sed -i 's|<powsybl-core.version>.*</powsybl-core.version>|<powsybl-core.version>'"$CORE_VERSION"'</powsybl-core.version>|' pom.xml | |
fi | |
shell: bash | |
working-directory: ./powsybl-open-loadflow | |
- name: Build with Maven | |
run: | | |
mvn -batch-mode --no-transfer-progress clean install -DskipTests | |
working-directory: ./powsybl-open-loadflow | |
- name: Get loadflow version | |
run: echo "LOADFLOW_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV | |
working-directory: ./powsybl-open-loadflow | |
shell: bash | |
#BUILD DIAGRAM | |
- name: Check for SNAPSHOT branch | |
run : ${{ env.SCRIPT_PATH }} "https://github.com/powsybl/powsybl-diagram.git" ${{ env.CORE_VERSION }} | |
shell: bash | |
- name: Checkout diagram-sources | |
uses: actions/checkout@v4 | |
with: | |
repository: powsybl/powsybl-diagram | |
ref: ${{ env.SNAPSHOT_BRANCH }} | |
path: powsybl-diagram | |
- name: Change core version | |
run: | | |
if [ ${{ matrix.config.name }} == "ubuntu" ] ; then | |
sed -i 's|<powsybl-core.version>.*</powsybl-core.version>|<powsybl-core.version>'"$CORE_VERSION"'</powsybl-core.version>|' pom.xml | |
fi | |
working-directory: ./powsybl-diagram | |
shell: bash | |
- name: Build with Maven | |
run: mvn -batch-mode --no-transfer-progress clean install -DskipTests | |
working-directory: ./powsybl-diagram | |
- name: Get diagram version | |
run: echo "DIAGRAM_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV | |
working-directory: ./powsybl-diagram | |
shell: bash | |
#BUILD ENTSOE | |
- name: Check for SNAPSHOT branch | |
run : ${{ env.SCRIPT_PATH }} "https://github.com/powsybl/powsybl-entsoe.git" ${{ env.CORE_VERSION }} | |
shell: bash | |
- name: Checkout entsoe-sources | |
uses: actions/checkout@v4 | |
with: | |
repository: powsybl/powsybl-entsoe | |
ref: ${{ env.SNAPSHOT_BRANCH }} | |
path: powsybl-enstoe | |
- name: Change core version | |
run: | | |
if [ ${{ matrix.config.name }} == "ubuntu" ] ; then | |
sed -i 's|<powsyblcore.version>.*</powsyblcore.version>|<powsyblcore.version>'"$CORE_VERSION"'</powsyblcore.version>|' pom.xml | |
fi | |
working-directory: ./powsybl-enstoe | |
shell: bash | |
- name: Change open-loadflow version | |
run: | | |
if [ ${{ matrix.config.name }} == "ubuntu" ] ; then | |
sed -i 's|<powsyblopenloadflow.version>.*</powsyblopenloadflow.version>|<powsyblopenloadflow.version>'"$LOADFLOW_VERSION"'</powsyblopenloadflow.version>|' pom.xml | |
fi | |
working-directory: ./powsybl-enstoe | |
shell: bash | |
- name: Build with Maven | |
run: mvn -batch-mode --no-transfer-progress clean install -DskipTests | |
working-directory: ./powsybl-enstoe | |
- name: Get entsoe version | |
run: echo "ENTSOE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV | |
working-directory: ./powsybl-enstoe | |
shell: bash | |
#BUILD OPENRAO | |
- name: Check for SNAPSHOT branch | |
run : ${{ env.SCRIPT_PATH }} "https://github.com/powsybl/powsybl-open-rao.git" ${{ env.CORE_VERSION }} | |
shell: bash | |
- name: Checkout open-rao-sources | |
uses: actions/checkout@v4 | |
with: | |
repository: powsybl/powsybl-open-rao | |
ref: ${{ env.SNAPSHOT_BRANCH }} | |
path: powsybl-openrao | |
- name: Change core version | |
run: | | |
if [ ${{ matrix.config.name }} == "ubuntu" ] ; then | |
sed -i 's|<powsybl.core.version>.*</powsybl.core.version>|<powsybl.core.version>'"$CORE_VERSION"'</powsybl.core.version>|' pom.xml | |
fi | |
working-directory: ./powsybl-openrao | |
shell: bash | |
- name: Change entsoe version | |
run: | | |
if [ ${{ matrix.config.name }} == "ubuntu" ] ; then | |
sed -i 's|<powsybl.entsoe.version>.*</powsybl.entsoe.version>|<powsybl.entsoe.version>'"$ENTSOE_VERSION"'</powsybl.entsoe.version>|' pom.xml | |
fi | |
working-directory: ./powsybl-openrao | |
shell: bash | |
- name: Change open-loadflow version | |
run: | | |
if [ ${{ matrix.config.name }} == "ubuntu" ] ; then | |
sed -i 's|<powsybl.openloadflow.version>.*</powsybl.openloadflow.version>|<powsybl.openloadflow.version>'"$LOADFLOW_VERSION"'</powsybl.openloadflow.version>|' pom.xml | |
fi | |
working-directory: ./powsybl-openrao | |
shell: bash | |
- name: Build with Maven | |
run: mvn -batch-mode --no-transfer-progress clean install -DskipTests | |
working-directory: ./powsybl-openrao | |
- name: Get open-rao version | |
run: echo "OPENRAO_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV | |
working-directory: ./powsybl-openrao | |
shell: bash | |
#BUILD DYNAWO | |
- name: Check for SNAPSHOT branch | |
run: ${{ env.SCRIPT_PATH }} "https://github.com/powsybl/powsybl-dynawo.git" ${{ env.CORE_VERSION }} | |
shell: bash | |
- name: Checkout dynawo-sources | |
uses: actions/checkout@v4 | |
with: | |
repository: powsybl/powsybl-dynawo | |
ref: ${{ env.SNAPSHOT_BRANCH }} | |
path: powsybl-dynawo | |
- name: Change core version | |
run: | | |
if [ ${{ matrix.config.name }} == "ubuntu" ] ; then | |
sed -i 's|<powsybl-core.version>.*</powsybl-core.version>|<powsybl-core.version>'"$CORE_VERSION"'</powsybl-core.version>|' pom.xml | |
fi | |
working-directory: ./powsybl-dynawo | |
shell: bash | |
- name: Build with Maven | |
run: mvn -batch-mode --no-transfer-progress clean install -DskipTests | |
working-directory: ./powsybl-dynawo | |
- name: Get dynawo version | |
run: echo "DYNAWO_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV | |
working-directory: ./powsybl-dynawo | |
shell: bash | |
#CHECKOUT_PYPOWSYBL_DEPENCIES | |
- name: Checkout powsybl-dependencies | |
uses: actions/checkout@v4 | |
with: | |
repository: powsybl/powsybl-dependencies | |
ref: main | |
path: powsybl-dependencies | |
- name: Get dependencies version | |
run: echo "DEPENDENCIES_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV | |
working-directory: ./powsybl-dependencies | |
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 | |
working-directory: ./powsybl-dependencies | |
- name: Install powsybl-dependencies | |
run: mvn -batch-mode --no-transfer-progress clean install -DskipTests | |
working-directory: ./powsybl-dependencies | |
shell: bash | |
#BUILD PYPOWSYBL | |
- name: update java/pom.xml | |
run: mvn versions:set-property -Dproperty=powsybl-dependencies.version -DnewVersion=$DEPENDENCIES_VERSION -DgenerateBackupPoms=false | |
working-directory: ./pypowsybl/java | |
- name: Install dependencies | |
run: pip3 install -r requirements.txt | |
working-directory: ./pypowsybl | |
- name: Build wheel | |
run: python3 setup.py bdist_wheel | |
working-directory: ./pypowsybl | |
- name: Install wheel | |
run: python -m pip install dist/*.whl --user | |
working-directory: ./pypowsybl | |
- name: check pypowsybl versions | |
working-directory: ./pypowsybl/tests | |
run: python3 basic_import_test.py | |
- name: Run tests | |
working-directory: ./pypowsybl/tests | |
run: pytest | |
- name: Upload wheel | |
uses: actions/upload-artifact@v3 | |
with: | |
name: pypowsybl-wheel-${{ matrix.config.name }}-${{ matrix.python.name }} | |
path: dist/*.whl | |