Split nixos test as test-nixos-minimal and test-nixos-full
This commit is contained in:
parent
5ef4cd8209
commit
22b12c2cef
|
|
@ -1,30 +0,0 @@
|
|||
name: Test NixOS distro
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
nixos-install-test:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: asterinas/asterinas:0.16.1-20251130
|
||||
options: --device=/dev/kvm --privileged -v /dev:/dev
|
||||
strategy:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build NixOS image and run hello-asterinas
|
||||
run: |
|
||||
make run NIXOS=1 NIXOS_DISK_SIZE_IN_MB=3072 NIXOS_STAGE_2_INIT=hello-asterinas || true
|
||||
tail --lines 10 qemu.log | grep -q "^Hello Asterinas!" || (echo "Test NixOS failed" && exit 1)
|
||||
echo "Test NixOS succeeds!"
|
||||
- name: Basic nix-env test
|
||||
run: |
|
||||
make run NIXOS=1 NIXOS_DISK_SIZE_IN_MB=3072 NIXOS_STAGE_2_INIT="nix-env -iA nixos.hello && hello" || true
|
||||
tail --lines 10 qemu.log | grep -q "^Hello, world!" || (echo "Test nix-env failed" && exit 1)
|
||||
make clean
|
||||
echo "Test nix-env succeeds!"
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
# 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.1-20251130
|
||||
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=4096 NIXOS_STAGE_2_INIT="nix-env -iA nixos.hello && hello && sync" || true
|
||||
tail --lines 10 qemu.log | grep -q "^Hello, world!" || (echo "Test nix-env failed" && exit 1)
|
||||
echo "Test nix-env succeeds!"
|
||||
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
# A basic CI test for NixOS.
|
||||
#
|
||||
# This workflow is intended to include the most basic test for AsterNixOS.
|
||||
# It requires only a minimal amount of disk space
|
||||
# and thus can be run on standard Github runners _for free_.
|
||||
name: Test AsterNixOS (minimal)
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
minimal-nixos-test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
steps:
|
||||
# In the subsequent tests, a relatively large disk (4GB) will be created to install AsterNixOS.
|
||||
# Standard GitHub runners may encounter "insufficient disk space" errors.
|
||||
# Therefore, we first execute the following action to free up
|
||||
# some disk space. The amount of space saved can be referenced in
|
||||
# https://github.com/endersonmenezes/free-disk-space?tab=readme-ov-file#size-savings,
|
||||
# currently amounting to approximately 24GB.
|
||||
- uses: endersonmenezes/free-disk-space@v3
|
||||
with:
|
||||
rm_cmd: "rmz"
|
||||
remove_android: true
|
||||
remove_dotnet: true
|
||||
remove_haskell: true
|
||||
remove_tool_cache: true
|
||||
- uses: actions/checkout@v4
|
||||
- name: Run a Hello World program on AsterNixOS
|
||||
uses: addnab/docker-run-action@v3
|
||||
with:
|
||||
image: asterinas/asterinas:0.16.1-20251130
|
||||
options: --privileged -v /dev:/dev -v ${{ github.workspace }}:/root/asterinas
|
||||
run: make run NIXOS=1 NIXOS_DISK_SIZE_IN_MB=4096 NIXOS_STAGE_2_INIT="hello-asterinas" || true
|
||||
- name: Check results
|
||||
run: |
|
||||
tail --lines 10 ${{ github.workspace }}/qemu.log | grep -q "^Hello Asterinas!" || (echo "Test NixOS failed" && exit 1)
|
||||
echo "Test NixOS succeeds!"
|
||||
Loading…
Reference in New Issue