Skip to content

Commit

Permalink
Update from upstream again
Browse files Browse the repository at this point in the history
  • Loading branch information
CallumWalley committed Sep 27, 2024
1 parent d78895b commit 4dd58ab
Show file tree
Hide file tree
Showing 12 changed files with 166 additions and 53 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/demo_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Deploy PR branches
on:
pull_request:
workflow_dispatch:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TARGET_REPO: "mkdocs-demo-deploy"
TARGET_OWNER: "CallumWalley"
WORKFLOW_ID: "deploy.yml"
DEPLOY_URL: "https://callumwalley.github.io/mkdocs-demo-deploy"
HEAD: ${{ github.event.pull_request.head.ref }}
permissions: write-all
jobs:
demo-deploy:
continue-on-error: true
name: Trigger test deployments
runs-on: ubuntu-latest
steps:
- name: Trigger Workflow in Another Repository
run: |
set -x
set -o xtrace
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.PAT }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${TARGET_OWNER}/${TARGET_REPO}/dispatches \
-d "{\"event_type\":\"deploy\",\"client_payload\":{\"targets\":\"${GITHUB_REPOSITORY}:${HEAD}\", \"use-cache\":\"true\"}}"
# This would be better if it worked
# - name: Run 'deploy.yml' Workflow
# uses: convictional/trigger-workflow-and-wait@v1.6.1
# with:
# owner: ${TARGET_OWNER}
# repo: ${TARGET_REPO}
# github_token: ${{ secrets.PAT }}
# workflow_file_name: deploy.yml
# client_payload: '{"targets":"${GITHUB_REPOSITORY}:${HEAD}", "use-cache":"true"}'
- name: Wait for Workflow Action
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.PAT }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${TARGET_OWNER}/${TARGET_REPO}/actions/runs/deploy.yml
- name: Wait for Workflow Action
run: |
# Just give a minute or so to deploy
sleep 60
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Post messages open requests
run: |
msg="Test deployment available at <a href=\"${DEPLOY_URL}/${GITHUB_REPOSITORY}/${HEAD}\">${DEPLOY_URL}/${GITHUB_REPOSITORY}/${HEAD}</a>"
changed_pages="$(git diff --name-only origin/main -- '*.md')"
# Logic for truncating out long sections commented out.
# maxlines=-5
if [ -n "${changed_pages}" ]; then
msg="${msg}<br><br>Seems the following pages differ;<br><ul>"
for f in ${changed_pages};do
# maxlines=((maxlines+1))
#if [ ${maxlines} -lt 1 ]; then
g=${f#*/}; h=${g%.*}
msg="${msg}<li><a href=\"${DEPLOY_URL}/${GITHUB_REPOSITORY}/${HEAD}/${h}\" target=_blank>${h##*/}</a></li>"
#fi
done
# if [ ${maxlines} -gt 0 ];then
# msg="${msg}<li> ... and ${maxlines} more.</li>"
# fi
msg="${msg}</ul>"
fi
msg="${msg}<br><br><em><a href="${DEPLOY_URL}">See all deployed demo sites</a></em>"
(gh pr comment ${HEAD} --edit-last --body "${msg}") || (gh pr comment ${HEAD} --body "${msg}")
echo "::info title=Deploy successful::${DEPLOY_URL}/${GITHUB_REPOSITORY}/${HEAD}"
3 changes: 2 additions & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"column": 4,
"endLine": 5,
"message": 7,
"loop": true
},
"owner": "proselint",
"fileLocation": "autoDetect",
Expand Down Expand Up @@ -94,7 +95,7 @@
"column": 4,
"endColumn": 5,
"line": 6,
"message": 7
"message": 7,
},
"owner": "test-build",
"fileLocation": [
Expand Down
6 changes: 6 additions & 0 deletions checks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ Spellcheck pipeline settings can be modified in [.spellcheck.yml](../.spellcheck
List of custom words can be found in [dictionary.txt](../docs/assets/glossary/dictionary.txt),
however you **should not edit this manually**, see [adding-words-to-dictionary](../docs/CONTRIBUTING.md#adding-words-to-dictionary).

This list is automatically updated daily in the case of docs.nesi, but not the other sites.
You should occasionally run
`wget -O docs/assets/glossary/dictionary.txt https://raw.githubusercontent.com/nesi/nesi-wordlist/main/outputs/dictionary.txt`
to keep it up to date.


### Limitations

Spellchecker does not provide output lineumber / column.
Expand Down
36 changes: 20 additions & 16 deletions checks/run_meta_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ def _run_check(f):
for r in f():
print(f"::{r.get('level', 'warning')} file={input_path},title={f.__name__},col={r.get('col', 0)},endColumn={r.get('endColumn', 99)},line={r.get('line', 1)}::{r.get('message', 'something wrong')}")
sys.stdout.flush()
time.sleep(0.01)



def _title_from_filename():
Expand Down Expand Up @@ -136,26 +138,29 @@ def _unpack(toc, a):
return toc[a[0]]
return _unpack(toc[a[0]]["children"], a[1:])

if in_code_block:
return
try:
if in_code_block:
return

header_match = re.match(r"^(#+)\s*(.*)$", line)
header_match = re.match(r"^(#+)\s*(.*)$", line)

if not header_match:
return

header_level = len(header_match.group(1))
header_name = header_match.group(2)
if not header_match:
return
header_level = len(header_match.group(1))
header_name = header_match.group(2)

if header_level == 1:
toc = {header_name: {"lineno": lineno, "children": {}}}
toc_parents = [header_name]
if header_level == 1:
toc = {header_name: {"lineno": lineno, "children": {}}}
toc_parents = [header_name]

while header_level < len(toc_parents)+1:
toc_parents.pop(-1)
while header_level < len(toc_parents)+1:
toc_parents.pop(-1)

_unpack(toc, toc_parents)["children"][header_name] = {"level": header_level, "lineno": lineno, "children": {}}
toc_parents += [header_name]
_unpack(toc, toc_parents)["children"][header_name] = {"level": header_level, "lineno": lineno, "children": {}}
toc_parents += [header_name]
except Exception:
print(f"::error file={input_path},title=misc-nav,col=0,endColumn=0,line=1 ::Failed to parse Nav tree. Something is wrong.")


def _nav_check():
Expand Down Expand Up @@ -268,4 +273,3 @@ def _count_children(d):

# FIXME terrible hack to make VSCode in codespace capture the error messages
# see https://github.com/microsoft/vscode/issues/92868 as a tentative explanation
time.sleep(5)
4 changes: 3 additions & 1 deletion checks/run_proselint.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import sys
from pathlib import Path
import time

import proselint
from proselint import config, tools
Expand All @@ -22,10 +23,11 @@
for file in files:
print(f"Running proselint on {file}")
content = Path(file).read_text(encoding="utf8")
fails = proselint.tools.lint(content, config=config_custom)
for notice in proselint.tools.lint(content, config=config_custom):
print(
f"::{notice[7]} file={file},line={notice[2]+1},"
f"col={notice[3]+2},endColumn={notice[2]+notice[6]+1},"
f"title={notice[0]}::'{notice[1]}'",
flush=True,
)
time.sleep(0.01)
13 changes: 12 additions & 1 deletion checks/run_test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
import logging
import sys
import re
import time


"""
This doesnt work and I have no idea why.
This works but is a bit messy
"""


def parse_macro(record):

# These are not useful messages
Expand All @@ -29,6 +32,13 @@ def parse_macro(record):
record.name = g["title"]
record.filename = g["file"]
record.msg = g["message"]

# Does not give correct path to file in question in 'title'.
# Infer from message.
m = re.search(r"'(.*?\.md)'", record.msg)
if m:
record.filename = m.group(1)

return True


Expand All @@ -42,3 +52,4 @@ def parse_macro(record):
log.addHandler(sh)
config = load_config(config_file_path="./mkdocs.yml")
build.build(config)
time.sleep(5)
2 changes: 2 additions & 0 deletions docs/assets/glossary/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1750,6 +1750,7 @@ json-c's
json-c
jvarkit's
jvarkit
kaitiaki
kaitiakitanga
kalign2's
kalign2
Expand Down Expand Up @@ -2168,6 +2169,7 @@ tabix's
tabix
tabixpp's
tabixpp
taonga
tbb's
tbb
tbl2asn's
Expand Down
4 changes: 1 addition & 3 deletions docs/assets/glossary/update_dictionary.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/bin/bash

# Updates dictionary for spellcheck

wget -O docs/assets/glossary/dictionary.txt https://raw.githubusercontent.com/nesi/nesi-wordlist/main/outputs/dictionary.txt
( cd "${PWD/\/docs\/*/}" && wget -O docs/assets/glossary/dictionary.txt https://raw.githubusercontent.com/nesi/nesi-wordlist/main/outputs/dictionary.txt )
31 changes: 0 additions & 31 deletions docs/assets/stylesheets/footer copy.css

This file was deleted.

41 changes: 41 additions & 0 deletions docs/assets/stylesheets/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,62 @@
--md-accent-bg-color: rgb(210,227,235);
--md-accent-bg-color--light: rgb(210,227,235,0.5);
}
/* :root{
--nesi-grey : #414f5c;
--nesi-grey--light: #94a5ad;
--nesi-yellow :#fcce06;
--nesi-purple: rgb(202, 159, 213);
--nesi-orange : rgb(244, 121, 37);
--nesi-blue : #4fbaed;
--nesi-red:#ef315e;
--nesi-green: #cce310;
[data-md-color-scheme="default"]{
--md-primary-fg-color: var(--nesi-red);
--md-accent-fg-color: var(--nesi-orange);;
--md-accent-fg-color--transparent: rgb(244, 121, 37, 0.25);
}
--md-accent-bg-color: rgb(210,227,235);
[data-md-color-scheme="slate"] {
--md-primary-fg-color: var(--nesi-red);
--md-accent-fg-color: var(--nesi-orange);;
--md-accent-fg-color--transparent: rgb(244, 121, 37, 0.25);
.nt-card-image>img {
filter: brightness(0) invert(1);
}
}
}
// Logo biggification
/* .md-header__button.md-logo img, .md-header__button.md-logo svg {
height: 4rem;
margin: -2rem;
} */

/* Version table stuff */
.md-tag.md-tag-ver{
color: var(--md-code-fg-color);
}
.md-tag.md-tag-ver-shown {
outline: var(--md-primary-fg-color) 2px solid;
}

.md-tag-ver-warn {
text-decoration: line-through;
}
.md-typeset__table {
width: 100%;
}
.md-typeset__table table:not([class]) {
display: table
}
/* convenience class. Not sure if it is used */
.hidden{
display: none;
}
/* Get support button */
.md-button-support{
position: absolute;
margin: -2rem 0 0 1rem;
Expand Down
1 change: 1 addition & 0 deletions overrides/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ This is for customising the [material theme](https://squidfunk.github.io/mkdocs-

When possible, it is best to _extend_ a template (using 'super') rather than straight replacing.


Overriding files must mirror the original file structure if you are replacing an existing file.
However, you can put your own custom stuff in here.
Here is a list of the original available files, before override:
Expand Down
Empty file removed overrides/partials/.gitkeep
Empty file.

0 comments on commit 4dd58ab

Please sign in to comment.