Testing
This document shows a list of test cases that can be used to check the correctness of the environment.
Testing GitHub workflow locally
Section titled “Testing GitHub workflow locally”Purpose of this chapter is to test a GitHub workflow of Athena repository in a local machine.
Install act by:
sudo pacman -S actClone Athena repository:
git clone https://github.com/Athena-OS/athenacd athenaBe sure the workflow .yml file to test is in .github/workflows folder:
tree -a .github/workflows[ 132] .github/workflows/├── [4.2K] archiso.yml├── [ 675] builder-container.yml├── [1.5K] hephaestus.yml├── [6.3K] install.yml└── [4.7K] roles.ymlFirst, let’s list the available workflows. Start podman and run the listing:
systemctl start --user podmanact -lThe output would be similar to:
INFO[0000] Using docker host 'unix:///run/user/1000/podman/podman.sock', and daemon socket 'unix:///run/user/1000/podman/podman.sock'Stage Job ID Job name Workflow name Workflow file Events0 build build Build ArchISO Stable archiso.yml workflow_dispatch,schedule0 docker-publish docker-publish Scheduled Container Publish builder-container.yml schedule,workflow_dispatch0 installation-testing ${{ matrix.config_installer.job_name }} System Installation Testing install.yml workflow_dispatch,schedule0 arch-role-testing ${{ matrix.role_installer.job_name }} Test Cyber Roles Testing roles.yml workflow_dispatch,schedule0 nix-role-testing ${{ matrix.role_installer.job_name }} Test Cyber Roles Testing roles.yml workflow_dispatch,schedule1 notify-result notify-result System Installation Testing install.yml workflow_dispatch,schedule1 notify-result notify-result Cyber Roles Testing roles.yml workflow_dispatch,schedule
Detected multiple jobs with the same job name, use `-W` to specify the path to the specific workflow.To get information about a specific job, you can specify its job ID by running:
act -l -j installation-testingor you can pass the workflow path:
act -l -W .github/workflows/install.ymlThe output should be:
INFO[0000] Using docker host 'unix:///run/user/1000/podman/podman.sock', and daemon socket 'unix:///run/user/1000/podman/podman.sock'Stage Job ID Job name Workflow name Workflow file Events0 installation-testing ${{ matrix.config_installer.job_name }} System Installation Testing install.yml workflow_dispatch,scheduleTo validate only workflow correctness, run the command by -n/--dryrun argument:
act -n -j docker-publishTo actual run a workflow locally, run:
act --rm -j docker-publishManual environment installation
Section titled “Manual environment installation”Boot into Athena Live Environment by using Athena ISO.
Create the needed partitions.
sudo -iparted /dev/sda -- mklabel gptparted /dev/sda -- mkpart ESP fat32 1MiB 512MiBparted /dev/sda -- set 1 esp onparted /dev/sda -- mkpart swap linux-swap 512MiB 8GBparted /dev/sda -- mkpart primary 8GB 100%The created partitions are:
- /dev/sda1 -> Boot partition
- /dev/sda2 -> Swap partition
- /dev/sda3 -> Root partition
Format the partitions:
mkfs.btrfs -L arch /dev/sda3mount /dev/disk/by-label/arch /mntcryptsetup -y -v luksFormat /dev/sda3cryptsetup open /dev/sda3 cryptedmkfs.btrfs -L arch /dev/mapper/cryptedmount /dev/mapper/crypted /mntFormat the boot partition:
mkfs.fat -F 32 -n BOOT /dev/sda1and mount it:
mount --mkdir /dev/sda1 /mnt/bootFormat the swap partition
mkswap -L swap /dev/sda2swapon /dev/sda2If you need to test the deployment of an Arch environment, please follow the Arch Installation section, otherwise, for Nix environment, follow the Nix Installation section.
Minimal Arch Installation
Section titled “Minimal Arch Installation”Now proceed to the minimal Arch installation:
pacman-key --initpacman-key --populatepacstrap /mnt basegenfstab -U /mnt >> /mnt/etc/fstabNow, take the UUID of the root partition (i.e., sda3) that will be used later:
lsblk -no name,uuidand you will get:
sda|-sda1 733f5e5e-e53e-48aa-b975-3176e685c199|-sda2 2c29bffd-a015-4485-9571-72fb1c5102f8`-sda3 7ab2a484-95a8-4ded-b483-b0bf086c7e41 `-crypted 506a895e-2e87-4955-ba47-8c25029b994dEnter in the mounted partition by arch-chroot:
arch-chroot /mntpacman -S nano mkinitcpio linux-lts linux-lts-headers efibootmgrThen, edit /etc/kernel/cmdline and add the rd.luks.name to the kernel parameters as:
rd.luks.name=7ab2a484-95a8-4ded-b483-b0bf086c7e41=crypted root=/dev/mapper/crypted loglevel=3 quietRun:
echo "en_US.UTF-8 UTF-8" > /etc/locale.genlocale-genecho "LANG=en_US.UTF-8" > /etc/locale.confln -sf /usr/share/zoneinfo/Europe/Zurich /etc/localtimeecho "athenaos" > /etc/hostnameecho "KEYMAP=us" > /etc/vconsole.confEdit /etc/mkinitcpio.conf and edit HOOKS as:
HOOKS=(base systemd autodetect modconf kms keyboard sd-vconsole sd-encrypt block filesystems fsck)Save it and run:
mkinitcpio -Ppasswdexitumount -R /mntrebootNix Installation
Section titled “Nix Installation”Add Nix channels as:
nix-channel --add https://nixos.org/channels/nixos-unstable nixpkgsnix-channel --updateThen, generate the hardware configuration and get the Athena Nix configuration:
mkdir -p /mnt/etc/nixosnix-shell -p nixos-install-tools --command "nixos-generate-config --root /mnt"curl -o /tmp/athena-nix.zip https://codeload.github.com/Athena-OS/athena-nix/zip/refs/heads/mainunzip /tmp/athena-nix.zip -d /tmp/cp -rf /tmp/athena-nix-main/nixos/home-manager /tmp/athena-nix-main/nixos/hosts /tmp/athena-nix-main/nixos/modules /tmp/athena-nix-main/nixos/pkgs /tmp/athena-nix-main/nixos/users /tmp/athena-nix-main/nixos/configuration.nix /tmp/athena-nix-main/nixos/default.nix /mnt/etc/nixos/sed -i "s/\/etc\/nixos\/hardware-configuration.nix/.\/hardware-configuration.nix/g" /mnt/etc/nixos/configuration.nixFinally, run the Athena Nix installation:
nix-shell -p nixos-install-tools --run "nixos-install --no-root-password --cores 2 --max-jobs 16 --keep-going"