name: nightly-debian-11

on:
  schedule:
    - cron: "12 23 * * *"
  workflow_dispatch:

env:
  BUILDDIR: /build
  SRCDIR: ${{ github.workspace }}
  CMAKE_ARGS: |
    -DKDE_INSTALL_USE_QT_SYS_PATHS=ON
    -DCMAKE_BUILD_TYPE=Debug

jobs:
  build:
    runs-on: ubuntu-latest
    container:
      image: docker://debian:11
      options: --tmpfs /build:rw --user 0:0
    steps:
      - name: "prepare env"
        shell: bash
        run: |
          apt-get update
          # Make sure we can send notices later
          apt-get -y install git-core jq curl
          apt-get -y install \
            build-essential \
            cmake \
            extra-cmake-modules \
            gettext \
            libatasmart-dev \
            libappstreamqt-dev \
            libboost-python-dev \
            libicu-dev \
            libparted-dev \
            libpolkit-qt5-1-dev \
            libqt5svg5-dev \
            libqt5webkit5-dev \
            libyaml-cpp-dev \
            os-prober \
            pkg-config \
            python3-dev \
            qtbase5-dev \
            qtdeclarative5-dev \
            qttools5-dev \
            qttools5-dev-tools
          # Same name as on KDE neon, different version
          apt-get -y install libkpmcore-dev
          # Additional dependencies (KF5, +)
          apt-get -y install \
            libkf5config-dev \
            libkf5coreaddons-dev \
            libkf5i18n-dev \
            libkf5iconthemes-dev \
            libkf5parts-dev \
            libkf5service-dev \
            libkf5solid-dev \
            libkf5crash-dev \
            libkf5package-dev \
            libkf5plasma-dev \
            libpwquality-dev \
            libqt5webenginewidgets5 \
            qtwebengine5-dev
      - name: "prepare source"
        uses: calamares/actions/generic-checkout@v4
      - name: "build"
        id: build
        uses: calamares/actions/generic-build@v4
      - name: "notify: ok"
        if: ${{ success() && github.repository == 'calamares/calamares' }}
        uses: calamares/actions/matrix-notify@v4
        with:
          token: ${{ secrets.MATRIX_TOKEN }}
          room: ${{ secrets.MATRIX_ROOM }}
          message: |
            OK ${{ github.workflow }} in ${{ github.repository }} ${{ steps.build.outputs.git-summary }}
      - name: "notify: fail"
        if: ${{ failure() && github.repository == 'calamares/calamares' }}
        uses: calamares/actions/matrix-notify@v4
        with:
          token: ${{ secrets.MATRIX_TOKEN }}
          room: ${{ secrets.MATRIX_ROOM }}
          message: |
            FAIL ${{ github.workflow }} in ${{ github.repository }} ${{ steps.build.outputs.git-summary }}