Skip to content

Merge branch 'master' into env_recorder #5

Merge branch 'master' into env_recorder

Merge branch 'master' into env_recorder #5

Workflow file for this run

name: CI
on:
push:
branches:
- '*'
tags:
- 'v*.*.*'
jobs:
manylinux_build:
name: Build linux ${{ matrix.python.name }} wheel
runs-on: ubuntu-latest
container: quay.io/pypa/manylinux_2_28_x86_64
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
GHA_USE_NODE_20: false
strategy:
matrix:
python:
- {
name: cp38,
abi: cp38,
version: '3.8',
}
- {
name: cp39,
abi: cp39,
version: '3.9',
}
- {
name: cp310,
abi: cp310,
version: '3.10',
}
- {
name: cp311,
abi: cp311,
version: '3.11',
}
- {
name: cp312,
abi: cp312,
version: '3.12',
}
- {
name: cp313,
abi: cp313,
version: '3.13',
}
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: true
- name: Setup path
run: echo "/opt/python/${{ matrix.python.name }}-${{ matrix.python.abi }}/bin/" >> $GITHUB_PATH
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip wheel setuptools build
- name: Rename pyproject_38.toml file (python 3.8)
if: matrix.python.name == 'cp38'
run: |
rm pyproject.toml
cp pyproject_38.toml pyproject.toml
- name: Build wheel
run: |
python -m build --wheel .
- name: Install wheel
run: |
pip3 install dist/*.whl
pip freeze
- name: Check package can be imported
run: |
python -c "import grid2op"
python -c "from grid2op import *"
python -c "from grid2op.Action._backendAction import _BackendAction"
# - name: Run full tests + code coverage
# if: matrix.python.name == 'cp312'
# run: |
# python -m pip install --upgrade coverage
# python -m pip install --find-links=dist/ grid2op[test]
# cd grid2op/tests
# coverage run -m unittest discover
# coverage xml -i
# - name: Upload coverage
# if: matrix.python.name == 'cp312'
# uses: actions/upload-artifact@v4
# with:
# name: coverage.xml
# path: grid2op/tests/*.xml
- name: List wheel
run:
ls ./dist/*.whl
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: grid2op-wheel-${{ matrix.python.name }}
path: dist/*.whl
macos_windows_build:
name: Build ${{ matrix.config.name }} ${{ matrix.python.name }} wheel
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- {
name: darwin,
os: macos-latest,
}
- {
name: windows,
os: windows-2022,
}
python:
- {
name: cp38,
version: '3.8',
}
- {
name: cp39,
version: '3.9',
}
- {
name: cp310,
version: '3.10',
}
- {
name: cp311,
version: '3.11',
}
- {
name: cp312,
version: '3.12',
}
- {
name: cp313,
version: '3.13',
}
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: true
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python.version }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip wheel setuptools build
- name: Rename pyproject_38.toml file (python 3.8 - macos)
if: ((matrix.python.name == 'cp38') && (matrix.config.name == 'darwin'))
run: |
rm pyproject.toml
cp pyproject_38.toml pyproject.toml
- name: Rename pyproject_38.toml file (python 3.8 - windows)
if: ((matrix.python.name == 'cp38') && (matrix.config.name == 'windows'))
run: |
del pyproject.toml
cp pyproject_38.toml pyproject.toml
- name: Build wheel
run: python -m build --wheel .
- name: Install wheel
shell: bash
run: |
python -m pip install dist/*.whl --user
pip freeze
- name: Check package can be imported
run: |
python -c "import grid2op"
python -c "from grid2op import *"
python -c "from grid2op.Action._backendAction import _BackendAction"
- name: Build source archive
if: matrix.config.name == 'darwin' && matrix.python.name == 'cp310'
run: python -m build --sdist .
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: grid2op-wheel-${{ matrix.config.name }}-${{ matrix.python.name }}
path: dist/*.whl
- name: Upload source archive
uses: actions/upload-artifact@v4
if: matrix.config.name == 'darwin' && matrix.python.name == 'cp310'
with:
name: grid2op-sources
path: dist/*.tar.gz
auto_class_in_file:
name: Test ${{ matrix.config.name }} OS can handle automatic class generation for python ${{matrix.python.version}}
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- {
name: darwin,
os: macos-latest,
}
# - {
# name: windows,
# os: windows-2022,
# }
- {
name: ubuntu,
os: ubuntu-latest,
}
python:
- {
name: cp39,
version: '3.9',
}
- {
name: cp313,
version: '3.13',
}
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: true
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python.version }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip wheel setuptools gymnasium build
- name: Build wheel
run: python -m build --wheel .
- name: Install wheel
shell: bash
run: |
python -m pip install dist/*.whl --user
pip freeze
- name: Test the automatic generation of classes in the env folder
run: |
python -m unittest grid2op/tests/automatic_classes.py -v -f
package:
name: Test install
runs-on: ubuntu-latest
needs: [manylinux_build, macos_windows_build, auto_class_in_file]
steps:
- name: Download wheels
uses: actions/download-artifact@v4
with:
path: download
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: grid2op-wheels
path: |
download/**/*.whl
download/**/*.tar.gz