summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 1b008e5c3511bcbc6aedec0a848b1d3d2a30b1fa (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
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
# vim: set expandtab shiftwidth=2 tabstop=8 textwidth=0:

# global variables to be used by most/all jobs.
variables:
  # minimal set of packages required to build xkeyboard-config. extra packages
  # will be installed in the tests where required.
  ARCH_PKGS: 'xorg-util-macros autoconf automake make gettext pkg-config gcc grep m4 python'
  BUILDDIR: '_build'
  # installation directory must be inside $CI_PROJECT_DIR to allow for artifact caching
  INSTDIR: '$CI_PROJECT_DIR/_inst'
  # Override these in the jobs to pass commands to configure/make
  CONFIGURE_ARGS: ''
  MAKE_EXTRA_ARG: ''

# We use arch because the image updates frequently and we're not stuck
# forever in the update phase
.default_setup:
  image: archlinux/base
  before_script:
    - pacman -S --refresh
    - pacman -S --sysupgrade --noconfirm
    - pacman -S --noconfirm $ARCH_PKGS

.default_build:
  extends: .default_setup
  script:
   - rm -rf "$BUILDDIR"
   - mkdir -p "$BUILDDIR"
   - mkdir -p "$INSTDIR"
   - autoreconf -ivf
   - pushd "$BUILDDIR"
   - ../configure --prefix="$INSTDIR" --disable-silent-rules --disable-runtime-deps "$CONFIGURE_ARGS"
   - make
   - if test x"$MAKE_EXTRA_COMMAND" != "x"; then make $MAKE_EXTRA_COMMAND; fi

make_install:
  extends: .default_build
  stage: build
  variables:
      MAKE_EXTRA_COMMAND: "install"
  after_script:
    - pacman -S --noconfirm tree
    - tree $INSTDIR
  artifacts:
    name: installed files
    expire_in: 20 min
    paths:
      - $INSTDIR/

make_check:
  extends: .default_build
  stage: build
  variables:
      MAKE_EXTRA_COMMAND: "check"

make_distcheck:
  extends: .default_build
  stage: build
  variables:
      MAKE_EXTRA_COMMAND: "distcheck"

xmllint:
  image: archlinux/base
  dependencies: ['make_install']
  needs: ['make_install']
  stage: test
  before_script:
    - pacman -S --refresh
    - pacman -S --sysupgrade --noconfirm
    - pacman -S --noconfirm libxml2
  script:
    - xmllint --dtdvalid "$INSTDIR/share/X11/xkb/rules/xkb.dtd" $INSTDIR/share/X11/xkb/rules/*.xml > /dev/null

# download libxkbcommon and run its layout test program. This will
# run a basic keymap compile test against every combination of
# layout/variant/option. Syntax errors will fail the test, check the
# archived file for details.
layout_tests:
  extends: .default_setup
  stage: test
  needs: ["make_install"]
  script:
    - pacman -S --noconfirm git meson bison gcc
    - git clone https://github.com/xkbcommon/libxkbcommon
    - pushd libxkbcommon > /dev/null
    - meson builddir -Denable-wayland=false -Denable-x11=false -Denable-docs=false -Dxkb-config-root="$INSTDIR/share/X11/xkb"
    - ninja -C builddir
    - echo Running test script - this will take several minutes
    - ./builddir/xkeyboard-config-test > $INSTDIR/xkeyboard-config-test.out
    - popd > /dev/null
  variables:
    GIT_STRATEGY: none
  artifacts:
    name: xkeyboard-config test output
    expire_in: 2 weeks
    paths:
    - $INSTDIR/xkeyboard-config-test.out