Skip to content

updated tests.yml with lint and setup with windows build #19

updated tests.yml with lint and setup with windows build

updated tests.yml with lint and setup with windows build #19

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install build dependencies (Windows)
if: runner.os == 'Windows'
run: |
python -m pip install --upgrade pip setuptools wheel build
choco install visualstudio2019buildtools --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64"
choco install windows-sdk-10.0
- name: Set up MSVC (Windows)
if: runner.os == 'Windows'
uses: microsoft/[email protected]
- name: Build Windows Extension
if: runner.os == 'Windows'
shell: cmd
run: |
if not exist "optimrl\c_src" mkdir "optimrl\c_src"
python setup.py build_ext --inplace
for /r "build" %%i in (libgrpo.dll) do copy "%%i" "optimrl\c_src\"
- name: Install package
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -e '.[test]'
- name: Run tests
run: pytest tests/ -v
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install linting tools
run: |
python -m pip install --upgrade pip
pip install black==23.12.1 isort==5.13.2 flake8==7.0.0
- name: Format code
run: |
black optimrl tests
isort optimrl tests
git config --global user.email "[email protected]"
git config --global user.name "CI"
git add .
git commit -m "Apply code formatting" || true
git push origin HEAD:${{ github.head_ref }} || true
- name: Check flake8
run: flake8 optimrl tests