11name : wokwi 
22#  either manually started, or on a schedule
33on : [ push, workflow_dispatch ] 
4+ permissions :
5+   contents : write 
6+   pages : write 
7+   id-token : write 
48jobs :
5-   wokwi :
9+   gds :
610    env :
711        OPENLANE_TAG :   2022.02.23_02.50.41 
812        OPENLANE_IMAGE_NAME :    efabless/openlane:$(OPENLANE_TAG) 
1721    - name : checkout repo 
1822      uses : actions/checkout@v2 
1923
20-     #  caching version seems broken atm
21-     - name : setup python 
22-       uses : actions/setup-python@v2 
23-       with :
24-         python-version : ' 3.7.7'   #  install the python version needed
25- 
26-     #  python deps from reqirements file, use a marketplace action
27-     - name : Install Python dependencies 
28-       uses : py-actions/py-dependency-install@v2 
29-       with :
30-         path : " requirements.txt" 
31- 
32-     - uses : actions/checkout@v2 
33-       with :
34-           repository : s-holst/GDS2WebGL 
35-           path : GDS2WebGL 
36- 
3724    #  build PDK and fetch OpenLane
3825    - name : pdk & caravel 
3926      run : | 
@@ -54,18 +41,121 @@ jobs:
5441    - name : show files 
5542      run : find runs/wokwi/results 
5643
57-     #  make the SVG
44+     - name : setup python 
45+       uses : actions/setup-python@v4 
46+       with :
47+         python-version : ' 3.10' 
48+ 
49+     - name : add summary 
50+       run : | 
51+         python << EOF >> $GITHUB_STEP_SUMMARY 
52+         import csv 
53+         with open('runs/wokwi/reports/final_summary_report.csv') as f: 
54+             report = list(csv.DictReader(f))[0] 
55+             keys = ['OpenDP_Util', 'cell_count', 'wire_length', 'AND', 'DFF', 'NAND', 'NOR', 'OR', 'XOR', 'XNOR', 'MUX'] 
56+             print(f'| { "|".join(keys) } |') 
57+             print(f'| { "|".join(["-----"] * len(keys)) } |') 
58+             print(f'| { "|".join(report[k] for k in keys) } |') 
59+         EOF 
60+    
61+     - name : populate src cache 
62+       uses : actions/cache@v2 
63+       with :
64+         path : src 
65+         key : ${{ runner.os }}-src-${{ github.run_id }} 
66+ 
67+     - name : populate runs cache 
68+       uses : actions/cache@v2 
69+       with :
70+         path : runs 
71+         key : ${{ runner.os }}-runs-${{ github.run_id }} 
72+ 
73+   svg :
74+     needs : gds 
75+     runs-on : ubuntu-latest 
76+     steps :
77+     - name : checkout repo 
78+       uses : actions/checkout@v2 
79+ 
80+     - name : setup python 
81+       uses : actions/setup-python@v4 
82+       with :
83+         python-version : ' 3.10' 
84+ 
85+     - name : restore runs cache 
86+       uses : actions/cache@v2 
87+       with :
88+         path : runs 
89+         key : ${{ runner.os }}-runs-${{ github.run_id }} 
90+ 
5891    - name : create svg 
59-       run : python view.py 
92+       run : | 
93+         python -m pip install gdstk 
94+         python << EOF 
95+         import gdstk 
96+         import pathlib 
97+ 
98+         gds = sorted(pathlib.Path('runs').glob('wokwi/results/final/gds/*.gds')) 
99+         library = gdstk.read_gds(gds[-1]) 
100+         top_cells = library.top_level() 
101+         top_cells[0].write_svg('gds_render.svg') 
102+         EOF 
103+ 
104+      - name : populate svg cache 
105+       uses : actions/cache@v2 
106+       with :
107+         path : ' gds_render.svg' 
108+         key : ${{ runner.os }}-svg-${{ github.run_id }} 
109+ 
110+   webgl :
111+     needs : gds 
112+     runs-on : ubuntu-latest 
113+     steps :
114+     - name : checkout repo 
115+       uses : actions/checkout@v2 
116+       with :
117+         repository : s-holst/GDS2WebGL 
118+ 
119+     - name : setup python 
120+       uses : actions/setup-python@v4 
121+       with :
122+         python-version : ' 3.10' 
123+ 
124+     - name : restore runs cache 
125+       uses : actions/cache@v2 
126+       with :
127+         path : runs 
128+         key : ${{ runner.os }}-runs-${{ github.run_id }} 
60129
61-     #  make html gds viewer with GDS2WebGL
62130    - name : GDS2WebGL 
63131      run : | 
64-         cd GDS2WebGL 
65-         python3 gds2webgl.py -i ../runs/wokwi/results/final/gds/*gds -o ../gds.html 
132+         python -m pip install gdspy pyclipper mapbox_earcut 
133+         python3 gds2webgl.py -i runs/wokwi/results/final/gds/*.gds -o index.html 
134+ 
135+      - name : populate webgl cache 
136+       uses : actions/cache@v2 
137+       with :
138+         path : index.html 
139+         key : ${{ runner.os }}-webgl-${{ github.run_id }} 
140+ 
141+   artifact :
142+     needs :
143+     - gds 
144+     runs-on : ubuntu-latest 
145+     steps :
146+     - name : restore src cache 
147+       uses : actions/cache@v2 
148+       with :
149+         path : src 
150+         key : ${{ runner.os }}-src-${{ github.run_id }} 
66151
67-      #  archive the gds and some other important files
68-     - name : Archive files 
152+     - name : restore runs cache 
153+       uses : actions/cache@v2 
154+       with :
155+         path : runs 
156+         key : ${{ runner.os }}-runs-${{ github.run_id }} 
157+ 
158+     - name : upload artifact 
69159      uses : actions/upload-artifact@v2 
70160      with :
71161          #  path depends on the tag and the module name
@@ -74,7 +164,49 @@ jobs:
74164            src/* 
75165            runs/wokwi/results/final/* 
76166            runs/wokwi/reports/final_summary_report.csv 
77-             runs/wokwi/reports/synthesis/1-synthesis.stat.rpt.strategy4 
78-             gds_render.svg 
79-             gds.html 
80167
168+    pages :
169+     needs :
170+     - svg 
171+     - webgl 
172+     environment :
173+       name : github-pages 
174+       url : ${{ steps.deployment.outputs.page_url }} 
175+     outputs :
176+       page_url : ${{ steps.deployment.outputs.page_url }} 
177+     runs-on : ubuntu-latest 
178+     steps :
179+     - name : restore svg cache 
180+       uses : actions/cache@v2 
181+       with :
182+         path : ' gds_render.svg' 
183+         key : ${{ runner.os }}-svg-${{ github.run_id }} 
184+     - name : restore webgl cache 
185+       uses : actions/cache@v2 
186+       with :
187+         path : index.html 
188+         key : ${{ runner.os }}-webgl-${{ github.run_id }} 
189+     - name : Setup Pages 
190+       uses : actions/configure-pages@v2 
191+     - name : Upload artifact 
192+       uses : actions/upload-pages-artifact@v1 
193+       with :
194+         path : ' .' 
195+     - name : Deploy to GitHub Pages 
196+       id : deployment 
197+       uses : actions/deploy-pages@v1 
198+ 
199+   preview :
200+     needs : pages 
201+     runs-on : ubuntu-latest 
202+     steps :
203+     - name : add gds preview 
204+       run : | 
205+         PAGE_URL=${{ needs.pages.outputs.page_url }} 
206+         PAGE_URL=$(echo "$PAGE_URL" | sed -e 's/\/$//') 
207+         cat << EOF >> $GITHUB_STEP_SUMMARY 
208+         # svg 
209+          
210+         # webgl 
211+         [open preview]($PAGE_URL) 
212+         EOF 
0 commit comments