Modify the CI workflows

This commit is contained in:
Chen Chengjun 2026-01-12 03:10:11 +00:00
parent 4c8a076870
commit dafa9a8fa0
6 changed files with 37 additions and 65 deletions

View File

@ -20,11 +20,9 @@ jobs:
- name: Modify configuration.nix to include xfce and podman
run: |
sed -i \
-e 's/^[[:space:]]*# services\.xserver\.enable = true;/ services.xserver.enable = true;/' \
-e 's/^[[:space:]]*# services\.xserver\.desktopManager\.xfce\.enable = true;/ services.xserver.desktopManager.xfce.enable = true;/' \
-e 's/^[[:space:]]*# virtualisation\.podman\.enable = true;/ virtualisation.podman.enable = true;/' \
distro/etc_nixos/configuration.nix
config_path="distro/etc_nixos/configuration.nix"
extra_config_path="tools/github_workflows/config_for_publish_cachix.nix"
./test/nixos/common/merge_nixos_config.sh ${config_path} ${extra_config_path} ${config_path}
- name: Build Asterinas NixOS patched packages and push to release cache
run: |

View File

@ -25,11 +25,9 @@ jobs:
- name: Modify configuration.nix to include xfce and podman
run: |
sed -i \
-e 's/^[[:space:]]*# services\.xserver\.enable = true;/ services.xserver.enable = true;/' \
-e 's/^[[:space:]]*# services\.xserver\.desktopManager\.xfce\.enable = true;/ services.xserver.desktopManager.xfce.enable = true;/' \
-e 's/^[[:space:]]*# virtualisation\.podman\.enable = true;/ virtualisation.podman.enable = true;/' \
distro/etc_nixos/configuration.nix
config_path="distro/etc_nixos/configuration.nix"
extra_config_path="tools/github_workflows/config_for_publish_cachix.nix"
./test/nixos/common/merge_nixos_config.sh ${config_path} ${extra_config_path} ${config_path}
- name: Build Asterinas NixOS patched packages (dry run)
if: github.event_name == 'pull_request'

View File

@ -26,7 +26,7 @@ jobs:
- uses: actions/checkout@v4
- name: Build Asterinas NixOS ISO installer image
run: |
make iso NIXOS_TEST_COMMAND='hello-asterinas'
make iso NIXOS_TEST_SUITE=hello
- name: Run ISO image and install Asterinas NixOS
run: |
make run_iso || true
@ -34,6 +34,4 @@ jobs:
echo "Test ISO succeeds!"
- name : Run Asterinas NixOS
run: |
make run_nixos || true
tail --lines 10 qemu.log | grep -q "^Hello Asterinas!" || (echo "Test NixOS failed" && exit 1)
echo "Test NixOS succeeds!"
make run_nixos NIXOS_TEST_SUITE=hello

View File

@ -28,52 +28,21 @@ jobs:
container:
image: asterinas/asterinas:0.17.0-20251228
options: -v /dev:/dev --privileged
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Modify configuration.nix to include test-asterinas
run: |
sed -i 's/environment.systemPackages = with pkgs; \[ hello-asterinas \];/environment.systemPackages = with pkgs; \[ test-asterinas \];/' \
distro/etc_nixos/configuration.nix
strategy:
fail-fast: false
matrix:
test:
- name: nix
disk_size: 6144
- name: podman
disk_size: 8192
- name: Test nix commands
run: |
make nixos NIXOS_DISK_SIZE_IN_MB=6144 NIXOS_TEST_COMMAND='test-nix-commands'
make run_nixos
- name: Check results
run: |
tail --lines 50 qemu.log | awk '
BEGIN { hello_count=0 } {
if ($0 ~ /^Hello, world!/) hello_count++
}
END {
if (hello_count == 4) exit 0
else exit 1
}' || (echo "Test nix commands failed" && exit 1)
echo "Test nix commands succeeds!"
podman-test:
runs-on: ubuntu-4-cores-150GB-ssd
container:
image: asterinas/asterinas:0.17.0-20251228
options: -v /dev:/dev --privileged
name: Test ${{ matrix.test.name }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Modify configuration.nix to include test-asterinas and podman
- name: Run the ${{ matrix.test.name }} test on AsterNixOS
run: |
sed -i \
-e 's/environment.systemPackages = with pkgs; \[ hello-asterinas \];/environment.systemPackages = with pkgs; \[ test-asterinas \];/' \
-e 's/^[[:space:]]*# virtualisation\.podman\.enable = true;/ virtualisation.podman.enable = true;/' \
distro/etc_nixos/configuration.nix
- name: Run podman commands
run: |
make nixos NIXOS_DISK_SIZE_IN_MB=8192 NIXOS_TEST_COMMAND='test-podman'
make run_nixos
- name: Check results
run: |
tail --lines 50 qemu.log | grep -q "^Test podman succeeds" || (echo "Test podman failed" && exit 1)
echo "Test podman succeeds!"
make nixos NIXOS_TEST_SUITE=${{ matrix.test.name }} NIXOS_DISK_SIZE_IN_MB=${{ matrix.test.disk_size }}
make run_nixos NIXOS_TEST_SUITE=${{ matrix.test.name }}

View File

@ -32,15 +32,12 @@ jobs:
remove_haskell: true
remove_tool_cache: true
- uses: actions/checkout@v4
- name: Run a Hello World program on AsterNixOS
- name: Run the hello test on AsterNixOS
timeout-minutes: 30
uses: addnab/docker-run-action@v3
with:
image: asterinas/asterinas:0.17.0-20251228
options: --privileged -v /dev:/dev -v ${{ github.workspace }}:/root/asterinas
run: |
make nixos NIXOS_DISK_SIZE_IN_MB=6144 NIXOS_TEST_COMMAND='hello-asterinas'
make run_nixos
- 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!"
make nixos NIXOS_TEST_SUITE=hello NIXOS_DISK_SIZE_IN_MB=6144
make run_nixos NIXOS_TEST_SUITE=hello

View File

@ -0,0 +1,12 @@
# This configuration file enables all packages and services that are modified
# by Asterinas NixOS. By enabling them, we ensure they are built during the
# evaluation and can subsequently be uploaded to our Cachix binary cache.
{ config, lib, pkgs, ... }:
{
services.xserver.enable = true;
services.xserver.desktopManager.xfce.enable = true;
virtualisation.podman.enable = true;
}