From 6bdf5874e3facc6f9128ad122cccf1ca353dc952 Mon Sep 17 00:00:00 2001
From: Virgile Prevosto <virgile.prevosto@m4x.org>
Date: Thu, 16 Sep 2021 11:52:54 +0200
Subject: [PATCH] [ci] continuous integration tests doc generation

---
 .gitlab-ci.yml  |  8 ++++++++
 nix/default.nix | 20 ++++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4c5bc87370c..3661466d091 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -149,6 +149,14 @@ build-from-distrib-tarball:
   tags:
    - nix
 
+doc:
+  stage: tests
+  script:
+   - nix/frama-ci.sh build -A frama-c.doc
+  tags:
+   - nix
+  allow_failure: true
+
 .build_template: &internal_template
   stage: distrib_and_compatibility
   tags:
diff --git a/nix/default.nix b/nix/default.nix
index 139b30bb850..e2bb7214259 100644
--- a/nix/default.nix
+++ b/nix/default.nix
@@ -112,6 +112,26 @@ pkgs.lib.makeExtensible
         '';
   };
 
+  doc = mk_deriv {
+        name = "frama-c-doc";
+        buildInputs = self.buildInputs;
+        build_dir = self.main.build_dir;
+        src = self.main.build_dir + "/dir.tar";
+        sourceRoot = ".";
+        postPatch = ''
+               find . \( -name "Makefile*" -or -name ".depend" -o -name "ptests_config" -o -name "config.status" \) -exec bash -c "t=\$(stat -c %y \"\$0\"); sed -i -e \"s&$(cat $build_dir/old_pwd)&$(pwd)&g\" \"\$0\"; touch -d \"\$t\" \"\$0\"" {} \;
+        '';
+        configurePhase = ''
+          true
+        '';
+        buildPhase = ''
+               make doc
+        '';
+        installPhase = ''
+               true
+        '';
+  } // { other-opam-selection = "main";};
+
   tests = mk_deriv {
         name = "frama-c-test";
         buildInputs = self.buildInputs;
-- 
GitLab