From f3e5997446a3301010e174f9f84b4bb0fb6c8a4c Mon Sep 17 00:00:00 2001
From: Karel van Klink <karel.vanklink@geant.org>
Date: Wed, 5 Jul 2023 17:48:59 +0200
Subject: [PATCH] build openAPI spec in tox step

---
 .gitlab-ci.yml      | 4 +++-
 docs/.gitlab-ci.yml | 6 ++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6d8ff33..3d4f91d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -31,11 +31,13 @@ run-tox-pipeline:
     - pip install virtualenv
     - virtualenv venv
     - . venv/bin/activate
+    - pip install tox
 
   script:
-    - pip install tox
     - tox
+    - python3 docs/dump-openapi-spec.py
 
   artifacts:
     paths:
       - htmlcov
+      - docs/source/_static/openapi.json
diff --git a/docs/.gitlab-ci.yml b/docs/.gitlab-ci.yml
index 02cfc2d..221a727 100644
--- a/docs/.gitlab-ci.yml
+++ b/docs/.gitlab-ci.yml
@@ -5,10 +5,12 @@ build-documentation:
   tags:
     - docker-executor
   image: sphinxdoc/sphinx:latest
+  needs:
+    - job: run-tox-pipeline
+      artifacts: true
 
   before_script:
-    - pip install sphinx_rtd_theme fastapi
-    - python docs/dump-openapi-spec.py
+    - pip install sphinx_rtd_theme
   script:
     - sphinx-apidoc lso lso/app.py -o docs/source -d 2 -f
     - sphinx-build -b html docs/source docs/build
-- 
GitLab