-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* some improvements * some improvements * try to compile for M1 and M2 apple using cibuildwheel * try to compile for M1 and M2 apple using cibuildwheel * still trying to build lightsim for M1 chip * still trying to build lightsim for M1 chip * still trying to build lightsim for M1 chip * still trying to build lightsim for M1 chip * still trying to build lightsim for M1 chip * still trying to build lightsim for M1 chip * trying to cross compile on macos for M1 * trying to cross compile on macos for M1 / M2 chip * trying to cross compile on macos for M1 / M2 chip * trying to cross compile on macos for M1 / M2 chip * trying to cross compile on macos for M1 / M2 chip * trying to cross compile on macos for M1 / M2 chip * trying to cross compile on macos for M1 / M2 chip * trying to cross compile on macos for M1 / M2 chip * re evaluating the full ci pipeline again * bump to actions/upload-artifact@v3 [skip ci] * ready for version 0.7.4 * small modification to fix issue spotted in sim2real in grid2op
- Loading branch information
Showing
8 changed files
with
200 additions
and
51 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ on: | |
|
||
jobs: | ||
manylinux_build: | ||
# build wheels for some linux | ||
name: Build linux ${{ matrix.python.name }} wheel | ||
runs-on: ubuntu-latest | ||
container: quay.io/pypa/manylinux2014_x86_64 | ||
|
@@ -44,7 +45,7 @@ jobs: | |
steps: | ||
|
||
- name: Checkout sources | ||
uses: actions/checkout@v1 | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
|
||
|
@@ -65,6 +66,10 @@ jobs: | |
python3 setup.py bdist_wheel | ||
auditwheel repair dist/*.whl | ||
- name: Build source archive | ||
if: matrix.python.name == 'cp311' | ||
run: python setup.py sdist | ||
|
||
- name: Install wheel | ||
run: pip3 install wheelhouse/*.whl --user | ||
|
||
|
@@ -85,25 +90,24 @@ jobs: | |
python3 -c "from lightsim2grid import LightSimBackend; import grid2op; env = grid2op.make('l2rpn_case14_sandbox', test=True, backend=LightSimBackend())" | ||
- name: Upload wheel | ||
uses: actions/upload-artifact@v2 | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: lightsim2grid-wheel-linux-${{ matrix.python.name }} | ||
path: wheelhouse/*.whl | ||
|
||
macos_windows_build: | ||
name: Build ${{ matrix.config.name }} ${{ matrix.python.name }} wheel | ||
runs-on: ${{ matrix.config.os }} | ||
- name: Upload source archive | ||
uses: actions/upload-artifact@v3 | ||
if: matrix.python.name == 'cp311' | ||
with: | ||
name: lightsim2grid-sources | ||
path: dist/*.tar.gz | ||
|
||
windows_build: | ||
# build wheels for windows | ||
name: Build windows ${{ matrix.python.name }} wheel | ||
runs-on: windows-2019 | ||
strategy: | ||
matrix: | ||
config: | ||
- { | ||
name: darwin, | ||
os: macos-latest, | ||
} | ||
- { | ||
name: windows, | ||
os: windows-2019, | ||
} | ||
python: | ||
- { | ||
name: cp37, | ||
|
@@ -125,16 +129,19 @@ jobs: | |
name: cp311, | ||
version: '3.11', | ||
} | ||
env: | ||
RUNNER_OS: windows-2019 | ||
PYTHON_VERSION: ${{ matrix.python.version }} | ||
|
||
steps: | ||
|
||
- name: Checkout sources | ||
uses: actions/checkout@v1 | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python.version }} | ||
|
||
|
@@ -143,15 +150,7 @@ jobs: | |
python -m pip install --upgrade pip | ||
python -m pip install -r requirements.txt | ||
- name: Compile SuiteSparse make | ||
if: matrix.config.name == 'darwin' | ||
run: | | ||
make | ||
export __O3_OPTIM=1 | ||
python3 setup.py build | ||
- name: Compile SuiteSparse cmake | ||
if: matrix.config.name == 'windows' | ||
run: | | ||
cd build_cmake | ||
python generate_c_files.py | ||
|
@@ -168,10 +167,6 @@ jobs: | |
- name: Build wheel | ||
run: python setup.py bdist_wheel | ||
|
||
- name: Build source archive | ||
if: matrix.config.name == 'darwin' && matrix.python.name == 'cp39' | ||
run: python setup.py sdist | ||
|
||
- name: Install wheel | ||
shell: bash | ||
run: python -m pip install dist/*.whl --user | ||
|
@@ -189,31 +184,151 @@ jobs: | |
python -c "from lightsim2grid import LightSimBackend; import grid2op; env = grid2op.make('l2rpn_case14_sandbox', test=True, backend=LightSimBackend())" | ||
- name: Upload wheel | ||
uses: actions/upload-artifact@v2 | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: lightsim2grid-wheel-${{ matrix.config.name }}-${{ matrix.python.name }} | ||
path: dist/*.whl | ||
|
||
- name: Upload source archive | ||
uses: actions/upload-artifact@v2 | ||
if: matrix.config.name == 'darwin' && matrix.python.name == 'cp39' | ||
macos_build_37: | ||
# build wheel for python 3.7 for macos | ||
name: Build macos ${{ matrix.python.name }} wheel | ||
runs-on: macos-latest | ||
strategy: | ||
matrix: | ||
python: | ||
- { | ||
name: cp37, | ||
version: '3.7', | ||
} | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
with: | ||
name: lightsim2grid-sources | ||
path: dist/*.tar.gz | ||
submodules: true | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python.version }} | ||
|
||
- name: Install Python dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install -r requirements.txt | ||
- name: Compile SuiteSparse make | ||
run: | | ||
make | ||
export __O3_OPTIM=1 | ||
python3 setup.py build | ||
- name: Build wheel | ||
run: python setup.py bdist_wheel | ||
|
||
- name: Install wheel | ||
shell: bash | ||
run: python -m pip install dist/*.whl --user | ||
|
||
- name: Check package can be imported | ||
run: | | ||
python -c "import lightsim2grid" | ||
python -c "from lightsim2grid import *" | ||
python -c "from lightsim2grid.newtonpf import newtonpf" | ||
- name: Check LightSimBackend can be imported | ||
run: | | ||
python -m pip install grid2op | ||
python -c "from lightsim2grid import LightSimBackend" | ||
python -c "from lightsim2grid import LightSimBackend; import grid2op; env = grid2op.make('l2rpn_case14_sandbox', test=True, backend=LightSimBackend())" | ||
- name: Upload wheel | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: lightsim2grid-wheel-darwin-${{ matrix.python.name }} | ||
path: dist/*.whl | ||
|
||
macos_build_38_: | ||
# build wheel for python 3.8 and above for macos | ||
name: Build darwin ${{ matrix.python.name }} wheel | ||
runs-on: macos-latest | ||
strategy: | ||
matrix: | ||
python: | ||
- { | ||
name: cp38, | ||
version: '3.8', | ||
} | ||
- { | ||
name: cp39, | ||
version: '3.9', | ||
} | ||
- { | ||
name: cp310, | ||
version: '3.10', | ||
} | ||
- { | ||
name: cp311, | ||
version: '3.11', | ||
} | ||
env: | ||
RUNNER_OS: macos-latest | ||
PYTHON_VERSION: ${{ matrix.python.version }} | ||
|
||
steps: | ||
|
||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python.version }} | ||
|
||
- name: Set Additional Envs | ||
shell: bash | ||
run: | | ||
echo "PYTHON_SUBVERSION=$(echo $PYTHON_VERSION | cut -c 3-)" >> $GITHUB_ENV | ||
echo "DEPLOY=$( [[ $GITHUB_EVENT_NAME == 'push' && $GITHUB_REF == 'refs/tags'* ]] && echo 'True' || echo 'False' )" >> $GITHUB_ENV | ||
- name: Compile with cibuildwheel | ||
uses: pypa/[email protected] | ||
env: | ||
CIBW_BUILD: "cp3${{env.PYTHON_SUBVERSION}}-*" # see https://github.com/cvxpy/cvxpy/blob/master/.github/workflows/build.yml | ||
CIBW_ARCHS_LINUX: auto aarch64 # not used I believe | ||
CIBW_ARCHS_MACOS: x86_64 arm64 | ||
CIBW_ENVIRONMENT: __O3_OPTIM=1 | ||
CIBW_BEFORE_BUILD: make clean && make # and not CIBW_BEFORE_ALL ! | ||
CIBW_TEST_REQUIRES: grid2op pandapower | ||
CIBW_TEST_SKIP: "*-macosx_arm64" # to silence warning "While arm64 wheels can be built on x86_64, they cannot be tested." | ||
CIBW_TEST_COMMAND: > | ||
python -c "import lightsim2grid" && | ||
python -c "from lightsim2grid import *" && | ||
python -c "from lightsim2grid.newtonpf import newtonpf" && | ||
python -c "from lightsim2grid.solver import KLUSolver" && | ||
python -c "from lightsim2grid import LightSimBackend" && | ||
python -c "from lightsim2grid import LightSimBackend; import grid2op; env = grid2op.make('l2rpn_case14_sandbox', test=True, backend=LightSimBackend())" | ||
- name: Upload wheel | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: wheels-darwin-${{ matrix.python.name }} | ||
path: ./wheelhouse/*.whl | ||
|
||
package: | ||
name: Package wheels | ||
runs-on: ubuntu-latest | ||
needs: [manylinux_build, macos_windows_build] | ||
needs: [manylinux_build, windows_build, macos_build_37, macos_build_38_] | ||
|
||
steps: | ||
- name: Download wheels | ||
uses: actions/download-artifact@v2 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
path: download | ||
|
||
- name: Upload wheels | ||
uses: actions/upload-artifact@v2 | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: lightsim2grid-wheels | ||
path: | | ||
|
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# this class is defined to avoid circular references when using grid2op -> pandapower -> lightsim2grid -> grid2op | ||
# this module is lazily imported by the LightSimBackend and should not be used anywhere else, | ||
# as the name states | ||
try: | ||
from grid2op.Backend import PandaPowerBackend | ||
class _DoNotUseAnywherePandaPowerBackend(PandaPowerBackend): | ||
"""used to duplicate the class attributes of PandaPowerBackend""" | ||
pass | ||
except ImportError as exc_: | ||
# grid2op is not installed, we do not use it. | ||
pass |
Oops, something went wrong.