Skip to content

Commit

Permalink
Desktops: refactor desktop install, enable working ones, add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
igorpecovnik committed Oct 11, 2024
1 parent ec3a145 commit 2003818
Show file tree
Hide file tree
Showing 7 changed files with 364 additions and 110 deletions.
24 changes: 14 additions & 10 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ on:
- cron: '0 2 * * *'
pull_request:
types: [opened, reopened, edited, synchronize, review_requested]
# paths:
# - 'tests/*.conf'

env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -47,17 +45,20 @@ jobs:
# define docker images where we will run test install
dockerimages=("debian:bookworm" "ubuntu:jammy" "ubuntu:noble")
# read tests cases and loop them
# go to repo folder
cd config
# read tests cases
if [[ -n "${{ steps.changed-files.outputs.all_changed_files }}" ]]; then
tests=($(echo ${{ steps.changed-files.outputs.all_changed_files }} | tr " " "\n" | cut -d"." -f1 | cut -d"/" -f2))
tests=($(grep -rw ${{ steps.changed-files.outputs.all_changed_files }} -e "ENABLED=true" | cut -d":" -f1))
else
tests=($(grep -rw config/tests/*.conf -e "ENABLED=true" | cut -d"/" -f3 | cut -d"." -f1))
tests=($(grep -rw tests/*.conf -e "ENABLED=true" | cut -d":" -f1))
fi
# loop enabled tests
for i in "${tests[@]}"; do
unset RELEASE
source config/tests/${i}.conf
source "${i}"
if [[ -z "${RELEASE}" ]]; then RELEASE=all; fi
# if we speficy releases, we need to loop docker images and use if there is a match
if [[ $RELEASE != all || -z $RELEASE ]]; then
Expand Down Expand Up @@ -101,12 +102,15 @@ jobs:
run: |
# source vars
. "config/tests/${{ matrix.image.package }}.conf"
. "config/${{ matrix.image.package }}"
echo ${TEST_TITLE}
export DEBIAN_FRONTEND=noninteractive
#echo "Europe/Ljubljana" > /etc/timezone
RELEASE=$(echo "${{ matrix.image.image }}" | cut -d":" -f2)
TEST_ID=$(echo "${{ matrix.image.package }}" | cut -d "/" -f2 | cut -d "." -f1)
apt update
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata
apt -y install wget gpg
# add armbian repository
Expand All @@ -125,13 +129,13 @@ jobs:
export DEBIAN_FRONTEND=noninteractive
cd config
eval "$PREINSTALL"
sudo bash bin/armbian-configng --cmd "${{ matrix.image.package }}"
sudo bash bin/armbian-configng --cmd "$TEST_ID"
eval "$CONDITION"
# stats
FILENAME="data-"$(echo ${{ matrix.image.image }} | sed "s/:/-/g")"-${{ matrix.image.package }}.teststats"
FILENAME="data-"$(echo ${{ matrix.image.image }} | sed "s/:/-/g")"-${TEST_ID}.teststats"
echo $RELEASE >> ../${FILENAME}
bash bin/armbian-configng --cmd | grep "${{ matrix.image.package }}" | xargs >> ../${FILENAME}
bash bin/armbian-configng --cmd | grep "${TEST_ID}" | xargs >> ../${FILENAME}
echo " " >> ../${FILENAME}
- name: Upload test
Expand Down
280 changes: 231 additions & 49 deletions lib/armbian-configng/config.ng.jobs.json
Original file line number Diff line number Diff line change
Expand Up @@ -574,67 +574,249 @@
"sub": [
{
"id": "Desktops",
"description": "Install Desktop Environments",
"description": "Desktop Environments",
"sub": [
{
"id": "SW02",
"description": "Install XFCE desktop",
"command": [
"install_de \"xfce\""
],
"status": "Preview",
"doc_link": "",
"src_reference": "",
"author": "",
"condition": ""
"id": "DE00",
"description": "XFCE desktop",
"sub": [
{
"id": "DE01",
"description": "XFCE desktop Install",
"command": [
"manage_desktops 'xfce' 'install'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ ! -f /usr/share/xsessions/xfce.desktop ]"
},
{
"id": "DE02",
"description": "Uninstall",
"command": [
"manage_desktops 'xfce' 'uninstall'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ -f /usr/share/xsessions/xfce.desktop ]"
},
{
"id": "DE03",
"description": "Enable autologin",
"command": [
"manage_desktops 'xfce' 'auto'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ -f /usr/share/xsessions/xfce.desktop ] && [ ! -f /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf ]"
},
{
"id": "DE04",
"description": "Disable autologin",
"command": [
"manage_desktops 'xfce' 'manual'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ -f /usr/share/xsessions/xfce.desktop ] && [ -f /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf ]"
}
]
},
{
"id": "SW03",
"description": "Install Gnome desktop",
"command": [
"install_de \"gnome\""
],
"status": "Preview",
"doc_link": "",
"src_reference": "",
"author": "",
"condition": ""
"id": "DE10",
"description": "Gnome desktop",
"sub": [
{
"id": "DE11",
"description": "Gnome desktop Install",
"command": [
"manage_desktops 'gnome' 'install'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ ! -f /usr/share/xsessions/gnome.desktop ]"
},
{
"id": "DE12",
"description": "Uninstall",
"command": [
"manage_desktops 'gnome' 'uninstall'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ -f /usr/share/xsessions/gnome.desktop ]"
},
{
"id": "DE13",
"description": "Enable autologin",
"command": [
"manage_desktops 'gnome' 'auto'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ -f /usr/share/xsessions/gnome.desktop ] && ! cat /etc/gdm3/custom.conf 2>/dev/null | grep AutomaticLoginEnable | grep true >/dev/null"
},
{
"id": "DE14",
"description": "Disable autologin",
"command": [
"manage_desktops 'gnome' 'manual'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ -f /usr/share/xsessions/gnome.desktop ] && cat /etc/gdm3/custom.conf 2>/dev/null | grep AutomaticLoginEnable | grep true >/dev/null"
}
]
},
{
"id": "SW04",
"description": "Install i3-wm desktop",
"command": [
"install_de \"i3-wm\""
],
"status": "Preview",
"doc_link": "",
"src_reference": "",
"author": "",
"condition": ""
"id": "DE20",
"description": "i3-wm desktop",
"status": "Disabled",
"sub": [
{
"id": "DE21",
"description": "i3 desktop Install",
"command": [
"manage_desktops 'i3-wm' 'install'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ ! -f /usr/share/xsessions/i3.desktop ]"
},
{
"id": "DE22",
"description": "i3 desktop uninstall",
"command": [
"manage_desktops 'i3-wm' 'uninstall'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ -f /usr/share/xsessions/i3.desktop ]"
},
{
"id": "DE23",
"description": "Enable autologin",
"command": [
"manage_desktops 'i3-wm' 'auto'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ -f /usr/share/xsessions/i3.desktop ] && [ ! -f /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf ]"
},
{
"id": "DE24",
"description": "Disable autologin",
"command": [
"manage_desktops 'i3-wm' 'manual'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ -f /usr/share/xsessions/i3.desktop ] && [ -f /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf ]"
}
]
},
{
"id": "SW05",
"description": "Install Cinnamon desktop",
"command": [
"install_de \"cinnamon\""
],
"status": "Preview",
"doc_link": "",
"src_reference": "",
"author": "",
"condition": ""
"id": "DE30",
"description": "Cinnamon desktop",
"sub": [
{
"id": "DE31",
"description": "Cinnamon desktop Install",
"command": [
"manage_desktops 'cinnamon' 'install'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ ! -f /usr/share/xsessions/cinnamon.desktop ] && [ ! -f /usr/share/xsessions/cinnamon2d.desktop ]"
},
{
"id": "DE32",
"description": "Cinnamon desktop uninstall",
"command": [
"manage_desktops 'cinnamon' 'uninstall'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ -f /usr/share/xsessions/cinnamon.desktop ] || [ -f /usr/share/xsessions/cinnamon2d.desktop ]"
},
{
"id": "DE33",
"description": "Enable autologin",
"command": [
"manage_desktops 'cinnamon' 'auto'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ -f /usr/share/xsessions/cinnamon.desktop ] && [ ! -f /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf ]"
},
{
"id": "DE34",
"description": "Disable autologin",
"command": [
"manage_desktops 'cinnamon' 'manual'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ -f /usr/share/xsessions/cinnamon.desktop ] && [ -f /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf ]"
}
]
},
{
"id": "DE40",
"description": "Kde-neon desktop",
"status": "Disabled",
"sub": [
{
"id": "DE41",
"description": "Kde-neon desktop Install",
"command": [
"manage_desktops 'kde-neon' 'install'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ ! -f /usr/share/xsessions/gnome.desktop ]"
},
{
"id": "DE42",
"description": "Uninstall",
"command": [
"manage_desktops 'kde-neon' 'uninstall'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ -f /usr/share/xsessions/gnome.desktop ]"
},
{
"id": "DE43",
"description": "Enable autologin",
"command": [
"manage_desktops 'kde-neon' 'auto'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ -f /usr/share/xsessions/gnome.desktop ] && [ ! -f /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf ]"
},
{
"id": "DE44",
"description": "Disable autologin",
"command": [
"manage_desktops 'kde-neon' 'manual'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ -f /usr/share/xsessions/gnome.desktop ] && [ -f /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf ]"
}
]
},
{
"id": "SW06",
"description": "Install kde-neon desktop",
"id": "DE99",
"description": "Improve application search speed",
"command": [
"install_de \"kde-neon\""
"update-apt-xapian-index -u; sleep 3"
],
"status": "Preview",
"doc_link": "",
"src_reference": "",
"author": "",
"condition": ""
"status": "Stable",
"author": "@igorpecovnik",
"condition": "systemctl is-active --quiet service display-manager"
}
]
},
Expand Down
Loading

0 comments on commit 2003818

Please sign in to comment.