|
| 1 | +name: run_tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + - develop |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - master |
| 11 | + - develop |
| 12 | + |
| 13 | +env: |
| 14 | + HOMEBREW_NO_ANALYTICS: "ON" # Make Homebrew installation a little quicker |
| 15 | + HOMEBREW_NO_AUTO_UPDATE: "ON" |
| 16 | + HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: "ON" |
| 17 | + HOMEBREW_NO_GITHUB_API: "ON" |
| 18 | + HOMEBREW_NO_INSTALL_CLEANUP: "ON" |
| 19 | + SSDB: "127.0.0.1:6379" |
| 20 | + SMARTREDIS_TEST_CLUSTER: False |
| 21 | + |
| 22 | +jobs: |
| 23 | + |
| 24 | + run_tests: |
| 25 | + name: Run smartredis tests using ${{ matrix.os }}, Python ${{ matrix.py_v }}, RedisAI ${{ matrix.rai_v }}, and compiler ${{ matrix.compiler }} |
| 26 | + runs-on: ${{ matrix.os }} |
| 27 | + strategy: |
| 28 | + fail-fast: false |
| 29 | + matrix: |
| 30 | + os: [ubuntu-20.04] # cannot test on macOS as docker isn't supported on Mac |
| 31 | + compiler: [intel, 8, 9, 10, 11] # intel compiler, and versions of GNU compiler |
| 32 | + rai_v: [1.2.4, 1.2.5] # verisons of RedisAI |
| 33 | + py_v: ['3.7.x', '3.8.x', '3.9.x'] # versions of Python |
| 34 | + env: |
| 35 | + FC: gfortran-${{ matrix.compiler }} |
| 36 | + GCC_V: ${{ matrix.compiler }} # used when the compiler is gcc/gfortran |
| 37 | + |
| 38 | + # Service containers to run with `container-job` |
| 39 | + services: |
| 40 | + # Label used to access the service container |
| 41 | + redis: |
| 42 | + # Docker Hub image |
| 43 | + image: redislabs/redisai:${{ matrix.rai_v }}-cpu-xenial |
| 44 | + |
| 45 | + # Set health checks to wait until redis has started |
| 46 | + options: >- |
| 47 | + --health-cmd "redis-cli ping" |
| 48 | + --health-interval 10s |
| 49 | + --health-timeout 5s |
| 50 | + --health-retries 5 |
| 51 | + ports: |
| 52 | + # map port 6379 on service container to the host |
| 53 | + - 6379:6379 |
| 54 | + |
| 55 | + steps: |
| 56 | + # download a copy of SmartRedis before running CI tests |
| 57 | + - uses: actions/checkout@v2 |
| 58 | + |
| 59 | + - uses: actions/setup-python@v2 |
| 60 | + with: |
| 61 | + python-version: ${{ matrix.py_v }} |
| 62 | + |
| 63 | + - name: Install GFortran Linux |
| 64 | + if: "!contains( matrix.compiler, 'intel' )" # if using GNU compiler |
| 65 | + run: | |
| 66 | + sudo apt-get update && |
| 67 | + sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test && |
| 68 | + sudo apt-get update && |
| 69 | + sudo apt-get install -y gcc-${GCC_V} gfortran-${GCC_V} && |
| 70 | + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \ |
| 71 | + --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} |
| 72 | +
|
| 73 | + - name: Install Intel compiler |
| 74 | + if: "contains( matrix.compiler, 'intel' )" # if using intel compiler |
| 75 | + run: | |
| 76 | + wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB && |
| 77 | + sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB && |
| 78 | + rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB && |
| 79 | + echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list && |
| 80 | + sudo apt-get update && |
| 81 | + sudo apt-get install intel-oneapi-compiler-fortran intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic |
| 82 | + source /opt/intel/oneapi/setvars.sh && |
| 83 | + printenv >> $GITHUB_ENV && |
| 84 | + echo "CC=icc" >> $GITHUB_ENV && |
| 85 | + echo "CXX=icpc" >> $GITHUB_ENV && |
| 86 | + echo "FC=ifort" >> $GITHUB_ENV |
| 87 | + |
| 88 | + - name: Install Cmake Linux |
| 89 | + if: contains(matrix.os, 'ubuntu') |
| 90 | + run: sudo apt-get install cmake |
| 91 | + |
| 92 | + - name: Build SmartRedis python and install |
| 93 | + run: python -m pip install -e .[dev] |
| 94 | + |
| 95 | + - name: Build and run tests |
| 96 | + run: | |
| 97 | + mkdir -p ./third-party && |
| 98 | + cd ./third-party && |
| 99 | + bash ../build-scripts/build-lcov.sh && |
| 100 | + bash ../build-scripts/build-catch.sh && |
| 101 | + cd ../ && |
| 102 | + make test-verbose |
| 103 | +
|
| 104 | + - name: Run Python coverage tests |
| 105 | + run: python -m pytest --cov=./src/python/module/smartredis/ --cov-report=xml --cov-append -vv ./tests/python/ |
| 106 | + |
| 107 | + - name: Run C++ coverage tests # unit tests already built |
| 108 | + run: bash ./build-scripts/build_cpp_cov.sh |
| 109 | + |
| 110 | + - name: Upload Python coverage to Codecov |
| 111 | + uses: codecov/codecov-action@v2 |
| 112 | + with: |
| 113 | + files: ./coverage.xml |
| 114 | + |
| 115 | + - name: Upload C++ coverage to Codecov |
| 116 | + uses: codecov/codecov-action@v2 |
| 117 | + with: |
| 118 | + files: ./tests/cpp/unit-tests/build/CMakeFiles/cpp_unit_tests.dir/coverage.info |
0 commit comments