Commit c179a60b authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

CI: run off-screen tests on macos

parent 65715a43
...@@ -2,35 +2,37 @@ ...@@ -2,35 +2,37 @@
set -e set -e
apt-get install -y bc # offscreen tests on macos. We use mesalib,
# as it is not possible to use opengl hw
# Temporary: this should be done # accelerated GL on headless macOS
# in docker image definitions if [[ "$MACOS_OVERLAY_TEST" == "1" ]]; then
apt install -y locales export FSLDIR=~/fsl/fsl-6.0.5/
locale-gen en_US.UTF-8 ~/miniconda3/bin/conda create -y -c conda-forge -p ./test.env python=3.8 mesalib
locale-gen en_GB.UTF-8 source ~/miniconda3/bin/activate ./test.env
update-locale pip install --upgrade pip
export LANG=en_GB.UTF-8 else
# If running on a fork repository, we merge in the apt-get install -y bc
# upstream/master branch. This is done so that merge
# requests from fork to the parent repository will # Temporary: this should be done
# have unit tests run on the merged code, something # in docker image definitions
# which gitlab CE does not currently do for us. apt install -y locales
if [[ "$CI_PROJECT_PATH" != "$UPSTREAM_PROJECT" ]]; then locale-gen en_US.UTF-8
git fetch upstream; locale-gen en_GB.UTF-8
git merge --no-commit --no-ff upstream/master; update-locale
fi; export LANG=en_GB.UTF-8
# We need the FSL atlases for the atlas # We need the FSL atlases for the atlas
# tests, and need $FSLDIR to be defined # tests, and need $FSLDIR to be defined
export FSLDIR=/fsl/ export FSLDIR=/fsl/
mkdir -p $FSLDIR/data/ mkdir -p $FSLDIR/data/
rsync -rv "fsldownload:$FSL_ATLAS_DIR" "$FSLDIR/data/atlases/" rsync -rv "fsldownload:$FSL_ATLAS_DIR" "$FSLDIR/data/atlases/"
rsync -rv "fsldownload:$FSL_STANDARD_DIR" "$FSLDIR/data/standard/" rsync -rv "fsldownload:$FSL_STANDARD_DIR" "$FSLDIR/data/standard/"
source /test.venv/bin/activate source /test.venv/bin/activate
pip install --upgrade pip pip install --upgrade pip
fi
PIPARGS="--retries 10 --timeout 30" PIPARGS="--retries 10 --timeout 30"
...@@ -68,18 +70,21 @@ tar xf widgets-master.tar.bz2 && pushd widgets-master && pip install $PIPARGS . ...@@ -68,18 +70,21 @@ tar xf widgets-master.tar.bz2 && pushd widgets-master && pip install $PIPARGS .
# print environment # print environment
pip freeze pip freeze
# style stage if [[ "$MACOS_OVERLAY_TEST" == "" ]]; then
if [ "$TEST_STYLE"x != "x" ]; then pip install $PIPARGS pylint flake8; fi;
if [ "$TEST_STYLE"x != "x" ]; then flake8 fsleyes || true; fi;
if [ "$TEST_STYLE"x != "x" ]; then pylint --output-format=colorized fsleyes || true; fi;
if [ "$TEST_STYLE"x != "x" ]; then exit 0; fi
# Run the tests. First batch requires # style stage
# a GUI, so we run via xvfb-run if [ "$TEST_STYLE"x != "x" ]; then pip install $PIPARGS pylint flake8; fi;
((xvfb-run -a -s "-screen 0 1920x1200x24" pytest --cov-report= --cov-append -m "not (clitest or overlayclitest)" && echo "0" > status) || echo "1" > status) || true if [ "$TEST_STYLE"x != "x" ]; then flake8 fsleyes || true; fi;
status=`cat status` if [ "$TEST_STYLE"x != "x" ]; then pylint --output-format=colorized fsleyes || true; fi;
failed=$status if [ "$TEST_STYLE"x != "x" ]; then exit 0; fi
sleep 5
# Run the tests. First batch requires
# a GUI, so we run via xvfb-run
((xvfb-run -a -s "-screen 0 1920x1200x24" pytest --cov-report= --cov-append -m "not (clitest or overlayclitest)" && echo "0" > status) || echo "1" > status) || true
status=`cat status`
failed=$status
sleep 5
fi
# Remaining tests are all off-screen, # Remaining tests are all off-screen,
# so we can use osmesa # so we can use osmesa
......
...@@ -177,10 +177,7 @@ build-docker-image-fsleyes-py310-wxpy4-gtk3: ...@@ -177,10 +177,7 @@ build-docker-image-fsleyes-py310-wxpy4-gtk3:
# Test stage # Test stage
############ ############
.test_rules: &test_rules
.test: &test_template
<<: *setup_ssh
rules: rules:
# Releases are just tags on a release # Releases are just tags on a release
# branch, so we don't need to test them. # branch, so we don't need to test them.
...@@ -193,6 +190,10 @@ build-docker-image-fsleyes-py310-wxpy4-gtk3: ...@@ -193,6 +190,10 @@ build-docker-image-fsleyes-py310-wxpy4-gtk3:
- if: '$CI_PIPELINE_SOURCE == "push"' - if: '$CI_PIPELINE_SOURCE == "push"'
when: on_success when: on_success
.test: &test_template
<<: *setup_ssh
<<: *test_rules
tags: tags:
- docker - docker
...@@ -200,6 +201,18 @@ build-docker-image-fsleyes-py310-wxpy4-gtk3: ...@@ -200,6 +201,18 @@ build-docker-image-fsleyes-py310-wxpy4-gtk3:
- bash ./.ci/test_template.sh - bash ./.ci/test_template.sh
# offscreen tests only on macos
test:macos:
<<: *test_rules
stage: test
tags:
- macOS
- shell
variables:
MACOS_OVERLAY_TEST: 1
script:
- bash ./.ci/test_template.sh
test:3.7: test:3.7:
stage: test stage: test
image: pauldmccarthy/fsleyes-py37-wxpy4-gtk3 image: pauldmccarthy/fsleyes-py37-wxpy4-gtk3
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment