updated setup.py tests.yml #17
This file contains hidden or 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
| 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: | | |
| 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' | |
| run: | | |
| python setup.py build_ext --inplace | |
| mkdir -p optimrl/c_src | |
| Copy-Item build\lib.win-amd64*\optimrl\c_src\libgrpo.dll 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: Create linting configs | |
| run: | | |
| echo "[flake8] | |
| max-line-length = 100 | |
| exclude = .git,__pycache__,build,dist,*.egg-info | |
| ignore = E203,W503 | |
| per-file-ignores = __init__.py:F401" > .flake8 | |
| echo "[tool.isort] | |
| profile = \"black\" | |
| line_length = 100 | |
| skip = [\"site-packages\", \"__pycache__\"]" >> pyproject.toml | |
| - name: Format code | |
| run: | | |
| black optimrl tests | |
| isort optimrl tests | |
| - name: Check code style | |
| run: | | |
| black --check optimrl tests | |
| isort --check-only optimrl tests | |
| flake8 optimrl tests |