Skip to content

Commit

Permalink
Merge branch 'master' into updaterules-pr
Browse files Browse the repository at this point in the history
Signed-off-by: habibayassin <[email protected]>
  • Loading branch information
habibayassin authored Aug 12, 2024
2 parents bfdd8dc + 0581e8e commit cbc7929
Show file tree
Hide file tree
Showing 166 changed files with 174,673 additions and 5,085 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/black.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Lint Python

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable

52 changes: 52 additions & 0 deletions .github/workflows/github-actions-manual-update-rules.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Manually Trigger Update Rules
on:
workflow_dispatch:
inputs:
type:
description: 'Type of update (overwrite or normal)'
required: true
default: 'normal'

jobs:
update:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Check out repository code recursively
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Python Packages
run: |
pip install firebase-admin
- name: Execute Python Script Update
env:
CREDS_FILE: ${{ secrets.CREDS_FILE }}
API_BASE_URL: ${{ secrets.API_BASE_URL }}
run: |
if [[ "${{ github.event.inputs.type }}" == "overwrite" ]]; then
python flow/util/updateRules.py --keyFile "${CREDS_FILE}" --apiURL ${API_BASE_URL} --commitSHA $(git rev-parse HEAD) --overwrite
else
python flow/util/updateRules.py --keyFile "${CREDS_FILE}" --apiURL ${API_BASE_URL} --commitSHA $(git rev-parse HEAD)
fi
- name: Push updated rules
id: remote-update
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
if [ -n "$(git status --porcelain)" ]; then
echo "has_update=true" >> "$GITHUB_OUTPUT"
else
echo "has_update=false" >> "$GITHUB_OUTPUT"
fi
git add .
git commit --signoff -m "flow: update rules based on new golden reference"
- if: "steps.remote-update.outputs.has_update == 'true'"
name: update rules pr
id: remote-update-pr
run: |
git push
147 changes: 76 additions & 71 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

# -- Project information -----------------------------------------------------

project = 'OpenROAD Flow'
copyright = 'The Regents of the University of California, 2021'
author = 'OpenROAD Team'
project = "OpenROAD Flow"
copyright = "The Regents of the University of California, 2021"
author = "OpenROAD Team"


# -- General configuration ---------------------------------------------------
Expand All @@ -28,56 +28,56 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.ifconfig',
'sphinx.ext.mathjax',
'sphinx.ext.napoleon',
'sphinx.ext.todo',
'sphinx_external_toc',
'sphinx_copybutton',
'myst_parser',
'sphinxcontrib.mermaid'
"sphinx.ext.autodoc",
"sphinx.ext.ifconfig",
"sphinx.ext.mathjax",
"sphinx.ext.napoleon",
"sphinx.ext.todo",
"sphinx_external_toc",
"sphinx_copybutton",
"myst_parser",
"sphinxcontrib.mermaid",
]

myst_enable_extensions = [
'amsmath',
'colon_fence',
'deflist',
'dollarmath',
'html_admonition',
'html_image',
'replacements',
'smartquotes',
'substitution',
'tasklist',
'html_image',
"amsmath",
"colon_fence",
"deflist",
"dollarmath",
"html_admonition",
"html_image",
"replacements",
"smartquotes",
"substitution",
"tasklist",
"html_image",
]

external_toc_path = 'toc.yml'
external_toc_path = "toc.yml"

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
source_suffix = ['.md']
source_suffix = [".md"]

# The master toctree document.
master_doc = 'index2.md'
master_doc = "index2.md"

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = [
'_build',
'Thumbs.db',
'.DS_Store',
'**/LICENSE',
'**/LICENSE.md',
'README.md',
'docs/releases/PostAlpha2.1BranchMethodology.md',
'main',
'index.md'
"_build",
"Thumbs.db",
".DS_Store",
"**/LICENSE",
"**/LICENSE.md",
"README.md",
"docs/releases/PostAlpha2.1BranchMethodology.md",
"main",
"index.md",
]

# The name of the Pygments (syntax highlighting) style to use.
Expand All @@ -97,7 +97,6 @@
"show_navbar_depth": 2,
"use_issues_button": True,
"use_download_button": True,

# list for more fine-grained ordering of icons
"icon_links": [
{
Expand Down Expand Up @@ -126,81 +125,87 @@
"icon": "https://img.shields.io/github/stars/The-OpenROAD-Project/OpenROAD-flow-scripts",
"type": "url",
},
],
],
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".


def get_file_from_url(url, fname):
r = requests.get(url)
with open(fname, 'wb') as f:
with open(fname, "wb") as f:
f.write(r.content)


def swap_prefix(file, old, new):
with open(file, 'r') as f:
with open(file, "r") as f:
lines = f.read()
lines = lines.replace(old, new)
with open(file, 'wt') as f:
with open(file, "wt") as f:
f.write(lines)


def setup(app):
import shutil

# symlink does not work for ORFS because of long recursive file links
shutil.copy('../README.md', 'mainREADME.md')
swap_prefix('mainREADME.md', '```mermaid', '```{mermaid}\n:align: center\n')
shutil.copy("../README.md", "mainREADME.md")
swap_prefix("mainREADME.md", "```mermaid", "```{mermaid}\n:align: center\n")

# Grab the reference file from OR
url = 'https://raw.githubusercontent.com/The-OpenROAD-Project/OpenROAD/master/docs/contrib/GitGuide.md'
get_file_from_url(url, 'contrib/GitGuide.md')
url = "https://raw.githubusercontent.com/The-OpenROAD-Project/OpenROAD/master/docs/contrib/GitGuide.md"
get_file_from_url(url, "contrib/GitGuide.md")

# Temporarily using commit number, will change once OR commit merged.
url = 'https://raw.githubusercontent.com/The-OpenROAD-Project/OpenROAD/3563176d00daeb613eed2ccf9442137b0ae2cad3/docs/index.md'
get_file_from_url(url, 'SupportedOS.md')
url = "https://raw.githubusercontent.com/The-OpenROAD-Project/OpenROAD/3563176d00daeb613eed2ccf9442137b0ae2cad3/docs/index.md"
get_file_from_url(url, "SupportedOS.md")

# edit OpenROAD to OpenROAD-flow-scripts for GitGuide
with open('contrib/GitGuide.md', 'r') as f:
with open("contrib/GitGuide.md", "r") as f:
content = f.read()
content = content.replace('user/Build.md', '../index.md#build-or-installing-orfs-dependencies')
content = content.replace('OpenROAD', 'OpenROAD-flow-scripts')
content = content.replace('The-OpenROAD-flow-scripts', 'The-OpenROAD')
with open('contrib/GitGuide.md', 'w') as f:
content = content.replace(
"user/Build.md", "../index.md#build-or-installing-orfs-dependencies"
)
content = content.replace("OpenROAD", "OpenROAD-flow-scripts")
content = content.replace("The-OpenROAD-flow-scripts", "The-OpenROAD")
with open("contrib/GitGuide.md", "w") as f:
f.write(content)

# Create a copy of the index.md file
import shutil
shutil.copy('index.md', 'index2.md')

# Use re to find the desired content
start_pattern = '## Supported Operating Systems'
end_pattern = '## Code of conduct'
with open('SupportedOS.md', 'r') as f:
shutil.copy("index.md", "index2.md")

# Use re to find the desired content
start_pattern = "## Supported Operating Systems"
end_pattern = "## Code of conduct"
with open("SupportedOS.md", "r") as f:
markdown_content = f.read()

match = re.search(f'{start_pattern}(.*?){end_pattern}', markdown_content, re.DOTALL)
assert match is not None, 'No match found, check the OR Doc pattern on index.md'
match = re.search(f"{start_pattern}(.*?){end_pattern}", markdown_content, re.DOTALL)

assert match is not None, "No match found, check the OR Doc pattern on index.md"
extracted_content = match.group(1)
extracted_content = "\n#### Supported Operating Systems" + extracted_content
print(extracted_content)

# Find insert position
with open('index2.md', 'r') as f:
with open("index2.md", "r") as f:
existing_content = f.read()
match = re.search(r'### Setup', existing_content)
assert match is not None, 'Check search keyword.'
with open('index2.md', 'w') as f:
match = re.search(r"### Setup", existing_content)
assert match is not None, "Check search keyword."
with open("index2.md", "w") as f:
insert_position = match.end() + 1
before_insert = existing_content[:insert_position]
after_insert = existing_content[insert_position:]

# Combine the parts with the extracted content
updated_content = before_insert + extracted_content + after_insert

f.write(updated_content)

# Get Manpage file
url = 'https://raw.githubusercontent.com/The-OpenROAD-Project/OpenROAD/master/src/utl/README.md'
get_file_from_url(url, 'Manpage.md')
url = "https://raw.githubusercontent.com/The-OpenROAD-Project/OpenROAD/master/src/utl/README.md"
get_file_from_url(url, "Manpage.md")
7 changes: 4 additions & 3 deletions docs/revert-links.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/usr/bin/env python3


def swap_prefix(file, old, new):
with open(file, 'r') as f:
with open(file, "r") as f:
lines = f.read()
lines = lines.replace(old, new)
with open(file, 'wt') as f:
with open(file, "wt") as f:
f.write(lines)


swap_prefix('mainREADME.md', '```{mermaid}\n:align: center\n', '```mermaid')
swap_prefix("mainREADME.md", "```{mermaid}\n:align: center\n", "```mermaid")
Loading

0 comments on commit cbc7929

Please sign in to comment.