[WIP] Second approach segment location #1880
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: Unix Unit Tests | |
| on: | |
| push: | |
| branches: ['**'] | |
| pull_request: | |
| branches: ['**'] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| python-version: [3.9, 3.11, 3.13] | |
| include: | |
| - os: macos-15-intel | |
| python-version: 3.9 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Create and activate conda environment | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Update pip | |
| shell: bash -el {0} | |
| run: | | |
| python -m pip install --upgrade pip | |
| - name: Install ruff for use before ANY other tests | |
| shell: bash -el {0} | |
| run: | | |
| pip install --verbose ruff | |
| - name: Check ruff formatting | |
| shell: bash -el {0} | |
| run: | | |
| ruff format hnn_core --check | |
| - name: Lint with ruff | |
| shell: bash -el {0} | |
| run: | | |
| ruff check hnn_core | |
| - name: Install HNN-Core with minimal dependencies | |
| shell: bash -el {0} | |
| run: | | |
| pip install --verbose . | |
| - name: Test API with minimal dependencies | |
| shell: bash -el {0} | |
| run: | | |
| python -c "from hnn_core import neymotin_2020_model, simulate_dipole; simulate_dipole(neymotin_2020_model(), tstop=20); print('--> SUCCESS: The test worked!')" | |
| - name: Clean minimal dependencies install | |
| shell: bash -el {0} | |
| run: rm -rf build | |
| - name: Install HNN-Core with Optimization dependencies | |
| shell: bash -el {0} | |
| run: pip install --verbose '.[opt]' | |
| - name: Test Optimization dependencies | |
| shell: bash -el {0} | |
| run: python -c "from hnn_core.optimization import Optimizer" | |
| - name: Clean Optimization dependencies install | |
| shell: bash -el {0} | |
| run: rm -rf build | |
| - name: Install HNN-Core with GUI dependencies | |
| shell: bash -el {0} | |
| run: pip install --verbose '.[gui]' | |
| - name: Test GUI dependencies | |
| shell: bash -el {0} | |
| run: | | |
| hnn-gui --no-browser > /tmp/voila.log 2>&1 & | |
| GUI_PID=$! | |
| # Poll until voila server responds (timeout ~60 seconds (30 * sleep 2) | |
| SUCCESS=false | |
| for i in $(seq 1 30); do | |
| if grep -q "is running at" /tmp/voila.log 2>/dev/null; then | |
| SUCCESS=true | |
| break | |
| fi | |
| sleep 2 | |
| done | |
| kill $GUI_PID 2>/dev/null || true | |
| if [ "$SUCCESS" = "true" ]; then | |
| echo "--> SUCCESS: GUI launched successfully" | |
| else | |
| echo "--> FAILURE: GUI did not launch within 60 seconds" | |
| cat /tmp/voila.log | |
| exit 1 | |
| fi | |
| - name: Clean GUI dependencies install | |
| shell: bash -el {0} | |
| run: | | |
| rm -rf build | |
| - name: Install MPI dependencies | |
| shell: bash -el {0} | |
| run: | | |
| if [[ "${{ matrix.os }}" == macos* ]]; then | |
| echo "DYLD_FALLBACK_LIBRARY_PATH=${CONDA_PREFIX}/lib:$DYLD_FALLBACK_LIBRARY_PATH" >> $GITHUB_ENV | |
| elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then | |
| echo "LD_LIBRARY_PATH=${CONDA_PREFIX}/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV | |
| fi | |
| conda install --yes --quiet -c conda-forge mpi4py "openmpi >5" | |
| - name: Install HNN-Core with full dependencies | |
| shell: bash -el {0} | |
| run: | | |
| pip install --verbose '.[opt, parallel, test, gui]' | |
| - name: Print environment info | |
| run: | | |
| conda info | |
| conda list | |
| shell: bash -el {0} | |
| - name: Test non-MPI, embarrassingly parallel tests with pytest | |
| shell: bash -el {0} | |
| run: | | |
| python -m pytest ./hnn_core/tests/ -m "not uses_mpi" -n auto --cov=hnn_core --cov-report=xml | |
| - name: Test MPI-using parallel tests with pytest | |
| shell: bash -el {0} | |
| run: | | |
| python -m pytest ./hnn_core/tests/ -m "uses_mpi" --cov=hnn_core --cov-report=xml --cov-append | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| files: ./coverage.xml |