.gitlab-ci.yml 3.69 KB
Newer Older
1 2
include:
 - 'https://source.puri.sm/Librem5/librem5-ci/raw/master/librem5-pipeline-definitions.yml'
3
 - 'https://source.puri.sm/Librem5/librem5-ci/raw/master/librem5-pipeline-byzantium-jobs.yml'
4

Guido Gunther's avatar
Guido Gunther committed
5 6 7
stages:
 - build
 - test
8 9
 - package
 - test-package
Guido Gunther's avatar
Guido Gunther committed
10

11 12 13 14 15
build:native:
  stage: build
  artifacts:
    paths:
      - _build
16 17
  variables:
    BUILD_OPTS: -Dgtk_doc=true ${COMMON_BUILD_OPTS}
18 19
    WANT_BUILD_DEPS: "true"
    COMMON_BUILD_OPTS: --werror
20 21 22
  except:
    variables:
      - $PKG_ONLY == "1"
23 24 25 26 27 28 29 30 31 32 33 34
  image: pureos/byzantium
  tags:
    - librem5
  before_script:
    - export DEBIAN_FRONTEND=noninteractive
    - apt-get -y update
    - apt-get -y build-dep .
    - ulimit -c unlimited
  script:
    - 'echo "Build opts: ${BUILD_OPTS}"'
    - meson ${BUILD_OPTS} . _build
    - ninja -C _build
35 36

test:native:
37
  extends: build:native
38 39 40 41 42 43 44
  stage: test
  dependencies:
    - build:native
  script:
    - export LC_ALL=C.UTF-8
    - xvfb-run ninja -C _build test

45
build-gtkdoc:
46
  extends: build:native
47 48 49 50 51 52 53 54 55 56
  stage: test
  dependencies:
    - build:native
  script:
    - ninja -C _build calls-doc
    - mv _build/doc/html/ _reference/
  artifacts:
    paths:
      - _reference

57
check-po:
58
  extends: build:native
59 60 61 62 63 64 65 66 67 68 69 70
  stage: test
  dependencies:
    - build:native
  before_script:
    - apt-get -y update
    - apt-get -y install intltool
  script:
    # barf on untranslated C files. Seems intltool
    # can't be told to exit with non-zero exit status
    # in this case
    - cd po/
    - intltool-update -m 2>&1 | grep -qs '/.*\.c' && { intltool-update -m; exit 1; } || exit 0
Julian Sparber's avatar
Julian Sparber committed
71 72 73 74

# For some reason including https://gitlab.gnome.org/GNOME/citemplates/raw/master/flatpak/flatpak_ci_initiative.yml fails, therefore it's copied here
.flatpak:
  image: 'registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master'
75
  stage: 'package'
Julian Sparber's avatar
Julian Sparber committed
76 77 78 79 80
  interruptible: true
  tags:
    - flatpak
  script:
    - rewrite-flatpak-manifest ${MANIFEST_PATH} ${FLATPAK_MODULE} ${CONFIG_OPTS}
81
    - flatpak-builder --user --disable-rofiles-fuse flatpak_app --repo=repo ${BRANCH:+--default-branch=$BRANCH} ${MANIFEST_PATH}
Julian Sparber's avatar
Julian Sparber committed
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
    # Generate a Flatpak bundle
    - flatpak build-bundle repo ${BUNDLE} --runtime-repo=${RUNTIME_REPO} ${APP_ID} ${BRANCH}
    - tar cf repo.tar repo/

    # Run automatic tests inside the Flatpak env
    # we need to recreate the build directory because cleanup would have deleted build dependencies
    - rm -rf flatpak_app
    - flatpak-builder --user --disable-rofiles-fuse --build-only flatpak_app ${MANIFEST_PATH}
    - flatpak build-finish --socket=x11 --share=network flatpak_app
    - >
      xvfb-run -a -s "-screen 0 1024x768x24"
      flatpak-builder --user --disable-rofiles-fuse --build-shell=${FLATPAK_MODULE} flatpak_app ${MANIFEST_PATH} <<END

      LANG=C.UTF-8
      NO_AT_BRIDGE=1
      dbus-run-session
      meson test --no-stdsplit --print-errorlogs ${TEST_RUN_ARGS}

      END

  artifacts:
    name: 'Flatpak artifacts'
    expose_as: 'Get Flatpak bundle here'
    when: 'always'
    paths:
      - "${BUNDLE}"
      - 'repo.tar'
      - '.flatpak-builder/build/${FLATPAK_MODULE}/_flatpak_build/meson-logs/meson-log.txt'
      - '.flatpak-builder/build/${FLATPAK_MODULE}/_flatpak_build/meson-logs/testlog.txt'
    expire_in: 14 days
  cache:
    key: "$CI_JOB_NAME"
    paths:
      - '.flatpak-builder/downloads'
      - '.flatpak-builder/git'

flatpak:master:
  extends: .flatpak
120
  stage: package
Julian Sparber's avatar
Julian Sparber committed
121 122 123
  variables:
    MANIFEST_PATH: "sm.puri.Calls.json"
    RUNTIME_REPO: "https://nightly.gnome.org/gnome-nightly.flatpakrepo"
124
    FLATPAK_MODULE: "calls"
Julian Sparber's avatar
Julian Sparber committed
125 126 127 128
    # Make sure to keep this in sync with the Flatpak manifest, all arguments
    # are passed except the config-args because we build it ourselves
    MESON_ARGS: ""
    APP_ID: "sm.puri.Calls"
129
    BUNDLE: 'calls.flatpak'