--- a +++ b/.github/workflows/ci.yml @@ -0,0 +1,120 @@ +name: CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + + Linting: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.6", "3.7", "3.8"] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip + + - name: Install Dependencies + run: | + python -m pip install --upgrade pip + make dev + pip install --upgrade click==8.0.2 + - name: Lint with isort, black, docformatter, flake8 + run: | + make lint + + Documentation: + needs: Linting + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.6", "3.7", "3.8"] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip + + - name: Install Dependencies + run: | + python -m pip install --upgrade pip + make dev + pip install -e '.[dev]' + + - name: Generate Docs + run: | + make build-docs + Build: + needs: Documentation + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + python-version: ["3.6", "3.7", "3.8"] # there are some issues with numpy multiarray in 3.7 + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Dependencies + # there are some issues with numpy multiarray in 3.7, affecting numba 0.54 installation + # SimpleITK 2.1.0 does not support non-orthonormal directions + run: | + python -m pip install --upgrade pip + pip install numba==0.53.1 + pip install tensorflow==2.4.1 keras + pip install torch + pip install sigpy + pip install --upgrade simpleitk==2.0.2 + make dev + pip install -e '.[dev]' + + - name: Install Elastix + run: | + wget https://github.com/SuperElastix/elastix/releases/download/4.9.0/elastix-4.9.0-linux.tar.bz2 + ELASTIX_FOLDER="elastix" + mkdir -p $ELASTIX_FOLDER + tar -xvf elastix-4.9.0-linux.tar.bz2 -C $ELASTIX_FOLDER + ELASTIX_DIR="$(realpath $ELASTIX_FOLDER)" + echo "PATH=${ELASTIX_DIR}/bin:${PATH}" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=${ELASTIX_DIR}/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV + + - name: Test with pytest + run: | + pip install pytest + pip install pytest-cov + make test-cov + + - name: Upload to codecov.io + uses: codecov/codecov-action@v1 + with: + file: ./coverage.xml + flags: unittests + name: codecov-umbrella + fail_ci_if_error: true