From d007fcaac446b2b2599fae4281b5c06a727b0d0a 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      | 3 ++-
 docs/.gitlab-ci.yml | 6 ++++--
 tox.ini             | 1 +
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6d8ff33..c8992eb 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -31,11 +31,12 @@ run-tox-pipeline:
     - pip install virtualenv
     - virtualenv venv
     - . venv/bin/activate
+    - pip install tox
 
   script:
-    - pip install tox
     - tox
 
   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
diff --git a/tox.ini b/tox.ini
index 2ae2ffc..ec1dbc5 100644
--- a/tox.ini
+++ b/tox.ini
@@ -29,3 +29,4 @@ commands =
     black --check .
     mypy .
     flake8
+    python docs/dump-openapi-spec.py
-- 
GitLab