Run test workflow only when code-related files change #153
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: Run Tests | |
| on: | |
| push: | |
| paths: | |
| - '**.m' | |
| - 'PythonModule/**' | |
| - 'test/**' | |
| - '.github/workflows/test_setup.yml' | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - '**.m' | |
| - 'PythonModule/**' | |
| - 'test/**' | |
| - '.github/workflows/test_setup.yml' | |
| jobs: | |
| test: | |
| runs-on: ${{matrix.os}} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-14] | |
| matlab-version: ['R2024a', 'latest'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| - name: Set up MATLAB | |
| uses: matlab-actions/setup-matlab@v2 | |
| with: | |
| release: ${{matrix.matlab-version}} | |
| - name: Set up Python 3.10 (oldest supported for Zarr) | |
| if: matrix.matlab-version == 'R2024a' | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Set up latest available Python (for latest MATLAB) | |
| if: matrix.matlab-version == 'latest' | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install deps (oldest supported for Zarr) | |
| if: matrix.matlab-version == 'R2024a' | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install "numpy==1.26.4" "tensorstore==0.1.71" | |
| - name: Install deps (latest for latest Python) | |
| if: matrix.matlab-version == 'latest' | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install numpy tensorstore | |
| - name: Run tests | |
| uses: matlab-actions/run-tests@v2 | |
| with: | |
| select-by-folder: 'test' | |
| code-coverage-cobertura: cobertura.xml | |
| - name: Upload codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{secrets.CODECOV_TOKEN}} | |
| files: ./target/site/cobertura/coverage.xml | |
| name: codecov-umbrella.xml |