From 43da588d4a8ccff37ca481c12b6b7c72b79186c9 Mon Sep 17 00:00:00 2001
From: Rich Wareham <rjw57@cam.ac.uk>
Date: Mon, 2 Oct 2023 12:09:17 +0100
Subject: [PATCH] feat: move to using the common CI pipeline

We now have a common CI pipeline which includes things like packaging
and publication to PyPI. Make use of it.
---
 .gitlab-ci.yml | 35 +++++++++--------------------------
 tox.ini        |  8 +++++---
 2 files changed, 14 insertions(+), 29 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8415963..bb762b5 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,38 +1,21 @@
 include:
-  # Bring in the AutoDevOps template from GitLab.
-  # It can be viewed at:
-  # https://gitlab.com/gitlab-org/gitlab-ee/blob/master/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml
-  - template: Auto-DevOps.gitlab-ci.yml
-
-  # Overrides to AutoDevOps for testing
-  - project: "uis/devops/continuous-delivery/ci-templates"
-    ref: "v2.6.2"
-    file: "/auto-devops/tox-tests.yml"
-
-  # Allow publishing to pypi
+  # Include the common project pipeline.
   - project: "uis/devops/continuous-delivery/ci-templates"
-    ref: "v2.6.2"
-    file: "/pypi-release.yml"
+    ref: "v3.0.0"
+    file: "/auto-devops/common-pipeline.yml"
 
 variables:
   DOCUMENTATION_DISABLED: "1"
   DAST_DISABLED: "1"
 
 # ensure the coverage reports get picked up correctly
-test:
-  artifacts:
-    reports:
-      coverage_report:
-        coverage_format: cobertura
-        path: ./artefacts/coverage.xml
-  variables:
-    TOX_ENVLIST: "black,flake8,py3"
-
-pypi-release:
-  image: "${CI_REGISTRY_IMAGE}/${CI_COMMIT_BRANCH}:${CI_COMMIT_SHA}"
-  needs: ["build"]
+python:tox:
   variables:
-    DIST_LOCATION: "/dist"
+    TOX_ADDITIONAL_REQUIREMENTS: "poetry"
+  parallel:
+    matrix:
+      - TOX_OPTS: "-e $TOX_ENV"
+        TOX_ENV: [black,flake8,py3]
 
 latest-spec:
   image: python:3.10
diff --git a/tox.ini b/tox.ini
index de74d4f..9e01944 100644
--- a/tox.ini
+++ b/tox.ini
@@ -24,9 +24,11 @@ skipsdist=True
 build_root={env:TOXINI_ARTEFACT_DIR:{toxinidir}/build}
 
 [testenv]
-# Additional dependencies
-deps=
-    -rtox-requirements.txt
+skipinstall=True
+allowlist_externals=
+    poetry
+commands_pre=
+    poetry install --sync
 # Which environment variables should be passed into the environment.
 passenv=
 #   Allow people to override the coverage report location should they so wish.
-- 
GitLab