Skip to content

Commit 193c6c0

Browse files
committed
updated tests.yml with lint and setup with windows build
1 parent 2b4a9d3 commit 193c6c0

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

.github/workflows/tests.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
- name: Install build dependencies (Windows)
2727
if: runner.os == 'Windows'
2828
run: |
29+
python -m pip install --upgrade pip setuptools wheel build
2930
choco install visualstudio2019buildtools --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64"
3031
choco install windows-sdk-10.0
3132
@@ -35,10 +36,11 @@ jobs:
3536

3637
- name: Build Windows Extension
3738
if: runner.os == 'Windows'
39+
shell: cmd
3840
run: |
41+
if not exist "optimrl\c_src" mkdir "optimrl\c_src"
3942
python setup.py build_ext --inplace
40-
mkdir -p optimrl/c_src
41-
Copy-Item build\lib.win-amd64*\optimrl\c_src\libgrpo.dll optimrl\c_src\
43+
for /r "build" %%i in (libgrpo.dll) do copy "%%i" "optimrl\c_src\"
4244
4345
- name: Install package
4446
run: |
@@ -63,8 +65,15 @@ jobs:
6365
python -m pip install --upgrade pip
6466
pip install black==23.12.1 isort==5.13.2 flake8==7.0.0
6567
66-
- name: Check code style
68+
- name: Format code
6769
run: |
68-
black --check optimrl tests
69-
isort --check-only optimrl tests
70-
flake8 optimrl tests
70+
black optimrl tests
71+
isort optimrl tests
72+
git config --global user.email "[email protected]"
73+
git config --global user.name "CI"
74+
git add .
75+
git commit -m "Apply code formatting" || true
76+
git push origin HEAD:${{ github.head_ref }} || true
77+
78+
- name: Check flake8
79+
run: flake8 optimrl tests

optimrl/core.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,18 @@ def __init__(self, epsilon=0.2, beta=0.1):
7373
def _find_library_path(self):
7474
current_dir = os.path.dirname(os.path.abspath(__file__))
7575
lib_name = {
76-
'Windows': 'libgrpo.dll',
77-
'Darwin': 'libgrpo.dylib',
78-
'Linux': 'libgrpo.so'
76+
"Windows": "libgrpo.dll",
77+
"Darwin": "libgrpo.dylib",
78+
"Linux": "libgrpo.so",
7979
}[platform.system()]
80-
80+
8181
search_paths = [
8282
os.path.join(current_dir, "c_src"),
8383
current_dir,
8484
os.path.join(os.path.dirname(current_dir), "c_src"),
85-
os.path.join(sys.prefix, "lib")
85+
os.path.join(sys.prefix, "lib"),
8686
]
87-
87+
8888
for path in search_paths:
8989
full_path = os.path.normpath(os.path.join(path, lib_name))
9090
if os.path.exists(full_path):

0 commit comments

Comments
 (0)