[tracker/wip/carlosg/test] ci: Add intermediate job to build the website before deploying



commit b5dd35bc93f8364856aec9c78b857b939c14d59b
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Aug 29 17:12:58 2021 +0200

    ci: Add intermediate job to build the website before deploying
    
    This job allows us to check website output in merge requests, before
    having it deployed to the gitlab pages.
    
    The script that generates the website HTML has been changed to allow
    specifying the output directory, so it's not always the "public"
    special directory.

 .gitlab-ci.yml        | 20 ++++++++++++++++----
 docs/website/build.py |  6 ++++--
 2 files changed, 20 insertions(+), 6 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8bb04fcda..5694e1491 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -383,7 +383,7 @@ static-scan:
       - _scan_build/meson-logs
   allow_failure: true
 
-pages:
+test-website:
   extends:
     - .fdo.distribution-image@fedora
     - .tracker.fedora:34@x86_64
@@ -399,12 +399,24 @@ pages:
     - |
       export tracker_commit=$CI_COMMIT_SHA
       export tracker_miners_commit=$(git -C ./extra/tracker-miners rev-parse HEAD)
-      ./docs/website/build.py --api-docs="$install_prefix/share/gtk-doc/html" 
--tracker-commit=${tracker_commit} --man-pages ./docs/manpages/*.txt 
./extra/tracker-miners/docs/manpages/*.txt
+      ./docs/website/build.py --output=website --api-docs="$install_prefix/share/gtk-doc/html" 
--tracker-commit=${tracker_commit} --man-pages ./docs/manpages/*.txt 
./extra/tracker-miners/docs/manpages/*.txt
   artifacts:
     paths:
-      - public
+      - website
   needs:
     - build-fedora-container@x86_64
+
+pages:
+  extends:
+    - .fdo.distribution-image@fedora
+    - .tracker.fedora:34@x86_64
+  stage: website
+  script:
+    - mv website public
+  artifacts:
+    paths:
+      - public
+  needs:
+    - test-website
   only:
     - master
-    - /^sam\/website.*$/
diff --git a/docs/website/build.py b/docs/website/build.py
index 599021377..629c07b33 100755
--- a/docs/website/build.py
+++ b/docs/website/build.py
@@ -32,7 +32,6 @@ import tempfile
 
 log = logging.getLogger('build.py')
 
-output_path = pathlib.Path('public')
 website_root = pathlib.Path(__file__).parent
 docs_root = website_root.parent
 source_root = docs_root.parent
@@ -45,6 +44,8 @@ xmlto = shutil.which('xmlto')
 def argument_parser():
     parser = argparse.ArgumentParser(
         description="Tracker website build script")
+    parser.add_argument('--output', required=True, metavar='OUTPUT',
+                        help="Output directory")
     parser.add_argument('--debug', dest='debug', action='store_true',
                         help="Enable detailed logging to stderr")
     parser.add_argument('--api-docs', required=True, metavar='PATH',
@@ -143,6 +144,7 @@ def tmpdir():
 
 def main():
     args = argument_parser().parse_args()
+    output_path = pathlib.Path(args.output)
 
     if args.debug:
         logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
@@ -205,7 +207,7 @@ def main():
     for filename in apidocs_dest.rglob('*.html'):
         add_apidocs_header(text, filename)
 
-    log.info("Documentation available in public/ directory.")
+    log.info("Documentation available in %s/ directory.", args.output)
 
 
 try:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]