diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml new file mode 100644 index 0000000000..fa9a8c90ed --- /dev/null +++ b/.github/workflows/testing.yml @@ -0,0 +1,124 @@ +name: Libecl testing + +on: [push, pull_request] + +jobs: + build-test-cmake: + name: CMake + + strategy: + fail-fast: false + matrix: + os: ['ubuntu-latest', 'macos-latest'] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + with: + # required for `git describe --tags` to work + fetch-depth: 0 + + - name: Build libecl + run: | + mkdir cmake-build + cmake -S . -B cmake-build -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo + cmake --build cmake-build + + - name: Run tests + run: | + cd cmake-build + ctest --output-on-failure + env: + ECL_SKIP_SIGNAL: absolutely + ERT_SHOW_BACKTRACE: yes please! + + + build-test-wheel: + name: Python + + strategy: + fail-fast: false + matrix: + os: ['ubuntu-latest', 'macos-latest'] + python: ['3.6', '3.7', '3.8'] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + + - name: Build Linux Wheel + uses: docker://quay.io/pypa/manylinux2010_x86_64 + with: + entrypoint: /github/workspace/ci/github/build_linux_wheel.sh + args: ${{ matrix.python }} + if: matrix.os == 'ubuntu-latest' + + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + + - name: Build macOS/Windows Wheel + run: pip wheel . --no-deps -w dist + if: matrix.os != 'ubuntu-latest' + + - name: Upload wheel as artifact + uses: actions/upload-artifact@v2 + with: + name: ${{ matrix.os }} Python ${{ matrix.python }} wheel + path: dist/* + + - name: Install libecl + run: pip install dist/* + + - name: Run Python tests + run: | + # Runs tests on installed distribution from an empty directory + python -m pip install pytest + + # pytest adds every directory up-to and including python/ into sys.path, + # meaning that "import ecl" will import python/ecl and not the installed + # one. This doesn't work because the libecl.so library only exists in + # site-packages, so we copy directories required by the tests out into its + # own temporary directory. + mkdir test-run; cd test-run + mkdir -p {.git,python} + ln -s {..,$PWD}/bin + ln -s {..,$PWD}/lib + ln -s {..,$PWD}/test-data + cp -R {..,$PWD}/python/tests + + # Env vars + export ECL_SKIP_SIGNAL=1 + export ERT_SHOW_BACKTRACE=1 + + # Run tests + python -m pytest python/tests + + + publish: + name: Publish to PyPI + runs-on: ubuntu-latest + needs: [build-test-wheel] + + # If this is a tagged release + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + + steps: + - name: Get wheels + uses: actions/download-artifact@v2 + with: + path: artifacts + + - name: Move to dist/ + run: | + mkdir dist + find artifacts -name "*.whl" -exec mv '{}' dist/ \; + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@v1.3.1 + with: + user: statoil-travis + password: ${{ secrets.pypi_password }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 726773fe93..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,134 +0,0 @@ -env: - global: - - TEST_DEPENDS=pytest - # amd64 fo' lyfe - - PLAT=x86_64 - # Tell multibuild to use manylinux2010 docker image (mostly due to cmake's - # pypi package not having a manylinux1 wheel) - - MB_ML_VER=2010 - # Show output from util_abort backtraces - - ERT_SHOW_BACKTRACE=1 - # Install via pip - - LEGACY_INSTALL= - # Put wheels where travis expects them to be - - WHEEL_SDIR=dist - -language: python -python: 3.6 - -services: docker -sudo: required -dist: xenial - -matrix: - fast_finish: true - include: - # Use multibuild to install via pip + deploy wheels - - os: linux - name: pip, Linux, py2.7 - env: MB_PYTHON_VERSION=2.7 - - os: linux - name: pip, Linux, py3.6 - env: MB_PYTHON_VERSION=3.6 - - os: linux - name: pip, Linux, py3.7 - env: MB_PYTHON_VERSION=3.7 - - os: linux - name: pip, Linux, py3.8 - env: MB_PYTHON_VERSION=3.8 - - os: osx - name: pip, macOS, py3.6 - language: generic - env: MB_PYTHON_VERSION=3.6 - - os: osx - name: pip, macOS, py3.7 - language: generic - env: MB_PYTHON_VERSION=3.7 - - os: osx - name: pip, macOS, py3.8 - language: generic - env: MB_PYTHON_VERSION=3.8 - # Use CMake to setup and install libecl - - os: linux - name: cmake, Linux, py2.7 - python: 2.7 - env: - - MB_PYTHON_VERSION=2.7 - - LEGACY_INSTALL=1 - - os: linux - name: cmake, Linux, py3.6 - python: 3.6 - env: - - MB_PYTHON_VERSION=3.6 - - LEGACY_INSTALL=1 - - os: osx - name: cmake, macOS, py3.6 - language: generic - env: - - MB_PYTHON_VERSION=3.6 - - LEGACY_INSTALL=1 - -before_install: - # Test the C stuff before we do anything in pip mode - - | - if [ -z "${LEGACY_INSTALL}" ]; then - mkdir build && pushd build - cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON - cmake --build . - ctest --output-on-failure - popd && rm -rf build - fi - - - git clone https://github.com/matthew-brett/multibuild - - source multibuild/common_utils.sh - - source multibuild/travis_steps.sh - - before_install - -install: - - | - if [ -z "${LEGACY_INSTALL}" ]; then - build_wheel . $PLAT - else - pip install -r requirements.txt - - mkdir build - pushd build - cmake .. -DBUILD_TESTS=ON \ - -DENABLE_PYTHON=ON \ - -DBUILD_APPLICATIONS=ON \ - -DINSTALL_ERT_LEGACY=ON \ - -DERT_USE_OPENMP=ON \ - -DCMAKE_C_FLAGS='-Werror=all' \ - -DCMAKE_CXX_FLAGS='-Werror -Wno-unused-result' - make - sudo make install - popd - fi - -script: - - | - if [ -z "${LEGACY_INSTALL}" ]; then - install_run $PLAT - else - export PYTHONPATH="/usr/local/lib/python$MB_PYTHON_VERSION/site-packages:/usr/local/lib/python$MB_PYTHON_VERSION/dist-packages:$PYTHONPATH" - python -c "import sys; print('\n'.join(sys.path))" - set -e; python -c "import ecl"; set +e - pushd build; ctest --output-on-failure; popd - fi - -before_deploy: - # "python setup.py sdist" is called automatically by the deploy step, so - # replace it with an empty file so we don't ruin our hard work - - rm setup.py - - touch setup.py - -deploy: - - provider: pypi - skip_upload_docs: true - skip_cleanup: true - user: statoil-travis - password: - secure: "I31EvX2MenZgZukruzuJmvx0hOmMSWghxkYdtmyV4r8LoEmtviEA1IhctBuiWpVcLjOC0LxsrFESLC+PPhsTokCdIFs1R1JTr3WkotT1HZR6nYr7QZI/Pj9I6fV9oE8hYKS3oiC5DJDTZ/2/Tua5Lt9rjEapgRHTrRIuMqsD+7qRcZWNvQqwV3OWxZ8ua6Fll+yVx6ZLgJMutIyn0Av7ToratjQaYbHnrNbCpDYH/LiDOVJtralMMrHuNZpb6BzATRGP+crL4gDyJVai1tDEO8zshX9zU9ynimpebMtR86Ig0RHuF240eq0UqSMa8aOyk3PKUaxzWBn9nyyi4mOOLC6d7Dm4/8Ek4ilNZ1YqGbMiXnv78e6c5DSEwqceeE11x+kapnuSMgHlzdvA+n7HJXC4ANVIG1jdfMsvkpPDxKeYyw7Pytg9jbBWZvXs32srTjOSi+xIiKQFvh4bUehAbyfpzDd6cD7iC3cU80E8g2HmTtp1ZT59un9entJhw9vfpHrxiHtNUVRUyIJJyTUUYTmNkYsDU00NvbLv6n9mHZxDns+0Pv3pSPI22DNYzrmH5w/xxCcnc8Qlg82+AexEPl7RagETADa3wfK+UOcZ114B8g/Cms99yIk0dHGNl5MtoTceaWLD6EU/ey3KVw9iK9nrxdtTTg9PyvSO+0pm9GU=" - on: - tags: true - condition: !!str [ -z "$LEGACY_INSTALL" ] diff --git a/ci/github/build_linux_wheel.sh b/ci/github/build_linux_wheel.sh new file mode 100755 index 0000000000..995f472e3e --- /dev/null +++ b/ci/github/build_linux_wheel.sh @@ -0,0 +1,21 @@ +#!/bin/bash +set -euo pipefail + +case "$1" in + 3.6) pyver=cp36-cp36m ;; + 3.7) pyver=cp37-cp37m ;; + 3.8) pyver=cp38-cp38 ;; + 3.9) pyver=cp39-cp39 ;; + *) + echo "Unknown Python version $1" + exit 1 + ;; +esac + +# Install dependencies +yum install -y zlib-devel + +# Build wheel +cd /github/workspace +/opt/python/$pyver/bin/pip wheel . --no-deps -w wheelhouse +auditwheel repair wheelhouse/* -w dist diff --git a/config.sh b/config.sh deleted file mode 100644 index 643bb05a68..0000000000 --- a/config.sh +++ /dev/null @@ -1,28 +0,0 @@ -# Define custom utilities -# Test for macOS with [ -n "$IS_OSX" ] - -function pre_build { - # Any stuff that you need to do before you start building the wheels - # Runs in the root directory of this repository. - if [ -n "$IS_OSX" ]; then - brew install zlib - else - yum install -y zlib-devel - fi -} - -function run_tests { - # Runs tests on installed distribution from an empty directory - - # pytest adds every directory up-to and including python/ into sys.path, - # meaning that "import ecl" will import python/ecl and not the installed - # one. This doesn't work because the libecl.so library only exists in - # site-packages, so we copy directories required by the tests out into its - # own temporary directory. - mkdir -p {.git,python} - ln -s {..,$PWD}/bin - ln -s {..,$PWD}/lib - ln -s {..,$PWD}/test-data - cp -R {..,$PWD}/python/tests - python -m pytest python/tests -}