From ab99be2fa7fcfdbc4f59ab47e428ae637301b3ac Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Sat, 1 Jun 2024 08:22:31 +1000 Subject: [PATCH] docs: add linkcheck --- dev/docs.nix | 14 ++++++++++++++ flake.nix | 2 +- tasks.py | 8 ++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/dev/docs.nix b/dev/docs.nix index 4afdb8f..6fc6627 100644 --- a/dev/docs.nix +++ b/dev/docs.nix @@ -23,5 +23,19 @@ cd $files mkdocs build --strict --site-dir $out ''; + docs-linkcheck = pkgs.testers.lycheeLinkCheck rec { + extraConfig = { + exclude = [ + "https://fonts.gstatic.com" + "https://monitoring.nix-community.org/alertmanager" # 401 behind auth + ]; + include_mail = true; + include_verbatim = true; + }; + remap = { + "https://nix-community.org" = site; + }; + site = config.packages.docs; + }; }; } diff --git a/flake.nix b/flake.nix index f196bcf..340851c 100644 --- a/flake.nix +++ b/flake.nix @@ -83,7 +83,7 @@ darwinConfigurations // devShells // { inherit (self') formatter; } // nixosConfigurations // pkgs.lib.optionalAttrs (system == "x86_64-linux") { - inherit (self'.packages) docs; + inherit (self'.packages) docs docs-linkcheck; nixpkgs-update-supervisor-test = pkgs.callPackage ./hosts/build02/supervisor_test.nix { }; nixosTests-buildbot = pkgs.nixosTests.buildbot; nixosTests-buildbot-nix-master = inputs'.buildbot-nix.checks.master; diff --git a/tasks.py b/tasks.py index 73c7954..17bca15 100644 --- a/tasks.py +++ b/tasks.py @@ -108,6 +108,14 @@ def mkdocs(c: Any) -> None: c.run("nix develop .#mkdocs -c mkdocs serve") +@task +def docs_linkcheck(c: Any) -> None: + """ + Run docs online linkchecker + """ + c.run("nix run .#docs-linkcheck.online") + + def get_hosts(hosts: str) -> List[DeployHost]: if hosts == "": res = subprocess.run(