asterinas/.github/workflows/test_nixos_full.yml

62 lines
2.3 KiB
YAML

# A comprehensive test for NixOS.
#
# This test suite is designed to run on GitHub's larger runners,
# leveraging their extended storage capacity.
# Here, we can thoroughly test a wider range of NixOS commands and various applications.
# As GitHub charges more for these premium runners,
# these tests will only run when changes are detected in AsterNixOS-specific content.
name: Test AsterNixOS (full)
on:
workflow_dispatch:
pull_request:
paths:
- distro/**
- .github/workflows/test_nixos_full.yml
- tools/nixos/**
push:
branches:
- main
paths:
- distro/**
- .github/workflows/test_nixos_full.yml
- tools/nixos/**
jobs:
full-nixos-test:
runs-on: ubuntu-4-cores-150GB-ssd
container:
image: asterinas/asterinas:0.16.2-20251209
options: -v /dev:/dev --privileged
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Use nix-env to install and run the hello package
run: |
make run NIXOS=1 NIXOS_DISK_SIZE_IN_MB=6144 NIXOS_TEST_COMMAND='nix-env -iA nixos.hello && hello' || true
tail --lines 10 qemu.log | grep -q "^Hello, world!" || (echo "Test nix-env failed" && exit 1)
echo "Test nix-env succeeds!"
- name: Use nix-shell to install and run the hello package
run: |
make run NIXOS=1 NIXOS_DISK_SIZE_IN_MB=6144 NIXOS_TEST_COMMAND='nix-shell -p hello --command hello' || true
tail --lines 10 qemu.log | grep -q "^Hello, world!" || (echo "Test nix-shell failed" && exit 1)
echo "Test nix-shell succeeds!"
podman-test:
runs-on: ubuntu-4-cores-150GB-ssd
container:
image: asterinas/asterinas:0.16.2-20251209
options: -v /dev:/dev --privileged
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Modify configuration.nix to include podman
run: |
sed -i 's/^[[:space:]]*# virtualisation\.podman\.enable = true;/ virtualisation.podman.enable = true;/' \
distro/etc_nixos/configuration.nix
- name: Run podman commands
run: |
make run NIXOS=1 NIXOS_DISK_SIZE_IN_MB=8192 NIXOS_TEST_COMMAND='podman run docker.io/library/alpine:latest ls /etc' || true
tail --lines 50 qemu.log | grep -q "alpine-release" || (echo "Test podman failed" && exit 1)
echo "Test podman succeeds!"