From 0ca0b2968ebaae27087922ae774dca0dcff70df4 Mon Sep 17 00:00:00 2001 From: Wojciech Gryncewicz Date: Thu, 19 Nov 2020 15:34:08 +0100 Subject: [PATCH 01/19] Proto of cell README generator --- docs/_ext/cell_list.py | 200 ++++++++++++++++++ .../skywater_pdk/cell-readme-generate.py | 130 ++++++++++++ .../skywater_pdk/netlistsvg-generate.py | 134 ++++++++++++ 3 files changed, 464 insertions(+) create mode 100644 docs/_ext/cell_list.py create mode 100755 scripts/python-skywater-pdk/skywater_pdk/cell-readme-generate.py create mode 100755 scripts/python-skywater-pdk/skywater_pdk/netlistsvg-generate.py diff --git a/docs/_ext/cell_list.py b/docs/_ext/cell_list.py new file mode 100644 index 000000000..e3e16acdb --- /dev/null +++ b/docs/_ext/cell_list.py @@ -0,0 +1,200 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Copyright 2020 SkyWater PDK Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +import argparse +import json +import os +import pathlib +import pprint +import sys +import textwrap +from docutils import nodes +from docutils.parsers.rst import Directive +from docutils.statemachine import ViewList +from sphinx.util.nodes import nested_parse_with_titles + +from typing import Tuple, List, Dict + +# using a list-table here to allow for easier line breaks in description +rst_header_line_char = '-' +rst_header = 'List of cells in :lib:`{libname}`' +rst_template ="""\ +{header_line} +{header_underline} + +.. list-table:: + :header-rows: 1 + + * - Cell name + - Description + - Type + - Verilog name +{cell_list} +""" + + +cell_template = """\ + * - {cell_name} + - {description} + - {type} + - {verilog_name} +""" + + +def collect(library_dir) -> Tuple[str, List[str]]: + """Collect the available definitions for cells in a library + + Parameters + ---------- + library_dir: str or pathlib.Path + Path to a library. + + Returns + ------- + lib : str + Library name + + cells : list of pathlib.Path + definition files for cells in the library. + """ + + if not isinstance(library_dir, pathlib.Path): + library_dir = pathlib.Path(library_dir) + + libname = None + cells = set() + + for p in library_dir.rglob("definition.json"): + if not p.is_file(): + continue + cells.add(p) + if libname is None: + with open(str(p), "r") as sample_json: + sample_def = json.load(sample_json) + libname = sample_def['library'] + + assert len(libname) > 0 + cells = list(sorted(cells)) + return libname, cells + + +def generate_rst(library_dir, library_name, cells): + """Generate the RST paragraph containing basic information about cells + + Parameters + ---------- + library_dir: str or pathlib.Path + Path to a library. + + library_name: str + Name of the library + + cells: list of pathlib.Path + List of paths to JSON description files + + Returns + ------- + paragraph: str + Generated paragraph + """ + + if not isinstance(library_dir, pathlib.Path): + library_dir = pathlib.Path(library_dir) + + paragraph = "" + cell_list = "" + + for cell in cells: + with open(str(cell), "r") as c: + cell_json = json.load(c) + cell_list = cell_list + cell_template.format( + cell_name = cell_json['name'], + #description = cell_json['description'].replace("\n", "\n "), + description = textwrap.indent(cell_json['description'], ' ').lstrip(), + type = cell_json['type'], + verilog_name = cell_json['verilog_name'] + ) + + header = rst_header.format(libname = library_name) + paragraph = rst_template.format( + header_line = header, + header_underline = rst_header_line_char * len(header), + cell_list = cell_list + ) + return paragraph + +# --- Sphinx extension wrapper --- + +class CellList(Directive): + + def run(self): + env = self.state.document.settings.env + dirname = env.docname.rpartition('/')[0] + libname, cells = collect(dirname) + paragraph = generate_rst(dirname, libname, cells) + # parse rst string to docutils nodes + rst = ViewList() + for i,line in enumerate(paragraph.split('\n')): + rst.append(line, libname+"-cell-list.rst", i+1) + node = nodes.section() + node.document = self.state.document + nested_parse_with_titles(self.state, rst, node) + return node.children + + +def setup(app): + app.add_directive("cell_list", CellList) + + return { + 'version': '0.1', + 'parallel_read_safe': True, + 'parallel_write_safe': True, + } + +# --- stand alone, command line operation --- + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument( + "library_dir", + help="Path to the library.", + type=pathlib.Path, + nargs=1) + + args = parser.parse_args() + lib = args.library_dir[0] + + print(f"Analysing {lib}") + libname, cells = collect(lib) + print(f"Library name: {libname}, found {len(cells)} cells") + paragraph = generate_rst(lib, libname, cells) + library_dir = pathlib.Path(lib) + cell_list_file = pathlib.Path(library_dir, "cell-list.rst") + try: + with(open(str(cell_list_file), "w")) as c: + c.write(paragraph) + print(f'Generated {cell_list_file}') + except FileNotFoundError: + print(f"ERROR: Failed to create {str(cell_list_file)}", file=sys.stderr) + raise + + +if __name__ == "__main__": + sys.exit(main()) + diff --git a/scripts/python-skywater-pdk/skywater_pdk/cell-readme-generate.py b/scripts/python-skywater-pdk/skywater_pdk/cell-readme-generate.py new file mode 100755 index 000000000..b4d2c8b37 --- /dev/null +++ b/scripts/python-skywater-pdk/skywater_pdk/cell-readme-generate.py @@ -0,0 +1,130 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Copyright 2020 The SkyWater PDK Authors. +# +# Use of this source code is governed by the Apache 2.0 +# license that can be found in the LICENSE file or at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 + +''' This is a prototype of cell documentation generation script. + WORK IN PROGRESS +''' + + +import csv +import json +import os +import sys +import argparse +import pathlib +import glob +import subprocess +import textwrap + +def write_readme(cellpath, define_data): + ''' Generates README for a given cell. + ''' + netlist_json = os.path.join(cellpath, define_data['file_prefix']+'.json') + assert os.path.exists(netlist_json), netlist_json + outpath = os.path.join(cellpath, 'README.rst') + + header = define_data['name'] + ' cell description' + headline = '-' * len(header) + + prefix = define_data['file_prefix'] + + sym1 = prefix + '.symbol.svg' + sym2 = prefix + '.pp.symbol.svg' + sche = prefix + '.schematic.svg' + + + with open(outpath, 'w') as f: + f.write (f'{header}\n') + f.write (f'{headline}\n') + f.write ('\nThis is a stub of cell descrition file.\n\n') + + f.write (f" * Name: {define_data['name']}\n") + f.write (f" * Type: {define_data['type']}\n") + f.write (f" * Verilog name: {define_data['verilog_name']}\n") + desc = textwrap.indent(define_data['description'], ' ').lstrip(), + f.write (f" * Description: {desc}\n") + + f.write ('\nSome sample images:\n') + + f.write (f'\n.. image:: {sym1}\n :align: center\n :alt: Symbol\n') + f.write (f'\n.. image:: {sym2}\n :align: center\n :alt: SymbolPP\n') + f.write (f'\n.. image:: {sche}\n :align: center\n :alt: Schematic\n') + + +def process(cellpath): + ''' Processes cell indicated by path. + Opens cell definiton and calls further processing + + Args: + cellpath - path to a cell [str of pathlib.Path] + ''' + + print() + print(cellpath) + define_json = os.path.join(cellpath, 'definition.json') + if not os.path.exists(define_json): + print("No definition.json in", cellpath) + assert os.path.exists(define_json), define_json + define_data = json.load(open(define_json)) + + if define_data['type'] == 'cell': + write_readme(cellpath, define_data) + + return + + +def main(): + ''' Generates README.rst for cell.''' + + prereq_txt = '' + output_txt = 'output:\n generates README.rst' + allcellpath = '../../../libraries/*/latest/cells/*' + + parser = argparse.ArgumentParser( + description = main.__doc__, + epilog = prereq_txt +'\n\n'+ output_txt, + formatter_class=argparse.RawDescriptionHelpFormatter) + parser.add_argument( + "--all_libs", + help="process all cells in "+allcellpath, + action="store_true") + parser.add_argument( + "cell_dir", + help="path to the cell directory", + type=pathlib.Path, + nargs="*") + + args = parser.parse_args() + + if args.all_libs: + path = pathlib.Path(allcellpath).expanduser() + parts = path.parts[1:] if path.is_absolute() else path.parts + paths = pathlib.Path(path.root).glob(str(pathlib.Path("").joinpath(*parts))) + args.cell_dir = list(paths) + + cell_dirs = [d.resolve() for d in args.cell_dir if d.is_dir()] + + errors = 0 + for d in cell_dirs: + try: + process(d) + except KeyboardInterrupt: + sys.exit(1) + except (AssertionError, FileNotFoundError, ChildProcessError) as ex: + print (f'Error: {type(ex).__name__}') + print (f'{ex.args}') + errors +=1 + print (f'\n{len(cell_dirs)} files processed, {errors} errors.') + return 0 if errors else 1 + +if __name__ == "__main__": + sys.exit(main()) + diff --git a/scripts/python-skywater-pdk/skywater_pdk/netlistsvg-generate.py b/scripts/python-skywater-pdk/skywater_pdk/netlistsvg-generate.py new file mode 100755 index 000000000..370a8f120 --- /dev/null +++ b/scripts/python-skywater-pdk/skywater_pdk/netlistsvg-generate.py @@ -0,0 +1,134 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Copyright 2020 The SkyWater PDK Authors. +# +# Use of this source code is governed by the Apache 2.0 +# license that can be found in the LICENSE file or at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 + + +import csv +import json +import os +import sys +import argparse +import pathlib +import glob +import subprocess + +def outfile(cellpath, define_data, ftype='', extra='', exists=False): + ''' Determines output file path and name. + + Args: + cellpath - path to a cell [str of pathlib.Path] + define_data - cell definition data [dic] + ftype - file type suffix [str] + extra - extra suffix [str] + exist - optional check if file exists [bool or None] + + Returns: + outpath - output file namepath [str] + ''' + + fname = define_data['name'].lower().replace('$', '_') + if ftype: + ftype = '.'+ftype + outpath = os.path.join(cellpath, f'{define_data["file_prefix"]}{extra}{ftype}.svg') + if exists is None: + pass + elif not exists: + #assert not os.path.exists(outpath), "Refusing to overwrite existing file:"+outpath + print("Creating", outpath) + elif exists: + assert os.path.exists(outpath), "Missing required:"+outpath + return outpath + + +def write_netlistsvg(cellpath, define_data): + ''' Generates netlistsvg for a given cell. + + Args: + cellpath - path to a cell [str of pathlib.Path] + define_data - cell definition data [dic] + ''' + + netlist_json = os.path.join(cellpath, define_data['file_prefix']+'.json') + if not os.path.exists(netlist_json): + print("No netlist in", cellpath) + assert os.path.exists(netlist_json), netlist_json + outpath = outfile(cellpath, define_data, 'schematic') + if subprocess.call(['netlistsvg', netlist_json, '-o', outpath]): + raise ChildProcessError("netlistsvg execution failed") + +def process(cellpath): + ''' Processes cell indicated by path. + Opens cell definiton and calls further processing + + Args: + cellpath - path to a cell [str of pathlib.Path] + ''' + + print() + print(cellpath) + define_json = os.path.join(cellpath, 'definition.json') + if not os.path.exists(define_json): + print("No definition.json in", cellpath) + assert os.path.exists(define_json), define_json + define_data = json.load(open(define_json)) + + if define_data['type'] == 'cell': + write_netlistsvg(cellpath, define_data) + + return + + +def main(): + ''' Generates netlistsvg schematic from cell netlist.''' + + prereq_txt = 'prerequisities:\n netlistsvg' + output_txt = 'output:\n generates [cell_prefix].schematic.svg' + allcellpath = '../../../libraries/*/latest/cells/*' + + parser = argparse.ArgumentParser( + description = main.__doc__, + epilog = prereq_txt +'\n\n'+ output_txt, + formatter_class=argparse.RawDescriptionHelpFormatter) + parser.add_argument( + "--all_libs", + help="process all cells in "+allcellpath, + action="store_true") + parser.add_argument( + "cell_dir", + help="path to the cell directory", + type=pathlib.Path, + nargs="*") + + args = parser.parse_args() + + if args.all_libs: + path = pathlib.Path(allcellpath).expanduser() + parts = path.parts[1:] if path.is_absolute() else path.parts + paths = pathlib.Path(path.root).glob(str(pathlib.Path("").joinpath(*parts))) + args.cell_dir = list(paths) + + cell_dirs = [d.resolve() for d in args.cell_dir if d.is_dir()] + + errors = 0 + for d in cell_dirs: + try: + process(d) + except KeyboardInterrupt: + sys.exit(1) + except (AssertionError, FileNotFoundError, ChildProcessError) as ex: + print (f'Error: {type(ex).__name__}') + print (f'{ex.args}') + errors +=1 + print (f'\n{len(cell_dirs)} files processed, {errors} errors.') + return 0 if errors else 1 + +if __name__ == "__main__": + sys.exit(main()) + From 9fcefb09c77f9805d48cb399e79aa8b1bf8e970b Mon Sep 17 00:00:00 2001 From: Wojciech Gryncewicz Date: Thu, 19 Nov 2020 16:21:01 +0100 Subject: [PATCH 02/19] cell_list generator and lib README patcher --- .../skywater_pdk/cell_list.py | 242 ++++++++++++++++++ 1 file changed, 242 insertions(+) create mode 100755 scripts/python-skywater-pdk/skywater_pdk/cell_list.py diff --git a/scripts/python-skywater-pdk/skywater_pdk/cell_list.py b/scripts/python-skywater-pdk/skywater_pdk/cell_list.py new file mode 100755 index 000000000..2c32db800 --- /dev/null +++ b/scripts/python-skywater-pdk/skywater_pdk/cell_list.py @@ -0,0 +1,242 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Copyright 2020 SkyWater PDK Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +import argparse +import json +import os +import pathlib +import pprint +import sys +import textwrap +from docutils import nodes +from docutils.parsers.rst import Directive +from docutils.statemachine import ViewList +from sphinx.util.nodes import nested_parse_with_titles + +from typing import Tuple, List, Dict + +# using a list-table here to allow for easier line breaks in description +rst_header_line_char = '-' +rst_header = 'List of cells in :lib:`{libname}`' +rst_template ="""\ +{header_line} +{header_underline} + +.. list-table:: + :header-rows: 1 + + * - Cell name + - Description + - Type + - Verilog name +{cell_list} +""" + + +cell_template = """\ + * - {cell_name} + - {description} + - {type} + - {verilog_name} +""" + + +def collect(library_dir) -> Tuple[str, List[str]]: + """Collect the available definitions for cells in a library + + Parameters + ---------- + library_dir: str or pathlib.Path + Path to a library. + + Returns + ------- + lib : str + Library name + + cells : list of pathlib.Path + definition files for cells in the library. + """ + + if not isinstance(library_dir, pathlib.Path): + library_dir = pathlib.Path(library_dir) + + libname = None + cells = set() + + for p in library_dir.rglob("definition.json"): + if not p.is_file(): + continue + cells.add(p) + if libname is None: + with open(str(p), "r") as sample_json: + sample_def = json.load(sample_json) + libname = sample_def['library'] + + assert len(libname) > 0 + cells = list(sorted(cells)) + return libname, cells + + +def generate_rst(library_dir, library_name, cells): + """Generate the RST paragraph containing basic information about cells + + Parameters + ---------- + library_dir: str or pathlib.Path + Path to a library. + + library_name: str + Name of the library + + cells: list of pathlib.Path + List of paths to JSON description files + + Returns + ------- + paragraph: str + Generated paragraph + """ + + if not isinstance(library_dir, pathlib.Path): + library_dir = pathlib.Path(library_dir) + + paragraph = "" + cell_list = "" + + for cell in cells: + with open(str(cell), "r") as c: + cell_json = json.load(c) + cell_list = cell_list + cell_template.format( + cell_name = cell_json['name'], + #description = cell_json['description'].replace("\n", "\n "), + description = textwrap.indent(cell_json['description'], ' ').lstrip(), + type = cell_json['type'], + verilog_name = cell_json['verilog_name'] + ) + + header = rst_header.format(libname = library_name) + paragraph = rst_template.format( + header_line = header, + header_underline = rst_header_line_char * len(header), + cell_list = cell_list + ) + return paragraph + + +def AppendToReadme (celllistfile): + ''' Prototype od lebrary README builder ''' + readmefile = pathlib.Path(celllistfile.parents[0], 'README.rst') + old = '' + if readmefile.exists(): + with open(str(readmefile), "r") as f: + for i, l in enumerate(f): + if i<5: old += l + + with open(str(readmefile), "w+") as f: + f.write(old) + tableinc = f'.. include:: {celllistfile.name}\n' + if not tableinc in old: + f.write(tableinc) + + +# --- Sphinx extension wrapper --- + +class CellList(Directive): + + def run(self): + env = self.state.document.settings.env + dirname = env.docname.rpartition('/')[0] + libname, cells = collect(dirname) + paragraph = generate_rst(dirname, libname, cells) + # parse rst string to docutils nodes + rst = ViewList() + for i,line in enumerate(paragraph.split('\n')): + rst.append(line, libname+"-cell-list.rst", i+1) + node = nodes.section() + node.document = self.state.document + nested_parse_with_titles(self.state, rst, node) + return node.children + + +def setup(app): + app.add_directive("cell_list", CellList) + + return { + 'version': '0.1', + 'parallel_read_safe': True, + 'parallel_write_safe': True, + } + +# --- stand alone, command line operation --- + +def main(): + + alllibpath = '../../../libraries/*/latest' + parser = argparse.ArgumentParser() + parser.add_argument( + "--all_libs", + help="process all libs in "+alllibpath, + action="store_true") + parser.add_argument( + "library_dir", + help="Path to the library.", + type=pathlib.Path, + nargs='*') + + args = parser.parse_args() + + if args.all_libs: + path = pathlib.Path(alllibpath).expanduser() + parts = path.parts[1:] if path.is_absolute() else path.parts + paths = pathlib.Path(path.root).glob(str(pathlib.Path("").joinpath(*parts))) + args.library_dir = list(paths) + + + libs = [pathlib.Path(d) for d in args.library_dir] + libs = [d for d in libs if d.is_dir()] + + for l in libs: print (str(l)) + + for lib in libs: + + print(f'\nAnalysing {lib}') + try: + libname, cells = collect(lib) + print(f"Library name: {libname}, found {len(cells)} cells") + paragraph = generate_rst(lib, libname, cells) + library_dir = pathlib.Path(lib) + cell_list_file = pathlib.Path(library_dir, "cell-list.rst") + except: + print(f' ERROR: failed to fetch cell list') + continue + try: + with(open(str(cell_list_file), "w")) as c: + c.write(paragraph) + print(f'Generated {cell_list_file}') + AppendToReadme(cell_list_file) + print(f'Appended to README') + except FileNotFoundError: + print(f" ERROR: Failed to create {str(cell_list_file)}", file=sys.stderr) + raise + + +if __name__ == "__main__": + sys.exit(main()) + From c74b4d8ceb5b094b2f4601d3a9cea459cebfc105 Mon Sep 17 00:00:00 2001 From: Wojciech Gryncewicz Date: Thu, 19 Nov 2020 17:19:44 +0100 Subject: [PATCH 03/19] Cell_list now appends links to cell readmes --- .../skywater_pdk/cell_list.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/scripts/python-skywater-pdk/skywater_pdk/cell_list.py b/scripts/python-skywater-pdk/skywater_pdk/cell_list.py index 2c32db800..64ba871f2 100755 --- a/scripts/python-skywater-pdk/skywater_pdk/cell_list.py +++ b/scripts/python-skywater-pdk/skywater_pdk/cell_list.py @@ -148,10 +148,25 @@ def AppendToReadme (celllistfile): with open(str(readmefile), "r") as f: for i, l in enumerate(f): if i<5: old += l - + + # get cell readme list + lscmd = 'ls -1a ' + str(celllistfile.parents[0])+"/cells/*/README.rst 2>/dev/null" + cellrdm = os.popen(lscmd).read().strip().split('\n') + cellrdm = [c.replace(str(celllistfile.parents[0])+'/','') for c in cellrdm] + with open(str(readmefile), "w+") as f: f.write(old) tableinc = f'.. include:: {celllistfile.name}\n' + + if len(cellrdm): + f.write('\n\n\n') + f.write('Cell descriptions\n') + f.write('-----------------\n\n') + f.write('.. toctree::\n\n') + for c in cellrdm: + f.write(f' {c}\n') + f.write('\n\n\n') + if not tableinc in old: f.write(tableinc) From 5eb305b0b8d198536b1db908408168438b382efb Mon Sep 17 00:00:00 2001 From: Karol Gugala Date: Fri, 20 Nov 2020 10:21:56 +0100 Subject: [PATCH 04/19] Docs: generate cells documentation in CI Signed-off-by: Karol Gugala --- .github/workflows/generate-rst.yml | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/generate-rst.yml diff --git a/.github/workflows/generate-rst.yml b/.github/workflows/generate-rst.yml new file mode 100644 index 000000000..4fdb36641 --- /dev/null +++ b/.github/workflows/generate-rst.yml @@ -0,0 +1,36 @@ +name: Generate cells docs + +on: + push: + pull_request: + +jobs: + + generate-cells: + runs-on: ubuntu-18.04 + steps: + + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Generate cells READMEs + run: | + sudo apt update + sudo apt install -y python3 python3-pip git tar gzip + pip3 install docutils sphinx + + SUBMODULE_VERSION=latest make submodules -j3 || make submodules -j1 + scripts/python-skywater-pdk/skywater_pdk/cell_list.py libraries/*/latest/ + scripts/python-skywater-pdk/skywater_pdk/cell-readme-generate.py libraries/*/latest/cells/* + + find ./libraries -name cell-list.rst | tar -acf libs.tar -T - + find ./libraries -name README.rst | tar -rf libs.tar -T - + find ./libraries -wholename */cells/*.svg | tar -rf libs.tar -T - + gzip libs.tar + + - uses: actions/upload-artifact@v2 + with: + name: cells-docs + path: libs.tar.gz + From 9db28207c485d4f24a3b6a6c85a35d31f842f085 Mon Sep 17 00:00:00 2001 From: Wojciech Gryncewicz Date: Wed, 25 Nov 2020 13:44:00 +0100 Subject: [PATCH 05/19] netlistsvg-generate removed - belongs to another branch --- .../skywater_pdk/netlistsvg-generate.py | 134 ------------------ 1 file changed, 134 deletions(-) delete mode 100755 scripts/python-skywater-pdk/skywater_pdk/netlistsvg-generate.py diff --git a/scripts/python-skywater-pdk/skywater_pdk/netlistsvg-generate.py b/scripts/python-skywater-pdk/skywater_pdk/netlistsvg-generate.py deleted file mode 100755 index 370a8f120..000000000 --- a/scripts/python-skywater-pdk/skywater_pdk/netlistsvg-generate.py +++ /dev/null @@ -1,134 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# Copyright 2020 The SkyWater PDK Authors. -# -# Use of this source code is governed by the Apache 2.0 -# license that can be found in the LICENSE file or at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 - - -import csv -import json -import os -import sys -import argparse -import pathlib -import glob -import subprocess - -def outfile(cellpath, define_data, ftype='', extra='', exists=False): - ''' Determines output file path and name. - - Args: - cellpath - path to a cell [str of pathlib.Path] - define_data - cell definition data [dic] - ftype - file type suffix [str] - extra - extra suffix [str] - exist - optional check if file exists [bool or None] - - Returns: - outpath - output file namepath [str] - ''' - - fname = define_data['name'].lower().replace('$', '_') - if ftype: - ftype = '.'+ftype - outpath = os.path.join(cellpath, f'{define_data["file_prefix"]}{extra}{ftype}.svg') - if exists is None: - pass - elif not exists: - #assert not os.path.exists(outpath), "Refusing to overwrite existing file:"+outpath - print("Creating", outpath) - elif exists: - assert os.path.exists(outpath), "Missing required:"+outpath - return outpath - - -def write_netlistsvg(cellpath, define_data): - ''' Generates netlistsvg for a given cell. - - Args: - cellpath - path to a cell [str of pathlib.Path] - define_data - cell definition data [dic] - ''' - - netlist_json = os.path.join(cellpath, define_data['file_prefix']+'.json') - if not os.path.exists(netlist_json): - print("No netlist in", cellpath) - assert os.path.exists(netlist_json), netlist_json - outpath = outfile(cellpath, define_data, 'schematic') - if subprocess.call(['netlistsvg', netlist_json, '-o', outpath]): - raise ChildProcessError("netlistsvg execution failed") - -def process(cellpath): - ''' Processes cell indicated by path. - Opens cell definiton and calls further processing - - Args: - cellpath - path to a cell [str of pathlib.Path] - ''' - - print() - print(cellpath) - define_json = os.path.join(cellpath, 'definition.json') - if not os.path.exists(define_json): - print("No definition.json in", cellpath) - assert os.path.exists(define_json), define_json - define_data = json.load(open(define_json)) - - if define_data['type'] == 'cell': - write_netlistsvg(cellpath, define_data) - - return - - -def main(): - ''' Generates netlistsvg schematic from cell netlist.''' - - prereq_txt = 'prerequisities:\n netlistsvg' - output_txt = 'output:\n generates [cell_prefix].schematic.svg' - allcellpath = '../../../libraries/*/latest/cells/*' - - parser = argparse.ArgumentParser( - description = main.__doc__, - epilog = prereq_txt +'\n\n'+ output_txt, - formatter_class=argparse.RawDescriptionHelpFormatter) - parser.add_argument( - "--all_libs", - help="process all cells in "+allcellpath, - action="store_true") - parser.add_argument( - "cell_dir", - help="path to the cell directory", - type=pathlib.Path, - nargs="*") - - args = parser.parse_args() - - if args.all_libs: - path = pathlib.Path(allcellpath).expanduser() - parts = path.parts[1:] if path.is_absolute() else path.parts - paths = pathlib.Path(path.root).glob(str(pathlib.Path("").joinpath(*parts))) - args.cell_dir = list(paths) - - cell_dirs = [d.resolve() for d in args.cell_dir if d.is_dir()] - - errors = 0 - for d in cell_dirs: - try: - process(d) - except KeyboardInterrupt: - sys.exit(1) - except (AssertionError, FileNotFoundError, ChildProcessError) as ex: - print (f'Error: {type(ex).__name__}') - print (f'{ex.args}') - errors +=1 - print (f'\n{len(cell_dirs)} files processed, {errors} errors.') - return 0 if errors else 1 - -if __name__ == "__main__": - sys.exit(main()) - From b3669825e422e38500a153dad60a3d60cf8edbea Mon Sep 17 00:00:00 2001 From: Wojciech Gryncewicz Date: Wed, 25 Nov 2020 13:47:04 +0100 Subject: [PATCH 06/19] Cell readme generator updated, includes GDS2 layouts --- ...me-generate.py => cell_readme_generate.py} | 115 ++++++++++++++---- 1 file changed, 89 insertions(+), 26 deletions(-) rename scripts/python-skywater-pdk/skywater_pdk/{cell-readme-generate.py => cell_readme_generate.py} (58%) diff --git a/scripts/python-skywater-pdk/skywater_pdk/cell-readme-generate.py b/scripts/python-skywater-pdk/skywater_pdk/cell_readme_generate.py similarity index 58% rename from scripts/python-skywater-pdk/skywater_pdk/cell-readme-generate.py rename to scripts/python-skywater-pdk/skywater_pdk/cell_readme_generate.py index b4d2c8b37..82a30c38e 100755 --- a/scripts/python-skywater-pdk/skywater_pdk/cell-readme-generate.py +++ b/scripts/python-skywater-pdk/skywater_pdk/cell_readme_generate.py @@ -10,10 +10,8 @@ # SPDX-License-Identifier: Apache-2.0 ''' This is a prototype of cell documentation generation script. - WORK IN PROGRESS ''' - import csv import json import os @@ -24,40 +22,105 @@ import subprocess import textwrap + +readme_template ="""\ +{header} +{headerUL} + +**{description}** + +*This is a stub of cell description file* + +- **Cell name**: {name} +- **Type**: {deftype} +- **Verilog name**: {verilog_name} +- **Library**: {library} +- **Inputs**: {inputs} +- **Outputs**: {outputs} + +Symbols +------- + +.. list-table:: + + * - .. figure:: {symbol1} + - + - .. figure:: {symbol2} + +Schematic +--------- + +.. figure:: {schematic} + :align: center + +GDSII Layouts +------------- + +""" + +figure_template =""" + +.. figure:: {fig} + :align: center + :width: 50% + + {name} +""" + def write_readme(cellpath, define_data): ''' Generates README for a given cell. + + Args: + cellpath - path to a cell [str of pathlib.Path] + define_data - cell data from json [dic] + ''' netlist_json = os.path.join(cellpath, define_data['file_prefix']+'.json') assert os.path.exists(netlist_json), netlist_json outpath = os.path.join(cellpath, 'README.rst') - header = define_data['name'] + ' cell description' - headline = '-' * len(header) - prefix = define_data['file_prefix'] - - sym1 = prefix + '.symbol.svg' - sym2 = prefix + '.pp.symbol.svg' - sche = prefix + '.schematic.svg' + header = prefix + symbol1 = prefix + '.symbol.svg' + symbol2 = prefix + '.pp.symbol.svg' + schematic = prefix + '.schematic.svg' + inputs = [] + outputs = [] + for p in define_data['ports']: + try: + if p[0]=='signal' and p[2]=='input': + inputs.append(p[1]) + if p[0]=='signal' and p[2]=='output': + outputs.append(p[1]) + except: + pass + gdssvg = [] + svglist = list(pathlib.Path(cellpath).glob('*.svg')) + for s in svglist: + gdsfile = pathlib.Path(os.path.join(cellpath, s.stem +'.gds')) + if gdsfile.is_file(): + gdssvg.append(s) - with open(outpath, 'w') as f: - f.write (f'{header}\n') - f.write (f'{headline}\n') - f.write ('\nThis is a stub of cell descrition file.\n\n') - - f.write (f" * Name: {define_data['name']}\n") - f.write (f" * Type: {define_data['type']}\n") - f.write (f" * Verilog name: {define_data['verilog_name']}\n") - desc = textwrap.indent(define_data['description'], ' ').lstrip(), - f.write (f" * Description: {desc}\n") - - f.write ('\nSome sample images:\n') - - f.write (f'\n.. image:: {sym1}\n :align: center\n :alt: Symbol\n') - f.write (f'\n.. image:: {sym2}\n :align: center\n :alt: SymbolPP\n') - f.write (f'\n.. image:: {sche}\n :align: center\n :alt: Schematic\n') - + f.write (readme_template.format ( + header = header, + headerUL = '=' * len(header), + description = define_data['description'].rstrip('.'), + name = ':cell:`' + prefix +'`', + deftype = define_data['type'], + verilog_name = define_data['verilog_name'], + library = define_data['library'], + inputs = f'{len(inputs)} (' + ', '.join(inputs) + ')', + outputs = f'{len(outputs)} (' + ', '.join(outputs) + ')', + symbol1 = symbol1, + symbol2 = symbol2, + schematic = schematic, + )) + for gs in sorted(gdssvg): + f.write (figure_template.format ( + fig = gs.name, + name = gs.stem + )) def process(cellpath): ''' Processes cell indicated by path. From 10c5e8f2715f6bc3918785e4b9e663c2074bc7e1 Mon Sep 17 00:00:00 2001 From: Wojciech Gryncewicz Date: Wed, 25 Nov 2020 13:49:04 +0100 Subject: [PATCH 07/19] Cell list generator includes cell links in table --- .../skywater_pdk/cell_list.py | 22 +++++-------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/scripts/python-skywater-pdk/skywater_pdk/cell_list.py b/scripts/python-skywater-pdk/skywater_pdk/cell_list.py index 64ba871f2..3f051b8db 100755 --- a/scripts/python-skywater-pdk/skywater_pdk/cell_list.py +++ b/scripts/python-skywater-pdk/skywater_pdk/cell_list.py @@ -50,7 +50,7 @@ cell_template = """\ - * - {cell_name} + * - :doc:`{cell_name} <{link}>` - {description} - {type} - {verilog_name} @@ -128,7 +128,9 @@ def generate_rst(library_dir, library_name, cells): #description = cell_json['description'].replace("\n", "\n "), description = textwrap.indent(cell_json['description'], ' ').lstrip(), type = cell_json['type'], - verilog_name = cell_json['verilog_name'] + verilog_name = cell_json['verilog_name'], + #link = str(cell.resolve()).rpartition('/')[0] + '/README' + link = 'cells/' + str(cell).rpartition('/')[0].rpartition('/')[2] + '/README' ) header = rst_header.format(libname = library_name) @@ -141,7 +143,7 @@ def generate_rst(library_dir, library_name, cells): def AppendToReadme (celllistfile): - ''' Prototype od lebrary README builder ''' + ''' Prototype of library README builder ''' readmefile = pathlib.Path(celllistfile.parents[0], 'README.rst') old = '' if readmefile.exists(): @@ -149,24 +151,10 @@ def AppendToReadme (celllistfile): for i, l in enumerate(f): if i<5: old += l - # get cell readme list - lscmd = 'ls -1a ' + str(celllistfile.parents[0])+"/cells/*/README.rst 2>/dev/null" - cellrdm = os.popen(lscmd).read().strip().split('\n') - cellrdm = [c.replace(str(celllistfile.parents[0])+'/','') for c in cellrdm] - with open(str(readmefile), "w+") as f: f.write(old) tableinc = f'.. include:: {celllistfile.name}\n' - if len(cellrdm): - f.write('\n\n\n') - f.write('Cell descriptions\n') - f.write('-----------------\n\n') - f.write('.. toctree::\n\n') - for c in cellrdm: - f.write(f' {c}\n') - f.write('\n\n\n') - if not tableinc in old: f.write(tableinc) From 1f3fcbb8702e8e0c769dbaeb443cbb9c11d83013 Mon Sep 17 00:00:00 2001 From: Wojciech Gryncewicz Date: Wed, 25 Nov 2020 21:43:31 +0100 Subject: [PATCH 08/19] Removed redundant cell_list Sphinx extension script --- docs/_ext/cell_list.py | 200 ----------------------------------------- 1 file changed, 200 deletions(-) delete mode 100644 docs/_ext/cell_list.py diff --git a/docs/_ext/cell_list.py b/docs/_ext/cell_list.py deleted file mode 100644 index e3e16acdb..000000000 --- a/docs/_ext/cell_list.py +++ /dev/null @@ -1,200 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# Copyright 2020 SkyWater PDK Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 - -import argparse -import json -import os -import pathlib -import pprint -import sys -import textwrap -from docutils import nodes -from docutils.parsers.rst import Directive -from docutils.statemachine import ViewList -from sphinx.util.nodes import nested_parse_with_titles - -from typing import Tuple, List, Dict - -# using a list-table here to allow for easier line breaks in description -rst_header_line_char = '-' -rst_header = 'List of cells in :lib:`{libname}`' -rst_template ="""\ -{header_line} -{header_underline} - -.. list-table:: - :header-rows: 1 - - * - Cell name - - Description - - Type - - Verilog name -{cell_list} -""" - - -cell_template = """\ - * - {cell_name} - - {description} - - {type} - - {verilog_name} -""" - - -def collect(library_dir) -> Tuple[str, List[str]]: - """Collect the available definitions for cells in a library - - Parameters - ---------- - library_dir: str or pathlib.Path - Path to a library. - - Returns - ------- - lib : str - Library name - - cells : list of pathlib.Path - definition files for cells in the library. - """ - - if not isinstance(library_dir, pathlib.Path): - library_dir = pathlib.Path(library_dir) - - libname = None - cells = set() - - for p in library_dir.rglob("definition.json"): - if not p.is_file(): - continue - cells.add(p) - if libname is None: - with open(str(p), "r") as sample_json: - sample_def = json.load(sample_json) - libname = sample_def['library'] - - assert len(libname) > 0 - cells = list(sorted(cells)) - return libname, cells - - -def generate_rst(library_dir, library_name, cells): - """Generate the RST paragraph containing basic information about cells - - Parameters - ---------- - library_dir: str or pathlib.Path - Path to a library. - - library_name: str - Name of the library - - cells: list of pathlib.Path - List of paths to JSON description files - - Returns - ------- - paragraph: str - Generated paragraph - """ - - if not isinstance(library_dir, pathlib.Path): - library_dir = pathlib.Path(library_dir) - - paragraph = "" - cell_list = "" - - for cell in cells: - with open(str(cell), "r") as c: - cell_json = json.load(c) - cell_list = cell_list + cell_template.format( - cell_name = cell_json['name'], - #description = cell_json['description'].replace("\n", "\n "), - description = textwrap.indent(cell_json['description'], ' ').lstrip(), - type = cell_json['type'], - verilog_name = cell_json['verilog_name'] - ) - - header = rst_header.format(libname = library_name) - paragraph = rst_template.format( - header_line = header, - header_underline = rst_header_line_char * len(header), - cell_list = cell_list - ) - return paragraph - -# --- Sphinx extension wrapper --- - -class CellList(Directive): - - def run(self): - env = self.state.document.settings.env - dirname = env.docname.rpartition('/')[0] - libname, cells = collect(dirname) - paragraph = generate_rst(dirname, libname, cells) - # parse rst string to docutils nodes - rst = ViewList() - for i,line in enumerate(paragraph.split('\n')): - rst.append(line, libname+"-cell-list.rst", i+1) - node = nodes.section() - node.document = self.state.document - nested_parse_with_titles(self.state, rst, node) - return node.children - - -def setup(app): - app.add_directive("cell_list", CellList) - - return { - 'version': '0.1', - 'parallel_read_safe': True, - 'parallel_write_safe': True, - } - -# --- stand alone, command line operation --- - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument( - "library_dir", - help="Path to the library.", - type=pathlib.Path, - nargs=1) - - args = parser.parse_args() - lib = args.library_dir[0] - - print(f"Analysing {lib}") - libname, cells = collect(lib) - print(f"Library name: {libname}, found {len(cells)} cells") - paragraph = generate_rst(lib, libname, cells) - library_dir = pathlib.Path(lib) - cell_list_file = pathlib.Path(library_dir, "cell-list.rst") - try: - with(open(str(cell_list_file), "w")) as c: - c.write(paragraph) - print(f'Generated {cell_list_file}') - except FileNotFoundError: - print(f"ERROR: Failed to create {str(cell_list_file)}", file=sys.stderr) - raise - - -if __name__ == "__main__": - sys.exit(main()) - From ed83490a5898e7178582c45ed4575a48290375a9 Mon Sep 17 00:00:00 2001 From: Wojciech Gryncewicz Date: Wed, 25 Nov 2020 21:57:57 +0100 Subject: [PATCH 09/19] Rename cell readme generator script --- .../{cell_readme_generate.py => cells/generate/readme.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/python-skywater-pdk/skywater_pdk/{cell_readme_generate.py => cells/generate/readme.py} (100%) diff --git a/scripts/python-skywater-pdk/skywater_pdk/cell_readme_generate.py b/scripts/python-skywater-pdk/skywater_pdk/cells/generate/readme.py similarity index 100% rename from scripts/python-skywater-pdk/skywater_pdk/cell_readme_generate.py rename to scripts/python-skywater-pdk/skywater_pdk/cells/generate/readme.py From 3f498d92f0aa627795a5645a52800968532b4140 Mon Sep 17 00:00:00 2001 From: Wojciech Gryncewicz Date: Wed, 25 Nov 2020 21:58:31 +0100 Subject: [PATCH 10/19] Rename cell list generator script --- .../skywater_pdk/{cell_list.py => cells/list.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/python-skywater-pdk/skywater_pdk/{cell_list.py => cells/list.py} (100%) diff --git a/scripts/python-skywater-pdk/skywater_pdk/cell_list.py b/scripts/python-skywater-pdk/skywater_pdk/cells/list.py similarity index 100% rename from scripts/python-skywater-pdk/skywater_pdk/cell_list.py rename to scripts/python-skywater-pdk/skywater_pdk/cells/list.py From 98da26cf4a57c657e806601332de32c9daeb5d9c Mon Sep 17 00:00:00 2001 From: Grzegorz Latosinski Date: Mon, 23 Nov 2020 10:42:20 +0100 Subject: [PATCH 11/19] Added committing changes made to submodules Signed-off-by: Grzegorz Latosinski --- .github/workflows/generate-rst.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/generate-rst.yml b/.github/workflows/generate-rst.yml index 4fdb36641..073e04ae9 100644 --- a/.github/workflows/generate-rst.yml +++ b/.github/workflows/generate-rst.yml @@ -21,13 +21,16 @@ jobs: pip3 install docutils sphinx SUBMODULE_VERSION=latest make submodules -j3 || make submodules -j1 + git submodule foreach 'git checkout master' scripts/python-skywater-pdk/skywater_pdk/cell_list.py libraries/*/latest/ scripts/python-skywater-pdk/skywater_pdk/cell-readme-generate.py libraries/*/latest/cells/* + git submodule foreach 'git add .' + export DAT=`date +"%Y-%m-%d %k:%M"` - find ./libraries -name cell-list.rst | tar -acf libs.tar -T - - find ./libraries -name README.rst | tar -rf libs.tar -T - - find ./libraries -wholename */cells/*.svg | tar -rf libs.tar -T - - gzip libs.tar + # TODO replace below with appropriate credentials + git config --global user.email "action@github.com" + git config --global user.name "Github Action" + git submodule foreach 'git commit -m "$DAT"' - uses: actions/upload-artifact@v2 with: From 550cab4c31ca1fde0b89f12251097aff76063d75 Mon Sep 17 00:00:00 2001 From: Grzegorz Latosinski Date: Wed, 25 Nov 2020 19:36:53 +0100 Subject: [PATCH 12/19] github-actions: cleaned up generate-rst, added using conda Signed-off-by: Grzegorz Latosinski --- .github/workflows/generate-rst.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/generate-rst.yml b/.github/workflows/generate-rst.yml index 073e04ae9..2b9b0446a 100644 --- a/.github/workflows/generate-rst.yml +++ b/.github/workflows/generate-rst.yml @@ -16,11 +16,10 @@ jobs: - name: Generate cells READMEs run: | - sudo apt update - sudo apt install -y python3 python3-pip git tar gzip - pip3 install docutils sphinx - SUBMODULE_VERSION=latest make submodules -j3 || make submodules -j1 + + make env + git submodule foreach 'git checkout master' scripts/python-skywater-pdk/skywater_pdk/cell_list.py libraries/*/latest/ scripts/python-skywater-pdk/skywater_pdk/cell-readme-generate.py libraries/*/latest/cells/* @@ -31,9 +30,3 @@ jobs: git config --global user.email "action@github.com" git config --global user.name "Github Action" git submodule foreach 'git commit -m "$DAT"' - - - uses: actions/upload-artifact@v2 - with: - name: cells-docs - path: libs.tar.gz - From 058f1d013230a8412ba6f5a1cb7eea706a8dbea9 Mon Sep 17 00:00:00 2001 From: Grzegorz Latosinski Date: Wed, 25 Nov 2020 19:51:22 +0100 Subject: [PATCH 13/19] github-actions: added docutils to requirements.txt Signed-off-by: Grzegorz Latosinski --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index fe8a2c1b2..f4362944b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,7 @@ flake8 # rst_include tool as GitHub doesn't support `.. include::` when rendering # previews. rst_include +docutils # The Python API for the SkyWater PDK. -e scripts/python-skywater-pdk From 3ecbc35c29f2da3b84a08065161df23762b67df1 Mon Sep 17 00:00:00 2001 From: Grzegorz Latosinski Date: Wed, 25 Nov 2020 20:09:48 +0100 Subject: [PATCH 14/19] github-actions: added activating conda environment Signed-off-by: Grzegorz Latosinski --- .github/workflows/generate-rst.yml | 2 ++ requirements.txt | 3 +++ 2 files changed, 5 insertions(+) diff --git a/.github/workflows/generate-rst.yml b/.github/workflows/generate-rst.yml index 2b9b0446a..964b9ac6a 100644 --- a/.github/workflows/generate-rst.yml +++ b/.github/workflows/generate-rst.yml @@ -20,6 +20,8 @@ jobs: make env + source env/conda/bin/activate skywater-pdk-scripts + git submodule foreach 'git checkout master' scripts/python-skywater-pdk/skywater_pdk/cell_list.py libraries/*/latest/ scripts/python-skywater-pdk/skywater_pdk/cell-readme-generate.py libraries/*/latest/cells/* diff --git a/requirements.txt b/requirements.txt index f4362944b..b67d1dd8b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,9 @@ flake8 # previews. rst_include docutils +dataclasses +dataclasses_json +sphinx # The Python API for the SkyWater PDK. -e scripts/python-skywater-pdk From 43ea36105ff6be0e54be76e2dbcba205cde68da4 Mon Sep 17 00:00:00 2001 From: Grzegorz Latosinski Date: Wed, 25 Nov 2020 20:26:31 +0100 Subject: [PATCH 15/19] github-actions: fixed name for cell_readme_generate Signed-off-by: Grzegorz Latosinski --- .github/workflows/generate-rst.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate-rst.yml b/.github/workflows/generate-rst.yml index 964b9ac6a..e6aa925ec 100644 --- a/.github/workflows/generate-rst.yml +++ b/.github/workflows/generate-rst.yml @@ -24,7 +24,7 @@ jobs: git submodule foreach 'git checkout master' scripts/python-skywater-pdk/skywater_pdk/cell_list.py libraries/*/latest/ - scripts/python-skywater-pdk/skywater_pdk/cell-readme-generate.py libraries/*/latest/cells/* + scripts/python-skywater-pdk/skywater_pdk/cell_readme_generate.py libraries/*/latest/cells/* git submodule foreach 'git add .' export DAT=`date +"%Y-%m-%d %k:%M"` From c594c4973cb795bea5fc69a1022dc56b91bb578f Mon Sep 17 00:00:00 2001 From: Grzegorz Latosinski Date: Wed, 25 Nov 2020 20:38:22 +0100 Subject: [PATCH 16/19] github-actions: added ignoring failing commits in submodules Signed-off-by: Grzegorz Latosinski --- .github/workflows/generate-rst.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate-rst.yml b/.github/workflows/generate-rst.yml index e6aa925ec..183a81252 100644 --- a/.github/workflows/generate-rst.yml +++ b/.github/workflows/generate-rst.yml @@ -31,4 +31,4 @@ jobs: # TODO replace below with appropriate credentials git config --global user.email "action@github.com" git config --global user.name "Github Action" - git submodule foreach 'git commit -m "$DAT"' + git submodule foreach 'git commit -m "$DAT" || true' From 6a5016952a82e8f2db8dc3918d47ebb48c1073dd Mon Sep 17 00:00:00 2001 From: Grzegorz Latosinski Date: Wed, 25 Nov 2020 22:50:54 +0100 Subject: [PATCH 17/19] github-actions: updated script names in generate-rst Signed-off-by: Grzegorz Latosinski --- .github/workflows/generate-rst.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generate-rst.yml b/.github/workflows/generate-rst.yml index 183a81252..6cf381a6d 100644 --- a/.github/workflows/generate-rst.yml +++ b/.github/workflows/generate-rst.yml @@ -23,8 +23,8 @@ jobs: source env/conda/bin/activate skywater-pdk-scripts git submodule foreach 'git checkout master' - scripts/python-skywater-pdk/skywater_pdk/cell_list.py libraries/*/latest/ - scripts/python-skywater-pdk/skywater_pdk/cell_readme_generate.py libraries/*/latest/cells/* + scripts/python-skywater-pdk/skywater_pdk/cells/list.py libraries/*/latest/ + scripts/python-skywater-pdk/skywater_pdk/cells/generate/readme.py libraries/*/latest/cells/* git submodule foreach 'git add .' export DAT=`date +"%Y-%m-%d %k:%M"` From 4dbb833f40946f6d4657d8f33fbb686b9ec6f936 Mon Sep 17 00:00:00 2001 From: Grzegorz Latosinski Date: Thu, 26 Nov 2020 09:37:57 +0100 Subject: [PATCH 18/19] github-actions: cleaned up generate-rst Signed-off-by: Grzegorz Latosinski --- .github/workflows/generate-rst.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/generate-rst.yml b/.github/workflows/generate-rst.yml index 6cf381a6d..6e64539aa 100644 --- a/.github/workflows/generate-rst.yml +++ b/.github/workflows/generate-rst.yml @@ -18,13 +18,14 @@ jobs: run: | SUBMODULE_VERSION=latest make submodules -j3 || make submodules -j1 - make env + git submodule foreach 'git checkout master' + make env source env/conda/bin/activate skywater-pdk-scripts + which python + python scripts/python-skywater-pdk/skywater_pdk/cells/list.py libraries/*/latest/ + python scripts/python-skywater-pdk/skywater_pdk/cells/generate/readme.py libraries/*/latest/cells/* - git submodule foreach 'git checkout master' - scripts/python-skywater-pdk/skywater_pdk/cells/list.py libraries/*/latest/ - scripts/python-skywater-pdk/skywater_pdk/cells/generate/readme.py libraries/*/latest/cells/* git submodule foreach 'git add .' export DAT=`date +"%Y-%m-%d %k:%M"` From cc862390c7892c93eca48a060c9a2b17e104dee8 Mon Sep 17 00:00:00 2001 From: Grzegorz Latosinski Date: Thu, 26 Nov 2020 12:31:55 +0100 Subject: [PATCH 19/19] github-actions: silenced git commands Signed-off-by: Grzegorz Latosinski --- .github/workflows/generate-rst.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generate-rst.yml b/.github/workflows/generate-rst.yml index 6e64539aa..0b3fe10fe 100644 --- a/.github/workflows/generate-rst.yml +++ b/.github/workflows/generate-rst.yml @@ -18,7 +18,7 @@ jobs: run: | SUBMODULE_VERSION=latest make submodules -j3 || make submodules -j1 - git submodule foreach 'git checkout master' + git submodule foreach 'git checkout master -q' make env source env/conda/bin/activate skywater-pdk-scripts @@ -32,4 +32,4 @@ jobs: # TODO replace below with appropriate credentials git config --global user.email "action@github.com" git config --global user.name "Github Action" - git submodule foreach 'git commit -m "$DAT" || true' + git submodule foreach 'git commit -q -m "$DAT" || true'