From ac5527310ac787d4f0682271dfb0f43edc8f4a6b Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 23 Jul 2024 17:45:51 +0100 Subject: [PATCH 1/3] .github/nix: init --- .github/workflows/go.yml | 1 - .github/workflows/nix.yaml | 19 +++++++++++++++++++ flake.nix | 6 ++++-- 3 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/nix.yaml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 3be82a3..a0ec3f7 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -10,7 +10,6 @@ on: branches: [ "main" ] jobs: - build: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/nix.yaml b/.github/workflows/nix.yaml new file mode 100644 index 0000000..ecd15b8 --- /dev/null +++ b/.github/workflows/nix.yaml @@ -0,0 +1,19 @@ +name: "Test" + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: DeterminateSystems/nix-installer-action@main + + - uses: DeterminateSystems/magic-nix-cache-action@main + + - run: nix flake check -L diff --git a/flake.nix b/flake.nix index b3115af..350c1a5 100644 --- a/flake.nix +++ b/flake.nix @@ -73,8 +73,10 @@ "-m 4G" "-vga none" "-device virtio-gpu-pci" - #"-device virtio-vga-gl" - #"-display gtk,gl=on" + # needs qemu_full: + # "-device virtio-vga-gl" + # "-display egl-headless,gl=core" + # "-display gtk,gl=on" ]; }; From 4f0f5184c0f939c69c9f8ab23f32cbff333a618f Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 23 Jul 2024 17:53:05 +0100 Subject: [PATCH 2/3] flake: simplify bash init script --- flake.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 350c1a5..48a7121 100644 --- a/flake.nix +++ b/flake.nix @@ -104,9 +104,7 @@ # bash '' if [ "$(tty)" = "/dev/tty1" ]; then - mkdir -p $HOME/.config/hypr - cp ${hyprlandConf} $HOME/.config/hypr/hyprland.conf - Hyprland + Hyprland --config ${hyprlandConf} fi ''; }; From b4f028e68cd98b467725d397759c6adcdeea4253 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 23 Jul 2024 17:56:59 +0100 Subject: [PATCH 3/3] request_test: increase Dispatch test retries to run it in CI --- flake.nix | 2 +- request_test.go | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index 48a7121..b2dec9f 100644 --- a/flake.nix +++ b/flake.nix @@ -89,7 +89,7 @@ # bash '' cd ${./.} - go test -short -v 2>&1 | tee -a "$HOME/test.log" + go test -v 2>&1 | tee -a "$HOME/test.log" echo $? > "$HOME/test-finished" hyprctl dispatch exit ''; diff --git a/request_test.go b/request_test.go index bb86d61..e05caf9 100644 --- a/request_test.go +++ b/request_test.go @@ -165,7 +165,6 @@ func TestDispatch(t *testing.T) { if testing.Short() { t.Skip("skip slow test") } - // Testing if we can open at least the amount of instances we asked // Dispatch() to open. // The reason this test exist is because Hyprland has a hidden @@ -175,9 +174,9 @@ func TestDispatch(t *testing.T) { // batch commands is working as expected. // See also: prepareRequests function and MAX_COMMANDS const const want = 35 - const retries = 10 + const retries = 15 t.Run(fmt.Sprintf("test_opening_%d_kitty_instances", want), func(t *testing.T) { - must1(c.Dispatch(genParams("exec kitty sh -c 'sleep 10 && exit 0'", want)...)) + must1(c.Dispatch(genParams(fmt.Sprintf("exec kitty sh -c 'sleep %d && exit 0'", retries), want)...)) awid := must1(c.ActiveWorkspace()).Id got := 0 for i := 0; i < retries; i++ {