Skip to content

Commit

Permalink
.github/nix: archive coverage files
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagokokada committed Jul 24, 2024
1 parent 6375b98 commit 15f35a0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 9 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/nix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ jobs:
- run: nix build -L

- run: nix flake check -L

- uses: actions/upload-artifact@v4
with:
name: coverage
path: |
/nix/store/*-nixos-test-driver-hyprland-go*/**/hyprland-go.{out,html}
32 changes: 23 additions & 9 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@
user = "alice";
uid = 1000;
home = "/home/${user}";

# Testing related file paths
covHtml = "${home}/hyprland-go.html";
covOut = "${home}/hyprland-go.out";
glxinfoOut = "${home}/glxinfo.out";
testFinished = "${home}/test-finished";
testLog = "${home}/test.log";
in
pkgs.nixosTest {
name = "hyprland-go";
Expand Down Expand Up @@ -84,11 +91,15 @@
pkgs.writeShellScript "hyprland-go-test"
# bash
''
glxinfo -B > "$HOME/glxinfo"
cd "${./.}"
go test -cover -v ./... > "$HOME/test.log" 2>&1
echo "$?" > "$HOME/test-finished"
hyprctl dispatch exit
set -euo pipefail
trap 'echo $? > ${testFinished}' EXIT
glxinfo -B > ${glxinfoOut} || true
cd ${./.}
go test -coverprofile ${covOut} -v > ${testLog} 2>&1
go tool cover -html=${covOut} -o ${covHtml}
hyprctl dispatch exit || true
'';
hyprlandConf =
pkgs.writeText "hyprland.conf"
Expand All @@ -111,11 +122,14 @@
start_all()
machine.wait_for_unit("multi-user.target")
machine.wait_for_file("${home}/test-finished")
machine.wait_for_file("${testFinished}")
print(machine.succeed("cat ${glxinfoOut} || true"))
print(machine.succeed("cat ${testLog}"))
print(machine.succeed("exit $(cat ${testFinished})"))
print(machine.succeed("cat ${home}/glxinfo || true"))
print(machine.succeed("cat ${home}/test.log"))
print(machine.succeed("exit $(cat ${home}/test-finished)"))
machine.copy_from_vm("${covOut}")
machine.copy_from_vm("${covHtml}")
'';
};
}
Expand Down

0 comments on commit 15f35a0

Please sign in to comment.