Repository: opensafely-core/cohort-extractor (language: python)

Issue:
Move the EMIS version check to a scheduled workflow
As opposed to running in the tests.

Suggested by [@evansd](https://github.com/opensafely-core/cohort-extractor/pull/593#issuecomment-865036536) and raised again by him today. We should check on a regular schedule: otherwise, this check only occurs when anyone is writing new code. EMIS might change the version in the interim.
feat: Revert to Starburst with Presto
This PR reverts #619 which changed our integration with Starburst to use Trino. See #619 for more details. 

This PR is required because EMIS reverted back to using Starburst with Presto, albeit presumably the [final release](https://hub.docker.com/r/starburstdata/presto/tags?page=1&ordering=last_updated) with Presto available (2c6852a1b625a7796d28c771d43d4819cf70c35a).

This downgrade broke our check of the EMIS Starburst version, and is causing our CI to fail again.


Discussion / hints:
Will do post-merge of #619.
Other notes here:
* I've restored the original branch from #619 so that it can be pull requested again in future. The changes there should be good, just that we need to wait for EMIS to upgrade again. The tests currently fail because of the version change required in 2c6852a1b625a7796d28c771d43d4819cf70c35a here.
* Not sure what the conventional commit/semantic versioning interpretation is here. It's odd to have a revert be a *feature*. But if it is merely labelled `fix/chore`, it will only be a point release, which feels a bit off to me. Suggestions welcome.
* We should tackle #620 to spot version changes in future. The only reason this has been noticed is because I've been pushing commits for #612.

Fix patch:
diff --git a/.github/workflows/emis_presto_version_check.yaml b/.github/workflows/emis_presto_version_check.yaml
new file mode 100644
index 00000000..529cd6c9
--- /dev/null
+++ b/.github/workflows/emis_presto_version_check.yaml
@@ -0,0 +1,29 @@
+name: Check Presto version on EMIS and in docker-compose.yml match
+
+on:
+  workflow_dispatch:
+  schedule:
+    - cron: '0 8 * * 1-5'
+
+jobs:
+  check-presto-version:
+    name: Check Presto version
+    runs-on: ubuntu-latest
+
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/setup-python@v2
+        with:
+          python-version: "3.8"
+      - name: Install
+        run: |
+          set -xe
+          python -m pip install --upgrade pip
+          python -m venv venv
+          # Save time by only installing the necessary requirements for the single test.
+          venv/bin/pip install --progress-bar=off --requirement <(grep -E "^(requests|pyyaml|pytest)==" requirements.txt)
+
+      - name: Run version check test
+        run: |
+          source ${{ github.workspace }}/venv/bin/activate
+          TEST_PRESTO_DOCKER_VERSION=1 PYTHONPATH=. pytest -vvv tests/test_presto_docker_version.py


Test patch:
diff --git a/tests/test_presto_docker_version.py b/tests/test_presto_docker_version.py
index 751a027d..a08a80cb 100644
--- a/tests/test_presto_docker_version.py
+++ b/tests/test_presto_docker_version.py
@@ -1,7 +1,14 @@
+import os
+
+import pytest
 import requests
 import yaml
 
 
+@pytest.mark.skipif(
+    os.environ.get("TEST_PRESTO_DOCKER_VERSION") != "1",
+    reason="TEST_PRESTO_DOCKER_VERSION=1 not set in environment",
+)
 def test_docker_version():
     with open("docker-compose.yml") as f:
         our_version = yaml.safe_load(f)["services"]["presto"]["image"].split(":")[1]