diff --git a/.circleci/conda/devel-environment.yml b/.circleci/conda/devel-environment.yml new file mode 100644 index 000000000..44e677f38 --- /dev/null +++ b/.circleci/conda/devel-environment.yml @@ -0,0 +1,12 @@ +name: base +channels: + - conda-forge + - nodefaults +dependencies: + - cmake + - gxx_linux-64 + - gmock + - gtest + - ninja + - pybind11 + - pytest diff --git a/.circleci/conda/runtime-environment.yml b/.circleci/conda/runtime-environment.yml new file mode 100644 index 000000000..b2cadcb5a --- /dev/null +++ b/.circleci/conda/runtime-environment.yml @@ -0,0 +1,19 @@ +name: base +channels: + - conda-forge + - nodefaults +dependencies: + - eigen + - fftw + - gdal + - h5py + - hdf5 + - libstdcxx-ng + - numpy + - pyre + - python + - ruamel.yaml + - scipy + - shapely + - sysroot_linux-64=2.17 + - yamale diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 000000000..b6c23accc --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,62 @@ +version: 2.1 + +jobs: + build-and-test: + docker: + - image: nvidia/cuda:11.4.2-devel-centos7 + environment: ISCE3_PREFIX=/opt/isce3 + steps: + - run: + name: Install prerequisites + command: | + yum install -y git + - checkout + - run: + name: Install package manager + working_directory: /tmp + command: | + curl -fsSLo Mambaforge.sh https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-$(uname -m).sh + chmod +x Mambaforge.sh + ./Mambaforge.sh -b + $HOME/mambaforge/bin/mamba init + echo "source $HOME/.bashrc" >> $BASH_ENV + - run: + name: Install dependencies + working_directory: .circleci/conda + command: | + mamba env update -f runtime-environment.yml + mamba env update -f devel-environment.yml + - run: + name: Configure + command: | + cmake \ + -DCMAKE_PREFIX_PATH=$CONDA_PREFIX \ + -DCMAKE_INSTALL_PREFIX=$ISCE3_PREFIX \ + -DWITH_CUDA=ON \ + -DCMAKE_CUDA_HOST_COMPILER=$CXX \ + -G Ninja \ + -B build \ + -S . + - run: + name: Build + working_directory: build + command: | + cmake --build . + - run: + name: Install + working_directory: build + command: | + cmake --build . --target=install + echo "export PATH=$ISCE3_PREFIX/bin:$PATH" >> $BASH_ENV + echo "export PYTHONPATH=$ISCE3_PREFIX/packages:$PYTHONPATH" >> $BASH_ENV + echo "export LD_LIBRARY_PATH=$ISCE3_PREFIX/lib:$LD_LIBRARY_PATH" >> $BASH_ENV + - run: + name: Test + working_directory: build + command: | + ctest -E 'stage_dem' -j $(nproc) --output-on-failure + +workflows: + pr-checks: + jobs: + - build-and-test diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..8554f8198 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,31 @@ +ci: + autofix_prs: false + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.2.0 + hooks: + - id: check-case-conflict + - id: end-of-file-fixer + - id: trailing-whitespace + + - repo: https://github.com/pre-commit/mirrors-clang-format + rev: v13.0.0 + hooks: + - id: clang-format + + - repo: https://github.com/psf/black + rev: 22.3.0 + hooks: + - id: black + + - repo: https://github.com/PyCQA/pydocstyle + rev: 6.1.1 + hooks: + - id: pydocstyle + args: [--convention=numpy] + + - repo: https://github.com/PyCQA/isort + rev: 5.10.1 + hooks: + - id: isort