-
Notifications
You must be signed in to change notification settings - Fork 59
189 lines (161 loc) Β· 7.81 KB
/
subsurface.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
name: webviz-subsurface
on:
push:
pull_request:
branches:
- master
release:
types:
- published
schedule:
# Run CI daily and check that tests are working with latest dependencies
- cron: "0 0 * * *"
jobs:
webviz-subsurface:
# Run on all events defined above, except pushes which are neither to master nor with a substring [deploy test] in commit message
if: github.event_name != 'push' || github.ref == 'refs/heads/master' || contains(github.event.head_commit.message, '[deploy test]')
runs-on: ubuntu-latest
env:
PYTHONWARNINGS: default # We want to see e.g. DeprecationWarnings
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- name: π§Ή Remove unused pre-installed software
run: |
# https://github.com/actions/virtual-environments/issues/751
# https://github.com/actions/virtual-environments/issues/709
sudo apt-get purge p7zip* yarn ruby-full ghc* php7*
sudo apt-get autoremove
sudo apt-get clean
df -h
- 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 webviz-subsurface with dependencies
run: |
pip install --upgrade pip
if [[ $(pip freeze) ]]; then
pip freeze | grep -vw "pip" | xargs pip uninstall -y
fi
pip install "shapely<2"
pip install "bleach<5" # https://github.com/equinor/webviz-config/issues/586
pip install "werkzeug<2.1" # ...while waiting for https://github.com/plotly/dash/issues/1992
pip install "selenium<4.3" # breaking change in selenium==4.3
pip install .
# Testing against our latest release (including pre-releases)
pip install --pre --upgrade webviz-config webviz-core-components webviz-subsurface-components
- name: π¦ Install test dependencies
run: |
pip install .[tests]
wget https://chromedriver.storage.googleapis.com/$(wget https://chromedriver.storage.googleapis.com/LATEST_RELEASE -q -O -)/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
export PATH=$PATH:$PWD
- name: π§Ύ List all installed packages
run: pip freeze
- name: π΅οΈ Check code style & linting
run: |
black --check webviz_subsurface tests setup.py
pylint webviz_subsurface tests setup.py
bandit -r -c ./bandit.yml webviz_subsurface tests setup.py
isort --check-only webviz_subsurface tests setup.py
mypy --package webviz_subsurface
- name: π€ Run tests
env:
# If you want the CI to (temporarily) run against your fork of the testdada,
# 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/webviz-subsurface-testdata.git
# Copy any clientside script to the test folder before running tests
mkdir ./tests/assets && cp ./webviz_subsurface/_assets/js/* ./tests/assets
pytest ./tests --headless --forked --testdata-folder ./webviz-subsurface-testdata
rm -rf ./tests/assets
webviz docs --portable ./docs_build --skip-open
- name: π³ Build Docker example image
run: |
pip install --pre webviz-config-equinor
export SOURCE_URL_WEBVIZ_SUBSURFACE=https://github.com/$GITHUB_REPOSITORY
export GIT_POINTER_WEBVIZ_SUBSURFACE=$GITHUB_REF
webviz build ./webviz-subsurface-testdata/webviz_examples/webviz-full-demo.yml --portable ./example_subsurface_app --theme equinor
rm -rf ./webviz-subsurface-testdata
pushd example_subsurface_app
docker build -t webviz/example_subsurface_image:equinor-theme .
popd
- name: π³ Update Docker Hub example image
if: github.event_name != 'schedule' && github.ref == 'refs/heads/master' && matrix.python-version == '3.8'
run: |
echo ${{ secrets.dockerhub_webviz_token }} | docker login --username webviz --password-stdin
docker push webviz/example_subsurface_image:equinor-theme
- name: π³ Update review/test Docker example image
if: github.ref != 'refs/heads/master' && contains(github.event.head_commit.message, '[deploy test]') && matrix.python-version == '3.8'
run: |
docker tag webviz/example_subsurface_image:equinor-theme ${{ secrets.review_docker_registry_url }}/${{ secrets.review_container_name }}
echo ${{ secrets.review_docker_registry_token }} | docker login ${{ secrets.review_docker_registry_url }} --username ${{ secrets.review_docker_registry_username }} --password-stdin
docker push ${{ secrets.review_docker_registry_url }}/${{ secrets.review_container_name }}
- name: π’ Build and deploy Python package
if: github.event_name == 'release' && matrix.python-version == '3.8'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.pypi_webviz_token }}
run: |
python -m pip install --upgrade setuptools wheel twine
python setup.py sdist bdist_wheel
twine upload dist/*
- name: π Update GitHub pages
if: github.event_name == 'release' && matrix.python-version == '3.8'
run: |
cp -R ./docs_build ../docs_build
git config --local user.email "webviz-github-action"
git config --local user.name "webviz-github-action"
git fetch origin gh-pages
git checkout --track origin/gh-pages
git clean -f -f -d -x
git rm -r *
cp -R ../docs_build/* .
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
webviz-subsurface-windows:
# Run on all events defined above, except pushes which are neither to master nor with a substring [deploy test] in commit message
if: github.event_name != 'push' || github.ref == 'refs/heads/master' || contains(github.event.head_commit.message, '[deploy test]')
runs-on: windows-latest
env:
PYTHONWARNINGS: default # We want to see e.g. DeprecationWarnings
strategy:
fail-fast: false
matrix:
python-version: ["3.8"]
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 webviz-subsurface with dependencies
run: |
pip install --upgrade pip
pip install "bleach<5" # https://github.com/equinor/webviz-config/issues/586
pip install "werkzeug<2.1" # ...while waiting for https://github.com/plotly/dash/issues/1992
pip install "selenium<4.3" # breaking change in selenium==4.3
pip install "scipy<1.9.3" # breaking change in scipy==1.9.3
pip install "pytest<7.2.0"
pip install "pytest-xdist<3.0"
pip install "xtgeo<2.20.2"
pip install .
- name: Test import
run: |
import webviz_subsurface
shell: python