-
Notifications
You must be signed in to change notification settings - Fork 29
114 lines (99 loc) · 4.18 KB
/
flownet.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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