-
Notifications
You must be signed in to change notification settings - Fork 86
72 lines (62 loc) · 2.75 KB
/
check-tutorial.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: "Check tutorial"
on:
push:
branches:
- master
- release
pull_request:
schedule:
# Everyday at 4:00 AM
- cron: "0 4 * * *"
jobs:
check-tutorial:
name: "Check tutorial"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check links
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
folder-path: "docs/docs/tutorial"
config-file: ".github/workflows/check-links-config.json"
# TODO: use javascript? https://github.com/marketplace/actions/execute-javascript-inline
- name: Using currently supported cardano-node version?
shell: python
run: |
import re
with open("docs/docs/tutorial/index.md", "r") as tutorial:
body = tutorial.read()
usedCardanoNodeVersions = re.findall(r"cardano_node_version=([0-9]+\.[0-9]+\.[0-9]+)", body)
with open("hydra-cluster/test/Test/CardanoNodeSpec.hs", "r") as cardanoNodeSpecFile:
body = cardanoNodeSpecFile.read()
expectedCardanoNodeVersion = re.findall(r"supportedCardanoNodeVersion.*([0-9]+\.[0-9]+\.[0-9]+)", body)[0]
print("Checking used cardano-node versions")
if len(usedCardanoNodeVersions) > 0 and all(v == expectedCardanoNodeVersion for v in usedCardanoNodeVersions):
print(" PASS ✓")
else:
print(" FAIL ❌")
print("Expected cardano-node version:", expectedCardanoNodeVersion)
print("Used cardano-node versions:", usedCardanoNodeVersions)
exit(-1)
- name: Check mithril endpoints
shell: python
run: |
import re
with open("docs/docs/tutorial/index.md", "r") as tutorial:
body = tutorial.read()
usedMithrilEndpoints = re.findall(r"AGGREGATOR_ENDPOINT=(.*)", body)
import requests
# TODO: ideally use a JSON document with all endpoints in it
resp = requests.get("https://raw.githubusercontent.com/input-output-hk/mithril/main/docs/website/versioned_docs/version-maintained/networks-matrix.md")
body = resp.text
preprodSection = body[body.find("<TabItem value=\"preprod\""):]
preprodSection = preprodSection[:preprodSection.find("</TabItem>")]
knownMithrilEndpoints = re.findall(r"Aggregator endpoint.*\((http[^\)]*)", preprodSection)
print("Checking mithril aggregator endpoints")
if len(usedMithrilEndpoints) > 0 and all(v in set(knownMithrilEndpoints) for v in usedMithrilEndpoints):
print(" PASS ✓")
else:
print(" FAIL ❌")
print(" Used mithril aggregator endpoints:", usedMithrilEndpoints)
print(" Upstream mithril aggregator endpoints:", knownMithrilEndpoints)
exit(-1)