1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: PyRate CI


on:
  pull_request:
    branches:
      - 'master'
  push:
    branches:
      - '**'

jobs:
  build:
    if: ${{ ! (contains(github.event.head_commit.message, 'ci skip') || contains(github.event.head_commit.message, 'skip ci'))}}
    runs-on: ubuntu-18.04
    name: Python ${{ matrix.python }}
    strategy:
      matrix:
        include:
          - build: 1
            python-version: "3.7"
            GDALVERSION: "3.0.2"
            PROJVERSION: "6.2.1"
          - build: 2
            python-version: "3.7"
            GDALVERSION: "3.0.4"
            PROJVERSION: "6.1.1"
          - build: 3
            python-version: "3.8"
            GDALVERSION: "3.0.4"
            PROJVERSION: "6.1.1"
          - build: 4
            python-version: "3.9"
            GDALVERSION: "3.0.4"
            PROJVERSION: "6.3.2"

    env:
      PIP_WHEEL_DIR: "/home/runner/.cache/pip/wheels"
      PIP_FIND_LINKS: "file:///home/runner/.cache/pip/wheels"
      GDALINST: "/home/runner/gdalinstall"
      GDALBUILD: "/home/runner/gdalbuild"
      GDALVERSION: ${{ matrix.GDALVERSION }}
      PROJINST: "/home/runner/gdalinstall"
      PROJBUILD: "/home/runner/projbuild"
      PROJVERSION: ${{ matrix.PROJVERSION }}
      PYTHONVERSION: ${{ matrix.python-version }}

    steps:
      - uses: actions/checkout@v2
      - name: Cache multiple paths
        uses: actions/cache@v2
        with:
          path: |
            /home/runner/gdalinstall
          key: ${{ runner.os }}-cache-GDAL-${{ matrix.GDALVERSION }}-proj-${{ matrix.PROJVERSION }}
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python-version }}
      - name: Common set up ${{ matrix.python-version }}
        run: |
          sudo apt update
          sudo apt upgrade
          python -m pip install -U pip wheel setuptools==58.0
      - name: Install packages including openmpi
        if: env.PYTHONVERSION != '3.9'
        run: sudo apt install libhdf5-serial-dev libnetcdf13 libatlas-base-dev gfortran openmpi-bin libopenmpi-dev
      - name: Install packages except openmpi libraries
        if: env.PYTHONVERSION == '3.9'
        run: sudo apt install libhdf5-serial-dev libnetcdf13 libatlas-base-dev gfortran
      - name: Install proj ${{matrix.PROJVERSION}}
        run: |
          echo "PATH=$GDALINST/gdal-$GDALVERSION/bin:$PATH" >> $GITHUB_ENV
          echo "LD_LIBRARY_PATH=$GDALINST/gdal-$GDALVERSION/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
          source ./scripts/ci_proj_install.sh
      - name: Install GDAL ${{matrix.GDALVERSION}}
        run: |
          echo "GDAL_DATA=$GDALINST/gdal-$GDALVERSION/share/gdal" >> $GITHUB_ENV
          echo "PROJ_LIB=$GDALINST/gdal-$GDALVERSION/share/proj" >> $GITHUB_ENV
          echo "LDFLAGS=-L$GDALINST/gdal-$GDALVERSION/lib -Wl,-rpath,$GDALINST/gdal-$GDALVERSION/lib" >> $GITHUB_ENV
          source ./scripts/ci_gdal_install.sh
      - name: Python ${{ matrix.python-version }} with MPI
        if: env.PYTHONVERSION != '3.9'
        run: |
          python setup.py install
          rm -rf Py_Rate.egg-info  # remove the local egg
          echo "PYTHONPATH=$(pwd):$PYTHONPATH" >> $GITHUB_ENV
          chmod 444 tests/test_data/small_test/tif/geo_070709-070813_unw.tif  # makes the file readonly, used in a test
          pip install -r requirements-dev.txt -r requirements-test.txt
      - name: Python ${{ matrix.python-version }} without MPI
        if: env.PYTHONVERSION == '3.9'
        run: |
          python setup.py install
          rm -rf Py_Rate.egg-info  # remove the local egg
          echo "PYTHONPATH=$(pwd):$PYTHONPATH" >> $GITHUB_ENV
          chmod 444 tests/test_data/small_test/tif/geo_070709-070813_unw.tif  # makes the file readonly, used in a test
          pip install -r requirements-test.txt
      - name: Test Pyrate in Python ${{ matrix.python-version }} with MPI
        if: env.PYTHONVERSION != '3.9'
        run: |
          pytest tests/ -m "slow"
          mpirun -n 3 pytest tests/test_shared.py -k test_tiles_split -s
          pytest --cov-config=.coveragerc --cov-report term-missing:skip-covered --cov=pyrate tests/ -m "not slow"
        env:
             OMP_NUM_THREADS: 1
      - name: Test Pyrate in Python ${{ matrix.python-version }} without MPI
        if: env.PYTHONVERSION == '3.9'
        run: |
          pytest tests/ -m "not mpi and slow"
          pytest --cov-config=.coveragerc --cov-report term-missing:skip-covered --cov=pyrate tests/ -m "not slow and not mpi"
        env:
             OMP_NUM_THREADS: 1