Skip to content

CI

CI #3025

Workflow file for this run

name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
release:
types:
- published
schedule:
# Run CI daily and check that tests are working with latest dependencies
- cron: "0 0 * * *"
jobs:
FlowNet:
runs-on: ubuntu-18.04
strategy:
matrix:
python-version: ["3.7", "3.8"]
flownet-model: [ "egg"]
env:
PYTHONWARNINGS: default
steps:
- name: πŸ“– Checkout commit locally
uses: actions/checkout@v2
- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: πŸ“¦ Install non-python dependencies
run: sudo bash ./apt_install.sh
- name: 🍿 Download FlowNet test data
env:
INPUT_MODEL_FOLDER: ./flownet-testdata/${{ matrix.flownet-model }}/input_model
# If you want the CI to (temporarily) run against your fork of the testdata,
# change the value her from "equinor" to your username.
TESTDATA_REPO_OWNER: equinor
# If you want the CI to (temporarily) run against another branch than master,
# change the value her from "master" to the relevant branch name.
TESTDATA_REPO_BRANCH: master
run: |
git clone --depth 1 --branch $TESTDATA_REPO_BRANCH https://github.com/$TESTDATA_REPO_OWNER/flownet-testdata.git --recursive
for f in $INPUT_MODEL_FOLDER/*.tar.gz; do tar -zxvf "$f" -C $INPUT_MODEL_FOLDER; done
- name: πŸ“¦ Install FlowNet
run: |
pip install "matplotlib<3.2" # As long as ERT requires it...
pip install .
- name: πŸ“¦ Install test dependencies
run: pip install .[tests]
- name: 🧾 List all installed packages
run: pip freeze
- name: πŸ•΅οΈ Check code style & linting
run: |
black --check tests/ src/ setup.py
pylint src/ tests/ setup.py
mypy --ignore-missing-imports src/ setup.py
- name: πŸ€– Run tests
run: |
pytest --cov=flownet --cov-fail-under=29 ./tests
- name: πŸš€ Run full FlowNet example
run: |
pushd ./flownet-testdata/${{ matrix.flownet-model }}
flownet ahm ./config/assisted_history_matching.yml ./some_ahm_run --update-config ./ci_config/assisted_history_matching.yml
flownet ahm ./config/assisted_history_matching.yml ./some_ahm_run2 --update-config ./ci_config/assisted_history_matching.yml --restart-folder ./some_ahm_run
flownet pred ./config/prediction.yml ./some_pred_run ./some_ahm_run --update-config ./ci_config/prediction.yml
(test -f ./config/hyperparameter.yml && flownet hyperparam ./config/hyperparameter.yml ./hyper --update-config ./ci_config/assisted_history_matching.yml) || echo Skipping hyperparameter run...
- name: πŸ“š Build documentation
run: |
pushd docs
make html
popd
- name: 🚒 Build and deploy Python package
if: github.event_name == 'release' && matrix.python-version == '3.7'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.pypi_flownet_token }}
run: |
python -m pip install --upgrade setuptools wheel twine
python setup.py bdist_wheel
twine upload dist/*
- name: πŸ“š Update GitHub pages
if: github.event_name != 'schedule' && github.ref == 'refs/heads/master' && matrix.python-version == '3.7'
run: |
cp -R ./docs/_build ../_build
git config --local user.email "flownet-github-action"
git config --local user.name "flownet-github-action"
git fetch origin gh-pages
git checkout --track origin/gh-pages
git clean -f -f -d -x
git rm -r *
cp -R ../_build/html/* .
git add .
if git diff-index --quiet HEAD; then
echo "No changes in documentation. Skip documentation deploy."
else
git commit -m "Update Github Pages"
git push "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" gh-pages
fi