---
image: alpine:edge

.only-default: &only-default
  only:
    - master
    - merge_requests
    - tags

build-alpine:
  <<: *only-default
  before_script:
    - apk -q add
        build-base
        curl-dev
        dbus-dev
        libphonenumber-dev
        glib-dev
        meson
        modemmanager-dev
        pkgconf
        mobile-broadband-provider-info

  script:
    # check for uninitialized g_autoptr, which cause segfaults in musl
    - grep -n -e 'g_autoptr(\w*)\s*\w*;' -R . && exit 1
    - meson -Dwerror=true _build
    - meson compile -C _build
    - meson test -C _build --print-errorlogs

  artifacts:
    paths:
      - _build/

build-debian:
  image: debian:bookworm
  <<: *only-default
  before_script:
    - apt update
    - apt install -y
        debhelper-compat
        meson
        libglib2.0-dev
        libphonenumber-dev
        libmm-glib-dev
        libcurl4-openssl-dev
        mobile-broadband-provider-info

  script:
    - meson -Dwerror=true _build
    - meson compile -C _build
    - meson test -C _build --print-errorlogs
  artifacts:
    paths:
      - _build/
