Fix/torch review feedback #209
Workflow file for this run
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 & Test | |
| on: | |
| # Triggers the workflow on push or pull request events but only for the master branch | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| # A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
| jobs: | |
| # Build the C++ library & test that it is working using GoogleTest | |
| build-and-test-cpp: | |
| name: C/C++ Library on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [windows-latest, ubuntu-latest, macos-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ilammy/msvc-dev-cmd@v1 | |
| if: matrix.os == 'windows-latest' | |
| - name: Build | |
| run: | | |
| mkdir build | |
| cd build | |
| cmake -DCMAKE_BUILD_TYPE=Release "-DCMAKE_POLICY_VERSION_MINIMUM=3.5" .. | |
| cmake --build . --config Release | |
| - name: Test (Linux & macOS) | |
| run: cd build/test && ./polyhedralGravity_test | |
| if: matrix.os != 'windows-latest' | |
| # Install the python interface with PyTorch and run the differentiable gravity tests | |
| build-and-test-torch: | |
| name: PyTorch Interface (CPU) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Conda environment from environment.yml | |
| uses: mamba-org/setup-micromamba@v1 | |
| with: | |
| micromamba-version: '1.5.6-0' | |
| environment-file: environment.yml | |
| cache-downloads: true | |
| cache-environment: true | |
| init-shell: bash | |
| - name: Install polyhedral-gravity and PyTorch (CPU) | |
| run: | | |
| pip install . -vv --no-build-isolation | |
| pip install torch --index-url https://download.pytorch.org/whl/cpu | |
| shell: bash -el {0} | |
| - name: Test PyTorch interface | |
| run: pytest test/python/test_gravity_model_torch.py -v | |
| shell: bash -el {0} | |
| # Install the python interface & test that it is working using pytest | |
| build-and-test-python: | |
| name: Python Interface on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [windows-latest, ubuntu-latest, macos-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ilammy/msvc-dev-cmd@v1 | |
| if: matrix.os == 'windows-latest' | |
| - name: Install Conda environment from environment.yml | |
| uses: mamba-org/setup-micromamba@v1 | |
| with: | |
| micromamba-version: '1.5.6-0' | |
| environment-file: environment.yml | |
| cache-downloads: true | |
| cache-environment: true | |
| init-shell: bash powershell | |
| - name: Install & Test polyhedral-gravity | |
| run: | | |
| pip install . -vv --no-build-isolation | |
| pytest -n 3 | |
| shell: bash -el {0} | |