chore: import upstream snapshot with attribution
This commit is contained in:
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
set -euxo pipefail
|
||||
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake .. -DCMAKE_POLICY_VERSION_MINIMUM=3.5
|
||||
make -j$(nproc)
|
||||
cd -
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
set -euxo pipefail
|
||||
|
||||
export PYTHONPATH=$PWD/python
|
||||
cd docs && make html && cd ..
|
||||
|
||||
cd site && jekyll b && cd ..
|
||||
|
||||
rm -rf site/_site/docs
|
||||
cp -r docs/_build/html site/_site/docs
|
||||
@@ -0,0 +1,41 @@
|
||||
import argparse
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
def find_urls_in_file(file_path):
|
||||
with open(file_path) as file:
|
||||
content = file.read()
|
||||
|
||||
# Regular expression pattern to match URLs
|
||||
url_pattern = re.compile(
|
||||
r"http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+"
|
||||
)
|
||||
|
||||
# Find all matches of URLs in the content
|
||||
urls = re.findall(url_pattern, content)
|
||||
return [url.strip(">") for url in urls]
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Check validity of links in documentation")
|
||||
parser.add_argument("--directory", type=str, default="docs", help="Directory of documentation.")
|
||||
args = parser.parse_args()
|
||||
|
||||
# traversal the directory and find all rst files
|
||||
doc_directory = Path(args.directory)
|
||||
for file_path in doc_directory.glob("**/*.rst"):
|
||||
print(f"Checking {file_path}...")
|
||||
for url in find_urls_in_file(file_path):
|
||||
try:
|
||||
r = requests.get(url)
|
||||
if r.status_code == 404:
|
||||
print(f"404 not found: {url}")
|
||||
except Exception as e:
|
||||
print(f"Error connecting {url}, error: {e}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
# NOTE: this script is triggered by github action automatically
|
||||
# when megred into main
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
scripts/build_mlc_for_docs.sh
|
||||
scripts/build_site.sh
|
||||
|
||||
git fetch
|
||||
git checkout -B gh-pages origin/gh-pages
|
||||
rm -rf docs .gitignore
|
||||
mkdir -p docs
|
||||
cp -rf site/_site/* docs
|
||||
touch docs/.nojekyll
|
||||
|
||||
DATE=`date`
|
||||
git add docs && git commit -am "Build at ${DATE}"
|
||||
git push origin gh-pages
|
||||
git checkout main && git submodule update
|
||||
echo "Finish deployment at ${DATE}"
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
# NOTE: use this script to check local site
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
scripts/build_site.sh
|
||||
|
||||
cd site && jekyll serve --skip-initial-build --host localhost --baseurl / --port 8888
|
||||
Reference in New Issue
Block a user