Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dumux
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dumux-repositories
dumux
Commits
4b79c15b
Commit
4b79c15b
authored
3 years ago
by
Timo Koch
Browse files
Options
Downloads
Patches
Plain Diff
[python][ci] Fix Python environment setup with dune 2.9
parent
d622d536
No related branches found
No related tags found
1 merge request
!2934
[python] Make bindings work with dune 2.9
Pipeline
#11111
passed
3 years ago
Stage: trigger
Stage: downstream modules
+2
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci/default.yml
+24
-5
24 additions, 5 deletions
.gitlab-ci/default.yml
bin/testing/ci-setup-python-env.sh
+11
-5
11 additions, 5 deletions
bin/testing/ci-setup-python-env.sh
with
35 additions
and
10 deletions
.gitlab-ci/default.yml
+
24
−
5
View file @
4b79c15b
...
...
@@ -24,8 +24,13 @@ variables:
configure
:
stage
:
configure
script
:
-
dunecontrol --opts=$DUNE_OPTS_FILE --current all
-
source bin/testing/ci-setup-python-env.sh
-
dunecontrol --opts=$DUNE_OPTS_FILE --current configure
-
dunecontrol --opts=$DUNE_OPTS_FILE --current make -j8
# cache state of the Dune virtual env for Python if it exists (Dune 2.9)
-
|
if [ -d "/dune/modules/dune-common/build-cmake/dune-env" ]; then
cp -r /dune/modules/dune-common/build-cmake/dune-env build-cmake
fi
artifacts
:
paths
:
-
build-cmake
...
...
@@ -46,9 +51,13 @@ black (python):
pylint-flake8 (python)
:
stage
:
linting
script
:
-
source bin/testing/ci-setup-python-env.sh
-
|
if [ -d build-cmake/python/dumux ] ; then
source bin/testing/ci-setup-python-env.sh
# if we are in venv (Dune 2.9) install linters
if [ -d "/dune/modules/dune-common/build-cmake/dune-env" ]; then
python -m pip install pylint flake8
fi
pylint --rcfile=.pylintrc build-cmake/python/dumux
pylint --rcfile=.pylintrc bin
flake8 build-cmake/python/dumux
...
...
@@ -99,6 +108,11 @@ select tests:
compile cpp
:
stage
:
build
script
:
# remove cached Python dune-env if existing (not needed for C++) (Dune 2.9)
-
|
if [ -d "build-cmake/dune-env" ]; then
rm -r build-cmake/dune-env
fi
-
|
pushd build-cmake
make clean && make all
...
...
@@ -148,7 +162,12 @@ test python:
OMPI_ALLOW_RUN_AS_ROOT
:
1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM
:
1
script
:
-
source bin/testing/ci-setup-python-env.sh
# restore Python virtual env from cache (job:configure artifacts) (Dune 2.9)
-
|
if [ -d "build-cmake/dune-env" ]; then
rm -r /dune/modules/dune-common/build-cmake/dune-env
mv build-cmake/dune-env /dune/modules/dune-common/build-cmake/dune-env
fi
-
|
if ([ ! -s changedfiles.txt ] || grep -q python "changedfiles.txt"); then
if [ ! -s changedfiles.txt ]; then
...
...
@@ -158,7 +177,7 @@ test python:
fi
source bin/testing/ci-setup-python-env.sh
pushd build-cmake
ctest --output-on-failure -L python
DUNE_LOG_LEVEL=DEBUG
ctest --output-on-failure -L python
popd
else
echo "No changes in the Python bindings/Python code detected: skipping tests."
...
...
This diff is collapsed.
Click to expand it.
bin/testing/ci-setup-python-env.sh
+
11
−
5
View file @
4b79c15b
#!/bin/bash
if
[
-L
/dune/bin/setup-python
]
&&
[
-e
/dune/bin/setup-python
]
;
then
dunecontrol bexec
"echo -n :
\$
(pwd)/python >>
$(
pwd
)
/pythonpath.txt"
export
PYTHONPATH
=
$PYTHONPATH
$(
cat
pythonpath.txt
)
rm
pythonpath.txt
setup-python
--opts
=
$DUNE_OPTS_FILE
install
if
[
-d
"/dune/modules/dune-common/build-cmake/dune-env"
]
;
then
# Use internal venv of DUNE
echo
"Activating the Python virtual environment of dune-common"
source
/dune/modules/dune-common/build-cmake/dune-env/bin/activate
else
if
[
-L
/dune/bin/setup-python
]
&&
[
-e
/dune/bin/setup-python
]
;
then
dunecontrol bexec
"echo -n :
\$
(pwd)/python >>
$(
pwd
)
/pythonpath.txt"
export
PYTHONPATH
=
$PYTHONPATH
$(
cat
pythonpath.txt
)
rm
pythonpath.txt
setup-python
--opts
=
$DUNE_OPTS_FILE
install
fi
fi
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment