Skip to content

Commit

Permalink
Migrate to Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
pinkwah committed Oct 27, 2020
1 parent f28f178 commit db72410
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 162 deletions.
124 changes: 124 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
user: statoil-travis
password: ${{ secrets.pypi_password }}
134 changes: 0 additions & 134 deletions .travis.yml

This file was deleted.

21 changes: 21 additions & 0 deletions ci/github/build_linux_wheel.sh
Original file line number Diff line number Diff line change
@@ -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
28 changes: 0 additions & 28 deletions config.sh

This file was deleted.

0 comments on commit db72410

Please sign in to comment.