stages:
  - lint
  - build

variables:
  ZENHASKELL_IMAGE: "zenhaskell/gtk:nightly-2018-07-09"

lint:
  stage: lint
  image: ${ZENHASKELL_IMAGE}
  script:
  - hlint .

stack-build-test:
  stage: build
  image: ${ZENHASKELL_IMAGE}
  before_script:
    - apt install -y libpcap-dev
  script:
    - stack build
    - stack test
  cache:
    key: "stack-work"
    paths:
      - .stack-work

.flatpak-build:
  stage: build
  image: registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:3.28
  only:
    refs:
    - master
    - /^staging/.*$/
    - /^flatpak/.*$/

  variables:
    APP_ID: "org.freedesktop.Bustle"
    BUNDLE: "${APP_ID}.flatpak"
    REPO: "repo"
    RUNTIME_REPO: "https://flathub.org/repo/flathub.flatpakrepo"

  script:
    - flatpak-builder --repo ${REPO} app flatpak/${APP_ID}.yaml
    - flatpak build-bundle --runtime-repo=${RUNTIME_REPO} ${REPO} ${BUNDLE} ${APP_ID}

  artifacts:
    paths:
      - ${BUNDLE}
    expire_in: 30 days

  cache:
    key: "flatpak-builder-cache"
    paths:
      - .flatpak-builder/cache

stages:
  - lint
  - build

variables:
  ZENHASKELL_IMAGE: "zenhaskell/gtk:nightly-2018-07-09"

lint:
  stage: lint
  image: ${ZENHASKELL_IMAGE}
  script:
  - hlint .

stack-build-test:
  stage: build
  image: ${ZENHASKELL_IMAGE}
  before_script:
    - apt install -y libpcap-dev
  script:
    - stack build
    - stack test
  cache:
    key: "stack-work"
    paths:
      - .stack-work

flatpak-build:
  stage: build
  image: registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:3.28
  only:
    refs:
    - master
    - /^staging/.*$/
    - /^flatpak/.*$/

  variables:
    APP_ID: "org.freedesktop.Bustle"
    BUNDLE: "${APP_ID}.flatpak"
    REPO: "repo"
    RUNTIME_REPO: "https://flathub.org/repo/flathub.flatpakrepo"

  script:
    - flatpak-builder --repo ${REPO} app flatpak/${APP_ID}.yaml
    - flatpak build-bundle --runtime-repo=${RUNTIME_REPO} ${REPO} ${BUNDLE} ${APP_ID}

  artifacts:
    paths:
      - ${BUNDLE}
    expire_in: 30 days

  cache:
    key: "flatpak-builder-cache"
    paths:
      - .flatpak-builder/cache

Revert "CI: disable Flatpak build"
Revert "CI: disable Flatpak build"

This reverts commit 978e8c143185a93fee0ce51378f76fda0e06aae0. I think
bb27784f454cc348aad67bcccaca5c323c85f561 will fix this problem.
