fixing python project #1
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: Build and Test | |
| on: | |
| push: | |
| branches: [ main, master, develop ] | |
| pull_request: | |
| branches: [ main, master ] | |
| release: | |
| types: [published] | |
| jobs: | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
| cuda-version: ["11.8", "12.1"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install CUDA Toolkit | |
| if: matrix.os == 'ubuntu-latest' | |
| uses: Jimver/cuda-toolkit@v0.2.11 | |
| with: | |
| cuda: ${{ matrix.cuda-version }} | |
| - name: Install system dependencies | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake build-essential ninja-build libboost-all-dev | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build wheel setuptools cmake pybind11 ninja | |
| pip install pytest pytest-cov numpy matplotlib scipy | |
| - name: Build package (superbuild) | |
| run: | | |
| python -m build --wheel | |
| - name: Install package | |
| run: | | |
| pip install dist/*.whl | |
| - name: Run tests | |
| run: | | |
| pytest odevis/python/tests/ -v | |
| build-wheel: | |
| if: github.event_name == 'release' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.10" | |
| - name: Install CUDA Toolkit | |
| uses: Jimver/cuda-toolkit@v0.2.11 | |
| with: | |
| cuda: "12.1" | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake build-essential ninja-build libboost-all-dev | |
| - name: Install build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build twine cmake pybind11 ninja | |
| - name: Build wheel | |
| run: | | |
| python -m build | |
| - name: Upload to PyPI | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
| run: | | |
| twine upload dist/* |