Add GitHub Actions CI for unit tests #25
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: ANTsPyNet Unit Tests | |
| on: | |
| push: | |
| pull_request: | |
| jobs: | |
| test: | |
| name: Test on Python ${{ matrix.python-version }} | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| matrix: | |
| python-version: [3.11] | |
| steps: | |
| - name: Checkout ANTsPyNet | |
| uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install build tools | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake build-essential git | |
| - name: Install ANTsPy | |
| run: | | |
| pip install antspyx | |
| - name: Cache ANTsXNet model/data downloads | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.keras/ANTsXNet | |
| key: antsxnet-${{ runner.os }}-${{ hashFiles('**/download_all_data.py') }} | |
| restore-keys: | | |
| antsxnet-${{ runner.os }}- | |
| - name: Install ANTsPyNet and dependencies | |
| run: | | |
| pip install -e . | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| - name: Pre-download ANTsXNet models and data | |
| run: | | |
| python download_all_data.py --strict | |
| - name: Run unit tests | |
| run: | | |
| python -m unittest discover -s tests |