summaryrefslogtreecommitdiff
path: root/.gitlab-ci/test-msys2.sh
blob: 3a9689380387862b3a910d43619a8ad4bad03530 (plain)
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
#!/bin/bash

set -e

pacman --noconfirm -Suy

pacman --noconfirm -S --needed \
    "${MINGW_PACKAGE_PREFIX}"-ccache \
    "${MINGW_PACKAGE_PREFIX}"-glib2 \
    "${MINGW_PACKAGE_PREFIX}"-gobject-introspection \
    "${MINGW_PACKAGE_PREFIX}"-gtk3 \
    "${MINGW_PACKAGE_PREFIX}"-libffi \
    "${MINGW_PACKAGE_PREFIX}"-python \
    "${MINGW_PACKAGE_PREFIX}"-python-cairo \
    "${MINGW_PACKAGE_PREFIX}"-python-coverage \
    "${MINGW_PACKAGE_PREFIX}"-python-pip \
    "${MINGW_PACKAGE_PREFIX}"-python-pytest \
    "${MINGW_PACKAGE_PREFIX}"-toolchain \
    git \
    lcov

# ccache setup
export PATH="$MSYSTEM/lib/ccache/bin:$PATH"
mkdir -p _ccache
export CCACHE_BASEDIR="$(pwd)"
export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"

# coverage setup
export CFLAGS="-coverage -ftest-coverage -fprofile-arcs -Werror"
COV_DIR="$(pwd)/coverage"
COV_KEY="${CI_JOB_NAME}"
mkdir -p "${COV_DIR}"
export COVERAGE_FILE="${COV_DIR}/.coverage.${COV_KEY}"

# https://docs.python.org/3/using/cmdline.html#envvar-PYTHONDEVMODE
export PYTHONDEVMODE=1

python setup.py build_tests

lcov \
    --config-file .gitlab-ci/lcovrc \
    --directory "$(pwd)" \
    --capture --initial --output-file \
    "${COV_DIR}/${COV_KEY}-baseline.lcov"

MSYSTEM= python -m coverage run --context "${COV_KEY}" tests/runtests.py
MSYSTEM= python -m coverage lcov -o "${COV_DIR}/${COV_KEY}.py.lcov"

lcov \
    --config-file .gitlab-ci/lcovrc \
    --directory "$(pwd)" --capture --output-file \
    "${COV_DIR}/${COV_KEY}.lcov"