Skip to content

System Installation Testing #164

System Installation Testing

System Installation Testing #164

Workflow file for this run

name: System Installation Testing
on:
workflow_dispatch:
schedule:
- cron: '0 17 */1 * *'
jobs:
# Matrix Job for GNOME, BSPWM, KDE, and Nix
installation-testing:
runs-on: ubuntu-latest
container:
image: athenaos/base-devel:latest
options: --privileged # Needed for hwclock
strategy:
fail-fast: false # Ensure all matrix jobs continue even if one fails
matrix:
config_installer:
- { desktop: "gnome", displaymanager: "gdm", theme: "temple", terminal: "gnome terminal", shell: "fish", browser: "firefox", job_name: "Arch-based Install Test (GNOME)", config_file: "arch.json", installer: "aegis-arch" }
- { desktop: "kde plasma", displaymanager: "lightdm neon", theme: "akame", terminal: "alacritty", shell: "zsh", browser: "brave", job_name: "Arch-based Install Test (KDE)", config_file: "arch.json", installer: "aegis-arch" }
- { desktop: "xfce refined", displaymanager: "sddm", theme: "samurai", terminal: "xfce", shell: "bash", browser: "brave", job_name: "Arch-based Install Test (XFCE Refined)", config_file: "arch.json", installer: "aegis-arch" }
- { desktop: "xfce picom", displaymanager: "sddm", theme: "graphite", terminal: "xfce", shell: "zsh", browser: "firefox", job_name: "Arch-based Install Test (XFCE Picom)", config_file: "arch.json", installer: "aegis-arch" }
- { desktop: "mate", displaymanager: "gdm", theme: "hackthebox", terminal: "cool retro term", shell: "fish", browser: "firefox", job_name: "Arch-based Install Test (MATE)", config_file: "arch.json", installer: "aegis-arch" }
- { desktop: "cinnamon", displaymanager: "gdm", theme: "sweet", terminal: "konsole", shell: "zsh", browser: "brave", job_name: "Arch-based Install Test (Cinnamon)", config_file: "arch.json", installer: "aegis-arch" }
- { desktop: "bspwm", displaymanager: "gdm", terminal: "kitty", browser: "brave", job_name: "Arch-based Install Test (BSPWM)", config_file: "arch.json", installer: "aegis-arch" }
- { desktop: "hyprland", displaymanager: "sddm", terminal: "foot", browser: "firefox", job_name: "Arch-based Install Test (Hyprland)", config_file: "arch.json", installer: "aegis-arch" }
- { desktop: "gnome", displaymanager: "gdm", theme: "temple", terminal: "kitty", shell: "fish", browser: "firefox", job_name: "Nix-based Install Test", config_file: "nix.json", installer: "aegis-nix" }
name: ${{ matrix.config_installer.job_name }} # Dynamically assign the job name based on the matrix
steps:
- name: Install dependencies
run: pacman -Syyu --noconfirm aegis grub mkinitcpio jq
- name: Retrieve install configuration
run: curl -O https://raw.githubusercontent.com/Athena-OS/athena/refs/heads/main/tests/${{ matrix.config_installer.config_file }}
- name: Modify install configuration
run: |
jq --arg desktop "${{ matrix.config_installer.desktop }}" \
--arg displaymanager "${{ matrix.config_installer.displaymanager }}" \
--arg theme "${{ matrix.config_installer.theme || '' }}" \
--arg terminal "${{ matrix.config_installer.terminal || '' }}" \
--arg shell "${{ matrix.config_installer.shell || '' }}" \
--arg browser "${{ matrix.config_installer.browser || '' }}" \
'.desktop = $desktop | .displaymanager = $displaymanager | .theme = $theme | .terminal = $terminal | .shell = $shell | .browser = $browser' \
${{ matrix.config_installer.config_file }} > modified_${{ matrix.config_installer.config_file }}
mv modified_${{ matrix.config_installer.config_file }} ${{ matrix.config_installer.config_file }}
- name: Create a raw disk image
run: |
dd if=/dev/zero of=disk.img bs=1M count=20480 # Create a 20 GB disk image. Increase it if the workflow ends with no space left error during test installation
#loop_device=$(sudo losetup --find --partscan --show disk.img) # https://github.com/orgs/community/discussions/147257
#sudo losetup -d "$loop_device"
loop_device="/dev/loop3"
echo "Loop Device: $loop_device"
sudo losetup "$loop_device" disk.img # Attach the file as a loopback device
parted -s "$loop_device" -- mklabel gpt
parted -s "$loop_device" -- mkpart ESP fat32 1MiB 512MiB
parted -s "$loop_device" -- set 1 esp on
parted -s "$loop_device" -- mkpart primary btrfs 512MiB 100%
sed -i "s#/dev/loop0#$loop_device#g" ${{ matrix.config_installer.config_file }}
# Refresh the loop device partition table
sudo partprobe "$loop_device" || sudo losetup -c "$loop_device"
sudo udevadm settle
#mknod "${loop_device}p1" b 259 0 # Manually create because hosted-runner kernel does not refresh /dev
#mknod "${loop_device}p2" b 259 1
echo "System Disk Layout:"
lsblk
ls -la /dev/loop3*
- name: Run the installer
run: ${{ matrix.config_installer.installer }} config ${{ matrix.config_installer.config_file }}
# Final job to send summary to webhook
notify-result:
runs-on: ubuntu-latest
needs: installation-testing # Wait until all matrix jobs complete
if: always() # Ensures this job runs even if any job fails or is canceled
steps:
- name: Generate Job Results Summary
id: generate_summary
run: |
summary="Job Results:"
# Convert the entire 'needs' context to JSON
job_data=$(echo '${{ toJSON(needs) }}' | jq .)
# Loop over each job and collect the results
for job_name in $(echo "$job_data" | jq -r 'keys[]'); do
job_result=$(echo "$job_data" | jq -r --arg job "$job_name" '.[$job].result')
summary="$summary\n$job_name: $job_result"
done
# Output the summary to be used in later steps
echo "$summary"
echo "::set-output name=job-summary::$summary"
- name: Send a request to webhook
run: |
curl -H "Content-Type: application/json" -d '{
"embeds": [{
"type": "rich",
"title": "Workflow Actions",
"thumbnail": {
"url": "https://athenaos.org/_astro/athena-chibi.C4AxdAFD_Z1ifHWb.webp"
},
"author": {
"name": "${{ github.actor }}",
"url": "https://github.com/${{ github.actor }}",
"icon_url": "https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4"
}
}],
"username": "Athena Git Ninja",
"content": "Athena Installation Test\nBranch: ${{ github.ref }} \nCommit Hash: ${{ github.sha }}\n\n${{ steps.generate_summary.outputs.job-summary }}"
}' ${{ secrets.WEBHOOK_URL }}