System Installation Testing #224
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 multipath-tools | |
- 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: | | |
dd if=/dev/zero of=virtual_disk.img bs=1M count=15360 # Create a 15GB disk image | |
parted -s virtual_disk.img mklabel msdos | |
parted -s virtual_disk.img mkpart primary ext4 1MiB 512MiB | |
parted -s virtual_disk.img mkpart primary btrfs 512MiB 100% | |
losetup -fP virtual_disk.img | |
LOOP_DEV=$(losetup -j virtual_disk.img | cut -d':' -f1) | |
kpartx -av $LOOP_DEV # Create partitions in /dev/mapper and map them correctly and making kernel aware | |
ln -s $LOOP_DEV /dev/mapper/${LOOP_DEV#/dev/} # Aegis expects that the disk and its partitions are in the same directory | |
jq --arg target_disk "/dev/mapper/${LOOP_DEV#/dev/}" \ | |
--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 || '' }}" \ | |
'.partition.device = $target_disk | .partition.mode = "EraseDisk" | .bootloader.location = $target_disk | .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: 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 }} |