From 5d8d97ffdce9ec8be9d7f0d5cce2fbb003928b19 Mon Sep 17 00:00:00 2001 From: DONNOT Benjamin Date: Thu, 25 Jul 2024 09:19:03 +0200 Subject: [PATCH] attempt to fix CI --- .circleci/config.yml | 12 ++++-- .github/workflows/main.yml | 40 ++++++++++++------- .../convert_from_grid2op.py | 4 +- lightsim2grid/tests/test_Deactivatedbus.py | 4 +- lightsim2grid/tests/test_fdpf.py | 1 - lightsim2grid/tests/test_nr_case300.py | 2 - 6 files changed, 37 insertions(+), 26 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 237aca7..a94d180 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -63,12 +63,14 @@ jobs: resource_class: small steps: - checkout - - run: apt-get update && apt-get install python3.10-full python3.10-dev python3.10-pip python3.10-virtualenv git -y - - run: python3.12 -m virtualenv venv_test + - run: apt-get update && apt-get install --reinstall ca-certificates -y + - run: add-apt-repository 'ppa:deadsnakes/ppa' -y + - run: apt-get update && install python3.10-full python3.10-dev python3.10-pip python3.10-virtualenv git -y + - run: python3.10 -m virtualenv venv_test - run: name: Get python version command: - python3.12 --version + python3.10 --version - run: name: "Set up virtual environment" command: | @@ -205,6 +207,8 @@ jobs: resource_class: medium steps: - checkout + - run: apt-get update && apt-get install --reinstall ca-certificates -y + - run: add-apt-repository 'ppa:deadsnakes/ppa' -y - run: apt-get update && apt-get install python3.12-full python3.12-dev python3.12-pip python3.12-virtualenv git -y - run: name: Get python version @@ -413,6 +417,8 @@ jobs: resource_class: medium steps: - checkout + - run: apt-get update && apt-get install --reinstall ca-certificates -y + - run: add-apt-repository 'ppa:deadsnakes/ppa' -y - run: apt-get update && apt-get install python3.12-full python3.12-dev python3.12-pip python3.12-virtualenv git -y - run: name: Get python version diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 46a6ed5..851d5fa 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -113,7 +113,7 @@ jobs: python3 -c "from lightsim2grid.timeSerie import TimeSeriesCPP" python3 -c "from lightsim2grid.contingencyAnalysis import ContingencyAnalysisCPP" python3 -c "from lightsim2grid.securityAnalysis import SecurityAnalysisCPP" - python3 -c "from lightsim2grid.gridmodel import init, GridModel" + python3 -c "from lightsim2grid.gridmodel import GridModel" - name: Fix urllib3 (python 3.7) if: matrix.python.name == 'cp37' @@ -134,6 +134,7 @@ jobs: python3 -c "from lightsim2grid.contingencyAnalysis import ContingencyAnalysis" python3 -c "from lightsim2grid.physical_law_checker import PhysicalLawChecker" python3 -c "from lightsim2grid.securityAnalysis import SecurityAnalysis" + python3 -c "from lightsim2grid.gridmodel import init_from_pandapower" - name: Check LightSimBackend can be used to create env run: @@ -242,22 +243,30 @@ jobs: shell: bash run: python -m pip install dist/*.whl --user - - name: Check package can be imported + - name: Check package can be imported (bare install) run: | mkdir tmp_for_import_checking cd tmp_for_import_checking - python -c "import lightsim2grid" - python -c "from lightsim2grid import *" - python -c "from lightsim2grid.newtonpf import newtonpf" - cd .. + python3 -c "import lightsim2grid" + python3 -c "from lightsim2grid import *" + python3 -c "from lightsim2grid.newtonpf import newtonpf" + python3 -c "from lightsim2grid.timeSerie import TimeSeriesCPP" + python3 -c "from lightsim2grid.contingencyAnalysis import ContingencyAnalysisCPP" + python3 -c "from lightsim2grid.securityAnalysis import SecurityAnalysisCPP" + python3 -c "from lightsim2grid.gridmodel import GridModel" - - name: Check LightSimBackend can be imported + - name: Check LightSimBackend can be imported (with grid2op) run: | - cd tmp_for_import_checking python -m pip install grid2op + cd tmp_for_import_checking python -c "from lightsim2grid import LightSimBackend" python -c "from lightsim2grid import LightSimBackend; import grid2op; env = grid2op.make('l2rpn_case14_sandbox', test=True, backend=LightSimBackend())" - + python -c "from lightsim2grid.timeSerie import TimeSerie" + python -c "from lightsim2grid.contingencyAnalysis import ContingencyAnalysis" + python -c "from lightsim2grid.physical_law_checker import PhysicalLawChecker" + python -c "from lightsim2grid.securityAnalysis import SecurityAnalysis" + python -c "from lightsim2grid.gridmodel import init_from_pandapower" + # - name: Debug windows CI # run: | # python -m unittest lightsim2grid.tests.test_n1contingencyrewards.TestN1ContingencyReward_Base.test_do_nothing @@ -374,7 +383,7 @@ jobs: python -c "from lightsim2grid.timeSerie import TimeSeriesCPP" python -c "from lightsim2grid.contingencyAnalysis import ContingencyAnalysisCPP" python -c "from lightsim2grid.securityAnalysis import SecurityAnalysisCPP" - python -c "from lightsim2grid.gridmodel import init, GridModel" + python -c "from lightsim2grid.gridmodel import GridModel" - name: Fix urllib3 (python 3.7) if: matrix.python.name == 'cp37' @@ -395,6 +404,7 @@ jobs: python -c "from lightsim2grid.contingencyAnalysis import ContingencyAnalysis" python -c "from lightsim2grid.physical_law_checker import PhysicalLawChecker" python -c "from lightsim2grid.securityAnalysis import SecurityAnalysis" + python -c "from lightsim2grid.gridmodel import init_from_pandapower" - name: Check LightSimBackend can be used to create env run: | @@ -510,10 +520,12 @@ jobs: python -c "import lightsim2grid" && python -c "from lightsim2grid import *" && python -c "from lightsim2grid.newtonpf import newtonpf" && - python -c "from lightsim2grid.timeSerie import TimeSeriesCPP" && - python -c "from lightsim2grid.contingencyAnalysis import ContingencyAnalysisCPP" && - python -c "from lightsim2grid.securityAnalysis import SecurityAnalysisCPP" && - python -c "from lightsim2grid.gridmodel import init, GridModel" + python -c "from lightsim2grid.timeSerie import TimeSeriesCPP, TimeSerie" && + python -c "from lightsim2grid.contingencyAnalysis import ContingencyAnalysisCPP, ContingencyAnalysis" && + python -c "from lightsim2grid.securityAnalysis import SecurityAnalysisCPP, SecurityAnalysis" && + python -c "from lightsim2grid.gridmodel import GridModel, init_from_pandapower" && + python -c "from lightsim2grid import LightSimBackend" && + python -c "from lightsim2grid.physical_law_checker import PhysicalLawChecker" - name: Upload wheel uses: actions/upload-artifact@v3 with: diff --git a/lightsim2grid/tests/case_14_storage_iidm/convert_from_grid2op.py b/lightsim2grid/tests/case_14_storage_iidm/convert_from_grid2op.py index ea7d582..b46016d 100644 --- a/lightsim2grid/tests/case_14_storage_iidm/convert_from_grid2op.py +++ b/lightsim2grid/tests/case_14_storage_iidm/convert_from_grid2op.py @@ -13,9 +13,7 @@ import pypowsybl.network as pypo_n import grid2op -from lightsim2grid.gridmodel import init_from_pandapower -from lightsim2grid.gridmodel import init_from_pypowsybl - +from lightsim2grid.gridmodel import init_from_pandapower, init_from_pypowsybl def get_voltage_level_id(el, nb_dig_bus): diff --git a/lightsim2grid/tests/test_Deactivatedbus.py b/lightsim2grid/tests/test_Deactivatedbus.py index 26a3cc9..c28f64f 100644 --- a/lightsim2grid/tests/test_Deactivatedbus.py +++ b/lightsim2grid/tests/test_Deactivatedbus.py @@ -6,12 +6,10 @@ # SPDX-License-Identifier: MPL-2.0 # This file is part of LightSim2grid, LightSim2grid implements a c++ backend targeting the Grid2Op platform. -import os import unittest import copy import numpy as np -from scipy import sparse -from lightsim2grid.gridmodel import init +from lightsim2grid.gridmodel import init_from_pandapower import pandapower.networks as pn import pandapower as pp import warnings diff --git a/lightsim2grid/tests/test_fdpf.py b/lightsim2grid/tests/test_fdpf.py index 2120f82..bab4664 100644 --- a/lightsim2grid/tests/test_fdpf.py +++ b/lightsim2grid/tests/test_fdpf.py @@ -8,7 +8,6 @@ import warnings import numpy as np -from scipy.sparse import csc_matrix from lightsim2grid_cpp import FDPFMethod from lightsim2grid.gridmodel import init_from_pandapower diff --git a/lightsim2grid/tests/test_nr_case300.py b/lightsim2grid/tests/test_nr_case300.py index e0f7d6a..5c8c972 100644 --- a/lightsim2grid/tests/test_nr_case300.py +++ b/lightsim2grid/tests/test_nr_case300.py @@ -8,10 +8,8 @@ import warnings import numpy as np -from scipy.sparse import csc_matrix from lightsim2grid.gridmodel import init_from_pandapower -from lightsim2grid.solver import SolverType import pandapower.networks as pn import pandapower as pp