Compare commits

...

39 commits
main ... t27

Author SHA1 Message Date
1f7fac40e1
ci: add matrix notify step, fix ssh key id 2022-08-24 22:45:35 +02:00
ab7435fa23
ci: add matrix notify step, fix ssh key id 2022-08-24 22:37:59 +02:00
d7855390a5
ci: add matrix notify step, fix ssh key id 2022-08-24 22:36:53 +02:00
da496ccdf7
ci: add upload artifacts step 2022-08-24 22:21:24 +02:00
d786e66467
ci: add upload artifacts step 2022-08-24 22:19:29 +02:00
061e9f8009
ci: add upload artifacts step 2022-08-24 22:15:41 +02:00
771199f2ba
ci: add upload artifacts step 2022-08-24 22:09:27 +02:00
4501aa1317
ci: add upload artifacts step 2022-08-24 21:52:11 +02:00
ab4f7ce575
ci: add upload artifacts step 2022-08-24 21:47:27 +02:00
8c14a466a4
ci: add upload artifacts step 2022-08-24 21:46:24 +02:00
23ef0db3bf
ci: add upload artifacts step 2022-08-24 21:44:23 +02:00
85e1609a8a
ci: add upload artifacts step 2022-08-24 21:43:38 +02:00
a190c977ee
ci: add upload artifacts step 2022-08-24 21:42:05 +02:00
06fa4cccf7
ci: add upload artifacts step 2022-08-24 21:31:31 +02:00
3bb88457ee
ci: add upload artifacts step 2022-08-24 21:28:00 +02:00
92747c7325
ci: add upload artifacts step 2022-08-24 21:24:39 +02:00
d98ad5fba3
ci: add upload artifacts step 2022-08-24 20:41:03 +02:00
347eebb957
ci: add upload artifacts step 2022-08-14 22:38:15 +02:00
4fd3875952
ci: add TRITON_DONT_SOURCE_PROFILE variable 2022-08-14 22:33:19 +02:00
a5658e864d
ci: add upload artifacts step 2022-08-14 22:22:18 +02:00
2bdba1fcac
Merge branch 'main' into feature/tests 2022-08-14 22:16:36 +02:00
cd3b4913f1
ci: add upload artifacts step 2022-08-14 22:15:04 +02:00
9e675c9aec
Fix file upload location 2022-08-14 22:11:33 +02:00
c4aa6737a7
Singular commadn into nix develop 2022-08-14 22:03:57 +02:00
dec5dfa53a
ci: add upload artifacts step 2022-08-14 21:56:16 +02:00
d4f649b387
ci: add upload artifacts step 2022-08-14 21:46:22 +02:00
de4c2d90cb
ci: add upload artifacts step 2022-08-14 21:40:29 +02:00
bba6e40579
Restructure CI:
build ISO on each push to main branch

tags with v* and t* names trigger a test VM

pull requests trigger a basic check building host PubSolarOS
2022-08-14 20:51:56 +02:00
b3c8c9575e
Merge branch 'main' into feature/tests 2022-08-14 20:38:23 +02:00
74f49aabe9
Merge branch 'main' into feature/tests 2022-08-14 16:35:07 +02:00
5fcd34e783
Test exec runner 2022-08-13 22:16:21 +02:00
07bea146f9
Test exec runner 2022-08-13 22:14:36 +02:00
79d21746c5
Merge branch 'main' into feature/tests 2022-08-13 18:16:25 +02:00
dc50fa07f5
Merge branch 'main' into feature/tests 2022-08-13 13:59:32 +02:00
dd6248d60f
zsh: correctly pin plugins to commits instead of
branch names, to prevent errors like:
error: hash mismatch in fixed-output derivation '/nix/store/n7w9jd46zx4rzy9a24abxv3lcx1ikn1j-source.drv':
         specified: sha256-0pzkKPdzyQXTe8usaSaM1Iivi2UHQrSJrh5V2pRd0Gg=
            got:    sha256-9vc4cMBCNOmPOyzGwnPeMrXXyQUq4pC9Du3AWl9+Rys=
2022-07-17 16:37:09 +02:00
4ddf8194c2
zsh: bundle plugins within our config 2022-06-07 14:59:01 +02:00
e81983b91e
wip: first PubSolarOS iso test using the NixOS
test vm
2022-06-05 03:10:30 +02:00
ab2ce6a1dd
wip: first PubSolarOS iso test using the NixOS 2022-06-05 01:19:25 +02:00
f3e1c53b0d
wip: first PubSolarOS iso test using the NixOS
test suite:

https://nixos.org/manual/nixos/stable/index.html#sec-nixos-tests
2022-06-04 23:46:28 +02:00
5 changed files with 222 additions and 112 deletions

View file

@ -1,92 +1,3 @@
---
kind: pipeline
type: docker
name: Upstreaming
steps:
- name: "Sync 'devos' branch with upstream"
image: alpine/git
when:
event:
- cron
cron:
- sync-main-with-upstream
environment:
GITEA_SSH_KEY:
from_secret: gitea_ssh_key
commands:
- ./.drone/setup_ssh.sh
- git remote add devos git@git.b12f.io:pub-solar/devos
- git remote set-url origin git@git.b12f.io:pub-solar/os
- git fetch --all
- git checkout -b devos --track origin/devos
- git merge -X theirs devos/main
- git push origin devos
- git remote set-url origin https://git.b12f.io/pub-solar/os.git
- name: "Sync $BRANCH with upstream"
image: alpine/git
when:
event:
- cron
cron:
- sync-main-with-upstream
- sync-b12f-with-main
- sync-teutat3s-with-main
environment:
GITEA_SSH_KEY:
from_secret: gitea_ssh_key
commands:
- git fetch origin
- git checkout origin/main
- ./.drone/setup_ssh.sh
- git remote set-url origin git@git.b12f.io:pub-solar/os
- git fetch --all
- ./.drone/upstream-branch.sh
- name: "Open pull request for failed merge"
image: nixery.dev/shell/tea
when:
status:
- failure
event:
- cron
cron:
- sync-main-with-upstream
- sync-b12f-with-main
- sync-teutat3s-with-main
environment:
TEA_CONFIG:
from_secret: tea_config
commands:
- mkdir -p ~/.config/tea
- echo "$$TEA_CONFIG" > ~/.config/tea/config.yml
- tea pulls create --base main --head devos
- name: "Notify matrix"
image: plugins/matrix
when:
status:
- failure
event:
- cron
cron:
- sync-main-with-upstream
- sync-b12f-with-main
- sync-teutat3s-with-main
settings:
homeserver: https://matrix.pub.solar
roomid: dfQBqwkhIzrFjMSsxy:pub.solar
username:
from_secret: matrix_username
password:
from_secret: matrix_password
template: "Upstreaming {{ build.status }} [{{ build.branch }}#{{ truncate build.commit 8 }}]({{ build.link }}) by {{ build.author }}. [Pull requests](https://git.b12f.io/pub-solar/os/pulls)"
trigger:
event:
- cron
---
kind: pipeline
type: docker
@ -98,15 +9,78 @@ steps:
when:
event:
- pull_request
- tag
environment:
NIX_FLAGS: "--print-build-logs --verbose"
commands:
- 'echo DEBUG: Using NIX_FLAGS: $NIX_FLAGS'
- nix $$NIX_FLAGS flake check
- nix $$NIX_FLAGS develop --command nix flake show
- nix $$NIX_FLAGS build ".#nixosConfigurations.PubSolarOS.config.system.build.toplevel"
---
kind: pipeline
type: exec
name: Tests
steps:
- name: "Tests"
environment:
NIX_FLAGS: "--print-build-logs --verbose"
commands:
- 'echo DEBUG: Using NIX_FLAGS: $NIX_FLAGS'
- nix $$NIX_FLAGS build ".#checks.x86_64-linux.customTestFor-PubSolarOS-firstTest"
- nix-store --read-log result
- nix $$NIX_FLAGS flake check
- nix $$NIX_FLAGS develop --command echo OK
- name: "Upload artifacts"
environment:
TRITON_DONT_SOURCE_PROFILE: 1
PRIVATE_SSH_KEY:
from_secret: private_ssh_key
MANTA_USER: pub_solar
MANTA_URL: https://eu-central.manta.greenbaum.cloud
MANTA_KEY_ID: "5d:5f:3d:22:8d:37:1f:e6:d6:ab:06:18:d9:a2:04:67"
commands:
- export TARGET_DIR="$${DRONE_REPO}/$${DRONE_BUILD_NUMBER}"
- echo env var TARGET_DIR is set to $$TARGET_DIR
- "mkdir ~/.ssh && chmod 700 ~/.ssh"
- echo "$$PRIVATE_SSH_KEY" > ~/.ssh/id_ed25519 && chmod 600 ~/.ssh/id_ed25519
- nix flake new --template "git+https://git.greenbaum.cloud/dev/tritonshell?ref=main" ./tritonshell
- git add tritonshell
- cd tritonshell
- nix develop --command mput -p -f ../result/foot_wayland_info.png ~~/public/$${TARGET_DIR}
- nix develop --command mput -p -f ../result/test-wayland.out ~~/public/$${TARGET_DIR}
trigger:
ref:
- refs/tags/v*
- refs/tags/t*
---
kind: pipeline
type: docker
name: Notification
steps:
- name: "Notify matrix"
image: plugins/matrix
settings:
homeserver: https://matrix.pub.solar
roomid: dfQBqwkhIzrFjMSsxy:pub.solar
username:
from_secret: matrix_username
password:
from_secret: matrix_password
template: "Test run status: {{ build.status }}, artifacts uploaded to Manta: https://eu-central.manta.greenbaum.cloud/pub_solar/public/{{ repo.Owner }}/{{ repo.Name }}/{{ build.number }}"
depends_on:
- Tests
trigger:
ref:
- refs/tags/v*
- refs/tags/t*
---
kind: pipeline
type: docker
@ -115,14 +89,15 @@ name: Publish ISO
steps:
- name: "Build ISO"
image: docker.nix-community.org/nixpkgs/nix-flakes:latest
environment:
NIX_FLAGS: "--print-build-logs --verbose"
volumes:
- name: file-exchange
path: /var/nix/iso-cache
commands:
- |
nix --print-build-logs --verbose \
build \
'.#nixosConfigurations.bootstrap.config.system.build.bootstrapIso'
nix $$NIX_FLAGS build \
'.#nixosConfigurations.bootstrap.config.system.build.bootstrapIso'
- cp $(readlink -f result)/iso/*.iso /var/nix/iso-cache/
- name: "Publish ISO"
@ -148,8 +123,10 @@ depends_on:
- Check
trigger:
branch:
- main
event:
- tag
- push
volumes:
- name: file-exchange
@ -157,6 +134,6 @@ volumes:
---
kind: signature
hmac: da951ba8ede88996728acfb47846e01880eb0e3b91f66e47848d6c1cc727c5d9
hmac: b38ea67f7458383c2f7650d86a619efd065b59888d738d4471c83b0a0ad12e3d
...

View file

@ -102,7 +102,11 @@
imports = [ (digga.lib.importHosts ./hosts) ];
hosts = {
/* set host specific properties here */
PubSolarOS = { };
PubSolarOS = {
tests = [
(import ./tests/first-test.nix { pkgs = nixos.legacyPackages.x86_64-linux; lib = nixos.lib; })
];
};
};
importables = rec {
profiles = digga.lib.rakeLeaves ./profiles // {

View file

@ -39,21 +39,49 @@ in
nixos-option = "nixos-option -I nixpkgs=${self}/lib/compat";
myip = "dig +short myip.opendns.com @208.67.222.222 2>&1";
};
zplug = {
enable = true;
plugins = [
{
name = "plugins/z";
tags = [ "from:oh-my-zsh" ];
}
{
name = "romkatv/powerlevel10k";
tags = [ "as:theme" "depth:1" ];
}
{ name = "zdharma/fast-syntax-highlighting"; }
{ name = "chisui/zsh-nix-shell"; }
];
};
plugins = [
{
# will source ohmyzsh/plugins/z/
name = "zsh-plugins-z";
file = "plugins/z/z.sh";
src = pkgs.fetchFromGitHub {
owner = "ohmyzsh";
repo = "ohmyzsh";
rev = "249c708ed3a4a7a63d16a6e911a46b6fb9623cbd";
sha256 = "sha256-NAVotL5RxpS/zKnO+ngMIjv787lqc1dj/c4blQrQcvU=";
};
}
{
name = "zsh-powerlevel10k";
file = "powerlevel10k.zsh-theme";
src = pkgs.fetchFromGitHub {
owner = "romkatv";
repo = "powerlevel10k";
rev = "2dd6a29e4d7a33bfef10973d6550e087be37ddee";
sha256 = "sha256-9vc4cMBCNOmPOyzGwnPeMrXXyQUq4pC9Du3AWl9+Rys=";
};
}
{
name = "zsh-fast-syntax-highlighting";
file = "F-Sy-H.plugin.zsh";
src = pkgs.fetchFromGitHub {
owner = "z-shell";
repo = "F-Sy-H";
rev = "c4bdc485b67b58351a24f21fcac92c9e0232b939";
sha256 = "sha256-uXBGIdJwubuueNhQRdGxPUi0eJN17cflYAuHTjeQ8FQ=";
};
}
{
name = "zsh-nix-shell";
file = "nix-shell.plugin.zsh";
src = pkgs.fetchFromGitHub {
owner = "chisui";
repo = "zsh-nix-shell";
rev = "af6f8a266ea1875b9a3e86e14796cadbe1cfbf08";
sha256 = "sha256-BjgMhILEL/qdgfno4LR64LSB8n9pC9R+gG7IQWwgyfQ=";
};
}
];
initExtra = ''
bindkey -v

87
tests/first-test.nix Normal file
View file

@ -0,0 +1,87 @@
{ pkgs, lib, ... }:
{
name = "firstTest";
nodes.test-machine = { suites ? null, ... }: {
imports = suites.iso;
home-manager.users.pub-solar.programs.zsh.shellAliases = {
test-x11 = "glinfo | tee /tmp/test-x11.out && touch /tmp/test-x11-exit-ok";
test-wayland = "wayland-info | tee /tmp/test-wayland.out && touch /tmp/test-wayland-exit-ok";
};
# source: https://github.com/NixOS/nixpkgs/blob/nixos-unstable/nixos/tests/sway.nix
environment = {
# For glinfo and wayland-info:
systemPackages = with pkgs; [ mesa-demos wayland-utils alacritty ];
# Use a fixed SWAYSOCK path (for swaymsg):
variables = {
"SWAYSOCK" = "/tmp/sway-ipc.sock";
# TODO: Investigate if we can get hardware acceleration to work (via
# virtio-gpu and Virgil). We currently have to use the Pixman software
# renderer since the GLES2 renderer doesn't work inside the VM (even
# with WLR_RENDERER_ALLOW_SOFTWARE):
# "WLR_RENDERER_ALLOW_SOFTWARE" = "1";
"WLR_RENDERER" = "pixman";
};
# To help with OCR:
etc."xdg/foot/foot.ini".text = lib.generators.toINI { } {
main = {
font = "inconsolata:size=14";
};
colors = rec {
foreground = "000000";
background = "ffffff";
regular2 = foreground;
};
};
};
fonts.fonts = [ pkgs.inconsolata ];
# Need to switch to a different GPU driver than the default one (-vga std) so that Sway can launch:
virtualisation.qemu.options = [ "-vga none -device virtio-gpu-pci" ];
virtualisation.cores = 4;
virtualisation.memorySize = 2048;
};
enableOCR = true;
testScript = ''
import shlex
def swaymsg(command: str, succeed=True):
with machine.nested(f"sending swaymsg {command!r}" + " (allowed to fail)" * (not succeed)):
(machine.succeed if succeed else machine.execute)(
f"su - pub-solar -c {shlex.quote('swaymsg -- ' + command)}"
)
machine.wait_for_unit("multi-user.target")
# To check the version:
print(machine.succeed("sway --version"))
# Wait for Sway to complete startup:
machine.wait_for_file("/run/user/1000/wayland-1")
machine.wait_for_file("/tmp/sway-ipc.sock")
# Start a terminal (foot) on workspace 3:
machine.wait_for_text("1")
machine.send_key("meta_l-3")
machine.sleep(3)
machine.send_key("meta_l-ret")
machine.sleep(10)
machine.send_chars("whoami\n")
machine.sleep(3)
machine.wait_for_text("pub-solar")
machine.send_chars("test-wayland\n")
machine.wait_for_file("/tmp/test-wayland-exit-ok")
print(machine.succeed("cat /tmp/test-wayland.out"))
machine.copy_from_vm("/tmp/test-wayland.out")
machine.sleep(3)
machine.screenshot("foot_wayland_info")
machine.send_key("meta_l-shift-q")
machine.wait_until_fails("pgrep foot")
'';
}

14
tests/second-test.nix Normal file
View file

@ -0,0 +1,14 @@
{ }:
{
name = "secondTest";
nodes.test-machine2 = { suites ? null, ... }: {
imports = [
suites.iso
];
};
testScript = ''
machines[0].systemctl("is-system-running --wait")
'';
}