ci: workaround for broken Cython version #31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: gds | |
# either manually started, or on a schedule | |
on: [ push, workflow_dispatch ] | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
jobs: | |
gds: | |
env: | |
OPENLANE_TAG: 2023.02.14 | |
OPENLANE_IMAGE_NAME: efabless/openlane:4cd0986b3ae550cdf7a6d0fba4e0657012f635d8-amd64 | |
OPENLANE_ROOT: /home/runner/openlane | |
PDK_ROOT: /home/runner/pdk | |
PDK: sky130A | |
# ubuntu | |
runs-on: ubuntu-latest | |
steps: | |
# need the repo checked out | |
- name: checkout repo | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: checkout tt tools repo | |
uses: actions/checkout@v3 | |
with: | |
repository: tinytapeout/tt-support-tools | |
path: tt | |
ref: tt03 | |
# need python | |
- name: setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- run: pip install -r tt/requirements.txt | |
# fetch the Verilog from Wokwi API | |
- name: fetch Verilog and build config | |
run: ./tt/tt_tool.py --create-user-config | |
# build OpenLane | |
- name: openlane repo | |
run: | | |
git clone --depth=1 --branch $OPENLANE_TAG https://github.com/The-OpenROAD-Project/OpenLane.git $OPENLANE_ROOT | |
cd $OPENLANE_ROOT | |
make | |
# run OpenLane to build the GDS | |
- name: make GDS | |
run: ./tt/tt_tool.py --harden | |
# for debugging, show all the files | |
- name: show files | |
run: find runs/wokwi/ | |
# yosys warnings | |
- name: yosys warnings | |
run: ./tt/tt_tool.py --print-warnings >> $GITHUB_STEP_SUMMARY | |
# print some routing stats | |
- name: add summary | |
run: ./tt/tt_tool.py --print-stats >> $GITHUB_STEP_SUMMARY | |
# print some cell stats | |
- name: cell usage summary | |
run: ./tt/tt_tool.py --print-cell-category >> $GITHUB_STEP_SUMMARY | |
- name: populate src cache | |
uses: actions/cache@v3 | |
with: | |
path: src | |
key: ${{ runner.os }}-src-${{ github.run_id }} | |
- name: populate runs cache | |
uses: actions/cache@v3 | |
with: | |
path: runs | |
key: ${{ runner.os }}-runs-${{ github.run_id }} | |
- name: populate PDK cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.PDK_ROOT }} | |
key: ${{ runner.os }}-pdk-${{ github.run_id }} | |
# create png | |
- name: png | |
run: ./tt/tt_tool.py --create-png | |
- name: populate png cache | |
uses: actions/cache@v3 | |
with: | |
path: 'gds_render.png' | |
key: ${{ runner.os }}-png-${{ github.run_id }} | |
############################################################## | |
# GateLevel sim | |
gatelevel: | |
needs: gds | |
env: | |
PDK_ROOT: /home/runner/pdk | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: restore runs cache | |
uses: actions/cache@v3 | |
with: | |
path: runs | |
key: ${{ runner.os }}-runs-${{ github.run_id }} | |
- name: restore pdk cache for the primitives needed for GL verification | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.PDK_ROOT }} | |
key: ${{ runner.os }}-pdk-${{ github.run_id }} | |
# for debugging, show all the files | |
- name: show files | |
run: | | |
pwd | |
find . | |
# install oss fpga tools for iVerilog | |
- name: install oss-cad-suite | |
uses: YosysHQ/setup-oss-cad-suite@v2 | |
with: | |
python-override: true | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- run: | | |
yosys --version | |
iverilog -V | |
cocotb-config --libpython | |
cocotb-config --python-bin | |
- name: test | |
run: | | |
pwd | |
rm runs/wokwi/results/final/verilog/gl/*.nl.v | |
cp runs/wokwi/results/final/verilog/gl/*.v src/gate_level_netlist.v | |
cd src | |
make clean | |
GATES=yes make | |
# make will return success even if the test fails, so check for failure in the results.xml | |
! grep failure results.xml | |
- name: upload vcd | |
if: success() || failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: gatelevel-test-vcd | |
path: src/tb.vcd | |
############################################################## | |
# Generate files for the 3D viewer | |
viewer: | |
needs: gds | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout GDS2glTF repo | |
uses: actions/checkout@v3 | |
with: | |
repository: mbalestrini/GDS2glTF | |
- name: setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: restore runs cache | |
uses: actions/cache@v3 | |
with: | |
path: runs | |
key: ${{ runner.os }}-runs-${{ github.run_id }} | |
- name: gds2gltf | |
run: | | |
python -m pip install numpy gdspy triangle pygltflib | |
cp runs/wokwi/results/final/gds/*.gds tinytapeout.gds | |
python3 gds2gltf.py tinytapeout.gds | |
- name: populate viewer cache | |
uses: actions/cache@v3 | |
with: | |
path: 'tinytapeout.gds.gltf' | |
key: ${{ runner.os }}-viewer-${{ github.run_id }} | |
############################################################## | |
# Downloadable results from OpenLane | |
artifact: | |
needs: | |
- gds | |
runs-on: ubuntu-latest | |
steps: | |
- name: restore src cache | |
uses: actions/cache@v3 | |
with: | |
path: src | |
key: ${{ runner.os }}-src-${{ github.run_id }} | |
- name: restore runs cache | |
uses: actions/cache@v3 | |
with: | |
path: runs | |
key: ${{ runner.os }}-runs-${{ github.run_id }} | |
- name: upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
# path depends on the tag and the module name | |
name: GDS | |
path: | | |
src/* | |
runs/wokwi/results/final/* | |
runs/wokwi/reports/metrics.csv | |
runs/wokwi/reports/synthesis/1-synthesis.AREA 0.stat.rpt | |
############################################################## | |
# Publish to pages to get a nicely formatted result | |
pages: | |
needs: | |
- viewer | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
outputs: | |
page_url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: restore png cache | |
uses: actions/cache@v3 | |
with: | |
path: 'gds_render.png' | |
key: ${{ runner.os }}-png-${{ github.run_id }} | |
- name: restore viewer cache | |
uses: actions/cache@v3 | |
with: | |
path: 'tinytapeout.gds.gltf' | |
key: ${{ runner.os }}-viewer-${{ github.run_id }} | |
- name: generate redirect to viewer | |
run: | | |
cat << EOF >> index.html | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Redirecting to GDS Viewer...</title> | |
</head> | |
<body> | |
<script> | |
location.href = "https://gds-viewer.tinytapeout.com/?model=" + encodeURIComponent(location.href + '/tinytapeout.gds.gltf'); | |
</script> | |
</body> | |
</html> | |
EOF | |
- name: Setup Pages | |
uses: actions/configure-pages@v2 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: '.' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/[email protected] | |
############################################################## | |
# Add the 3D and 2D preview to the page | |
preview: | |
needs: pages | |
runs-on: ubuntu-latest | |
steps: | |
- name: add gds preview | |
run: | | |
PAGE_URL=${{ needs.pages.outputs.page_url }} | |
PAGE_URL=$(echo "$PAGE_URL" | sed -e 's/\/$//') | |
cat << EOF >> $GITHUB_STEP_SUMMARY | |
# 3D Viewer | |
[open 3D viewer](https://gds-viewer.tinytapeout.com/?model=$PAGE_URL/tinytapeout.gds.gltf) | |
# 2D Preview | |
![png]($PAGE_URL/gds_render.png) | |
EOF |