Skip to content

Commit

Permalink
Use GitHub workflows as CI (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
anders-kiaer authored Mar 25, 2020
1 parent 5b8d2f9 commit aa138a1
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 62 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/flownet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: CI

on:
pull_request:
branches:
- master

jobs:
FlowNet:
runs-on: ubuntu-18.04
strategy:
matrix:
python-version: ['3.6', '3.7']
env:
VENV_PATH: ${{ github.workspace }}/flownet_venv
PYTHONPATH: ${{ github.workspace }}/flownet_venv/lib/python${{ matrix.python-version }}/dist-packages
steps:
- name: Checkout commit locally
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Cache virtual environment
id: cache-venv
uses: actions/cache@v1
with:
path: $VENV_PATH
key: ${{ runner.os }}-${{ hashFiles('setup.py') }}-${{ hashFiles('build_environment.sh') }}

- name: Build venv and install non-python dependencies
run: bash ./build_environment.sh $VENV_PATH ${{ steps.cache-venv.outputs.cache-hit }}

- name: Install FlowNet
run: |
source $VENV_PATH/bin/activate
pip install .
- name: Install test dependencies
run: |
source $VENV_PATH/bin/activate
pip install .[tests]
- name: List all installed packages
run: |
source $VENV_PATH/bin/activate
pip freeze
- name: Check code style & linting
run: |
source $VENV_PATH/bin/activate
black --check examples/ tests/ src/ setup.py
pylint src/ tests/ setup.py
mypy --ignore-missing-imports src/ tests/ setup.py
- name: Run tests
run: |
source $VENV_PATH/bin/activate
webviz certificate --force
pytest --cov=flownet --cov-fail-under=50 ./tests
- name: Run full FlowNet example
run: |
source $VENV_PATH/bin/activate
pushd examples
flownet ahm ../tests/configs/norne_parameters.yml ./some_ahm_run
flownet pred ../tests/configs/norne_pred.yml ./some_pred_run ./some_ahm_run
popd
- name: Build documentation
run: |
source $VENV_PATH/bin/activate
pushd docs
make html
popd
58 changes: 0 additions & 58 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![Build Status](https://travis-ci.com/equinor/flownet.svg?token=zKASDqz9PfgMt9WutZq4&branch=master)](https://travis-ci.com/equinor/flownet)
[![Python 3.6 | 3.7 | 3.8](https://img.shields.io/badge/python-3.6%20|%203.7%20|%203.8-blue.svg)](https://www.python.org/)
[![Python 3.6 | 3.7](https://img.shields.io/badge/python-3.6%20|%203.7-blue.svg)](https://www.python.org/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

# _FlowNet_
Expand Down
5 changes: 2 additions & 3 deletions build_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,9 @@ if [[ ! -d "$INSTALL_ENV" ]]; then

python3 -m venv $INSTALL_ENV

echo "export PYTHONPATH=''" >> $INSTALL_ENV/bin/activate
echo "setenv PYTHONPATH ''" >> $INSTALL_ENV/bin/activate.csh

source $INSTALL_ENV/bin/activate
pip install --upgrade pip

fi

##################
Expand Down

0 comments on commit aa138a1

Please sign in to comment.