Skip to content

Testing

This document shows a list of test cases that can be used to check the correctness of the environment.

Testing GitHub workflow locally

Purpose of this chapter is to test a GitHub workflow of Axyl Projects repository in a local machine.

Install act by:

Terminal window
sudo pacman -S act

Clone Axyl Projects repository:

Terminal window
git clone https://github.com/Axyl Projects-OS/Axyl Projects
cd Axyl Projects

Be sure the workflow .yml file to test is in .github/workflows folder:

Terminal window
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.yml

First, let’s list the available workflows. Start podman and run the listing:

Terminal window
systemctl start --user podman
act -l

The 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 Events
0 build build Build ArchISO Stable archiso.yml workflow_dispatch,schedule
0 docker-publish docker-publish Scheduled Container Publish builder-container.yml schedule,workflow_dispatch
0 installation-testing ${{ matrix.config_installer.job_name }} System Installation Testing install.yml workflow_dispatch,schedule
0 arch-role-testing ${{ matrix.role_installer.job_name }} Test Cyber Roles Testing roles.yml workflow_dispatch,schedule
0 nix-role-testing ${{ matrix.role_installer.job_name }} Test Cyber Roles Testing roles.yml workflow_dispatch,schedule
1 notify-result notify-result System Installation Testing install.yml workflow_dispatch,schedule
1 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:

Terminal window
act -l -j installation-testing

or you can pass the workflow path:

Terminal window
act -l -W .github/workflows/install.yml

The 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 Events
0 installation-testing ${{ matrix.config_installer.job_name }} System Installation Testing install.yml workflow_dispatch,schedule

To validate only workflow correctness, run the command by -n/--dryrun argument:

Terminal window
act -n -j docker-publish

To actual run a workflow locally, run:

Terminal window
act --rm -j docker-publish

Manual environment installation

Boot into Axyl Projects Live Environment by using Axyl Projects ISO.

Create the needed partitions.

Terminal window
sudo -i
Terminal window
parted /dev/sda -- mklabel gpt
parted /dev/sda -- mkpart ESP fat32 1MiB 512MiB
parted /dev/sda -- set 1 esp on
parted /dev/sda -- mkpart swap linux-swap 512MiB 8GB
parted /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:

Terminal window
mkfs.btrfs -L arch /dev/sda3
mount /dev/disk/by-label/arch /mnt

Format the boot partition:

Terminal window
mkfs.fat -F 32 -n BOOT /dev/sda1

and mount it:

Terminal window
mount --mkdir /dev/sda1 /mnt/boot

Format the swap partition

Terminal window
mkswap -L swap /dev/sda2
swapon /dev/sda2

If 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

Now proceed to the minimal Arch installation:

Terminal window
pacman-key --init
pacman-key --populate
pacstrap /mnt base
genfstab -U /mnt >> /mnt/etc/fstab

Now, take the UUID of the root partition (i.e., sda3) that will be used later:

Terminal window
lsblk -no name,uuid

and 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-8c25029b994d

Enter in the mounted partition by arch-chroot:

Terminal window
arch-chroot /mnt
Terminal window
pacman -S nano mkinitcpio linux-lts linux-lts-headers grub efibootmgr

Then, edit /etc/default/grub and add the rd.luks.name to GRUB_CMDLINE_LINUX_DEFAULT as:

GRUB_CMDLINE_LINUX_DEFAULT="rd.luks.name=7ab2a484-95a8-4ded-b483-b0bf086c7e41=crypted root=/dev/mapper/crypted loglevel=3 quiet"

Save it and run:

Terminal window
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
locale-gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
ln -sf /usr/share/zoneinfo/Europe/Zurich /etc/localtime
echo "Axyl Projectsos" > /etc/hostname
echo "KEYMAP=us" > /etc/vconsole.conf

Edit /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:

Terminal window
mkinitcpio -P
sed -i "s/#GRUB_ENABLE_CRYPTODISK=.*/GRUB_ENABLE_CRYPTODISK=y/g" /etc/default/grub
Terminal window
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
Terminal window
grub-mkconfig -o /boot/grub/grub.cfg
passwd
exit
umount -R /mnt
reboot

Nix Installation

Add Nix channels as:

Terminal window
nix-channel --add https://nixos.org/channels/nixos-unstable nixpkgs
nix-channel --update

Then, generate the hardware configuration and get the Axyl Projects Nix configuration:

Terminal window
mkdir -p /mnt/etc/nixos
nix-shell -p nixos-install-tools --command "nixos-generate-config --root /mnt"
curl -o /tmp/Axyl Projects-nix.zip https://codeload.github.com/Axyl Projects-OS/Axyl Projects-nix/zip/refs/heads/main
unzip /tmp/Axyl Projects-nix.zip -d /tmp/
cp -rf /tmp/Axyl Projects-nix-main/nixos/home-manager /tmp/Axyl Projects-nix-main/nixos/hosts /tmp/Axyl Projects-nix-main/nixos/modules /tmp/Axyl Projects-nix-main/nixos/pkgs /tmp/Axyl Projects-nix-main/nixos/users /tmp/Axyl Projects-nix-main/nixos/configuration.nix /tmp/Axyl Projects-nix-main/nixos/default.nix /mnt/etc/nixos/
sed -i "s/\/etc\/nixos\/hardware-configuration.nix/.\/hardware-configuration.nix/g" /mnt/etc/nixos/configuration.nix

If you are in a GRUB BIOS/Legacy environment, run:

Terminal window
sed -i "s/bootloader = \"systemd\"/bootloader = \"grub\"/g" /mnt/etc/nixos/configuration.nix

Finally, run the Axyl Projects Nix installation:

Terminal window
nix-shell -p nixos-install-tools --run "nixos-install --no-root-password --cores 2 --max-jobs 16 --keep-going"