mirror of
https://github.com/The-OpenROAD-Project/OpenLane.git
synced 2026-05-29 00:23:55 +08:00
Please excuse the last commit lacking a changelog. + PDK installation uses Volare, transparently to the user: all they have to do is type "make", where it will get OpenLane and the PDK + CI now uses Volare to either **get** or **build** the PDK (if not found), which speeds up the fastest test set by around 60%. + Added rudimentary dependency installation instructions. + pyyaml folded into the repo, so users without pip can still run issue surveys ~ Open PDKs updated: Parasitics are now extracted using a rules file based on [spef-extractor](https://github.com/Cloud-V/spef-extractor) as a ***temporary*** measure ~ Issue survey no longer checks for click and pyyaml: a venv is used in those scenarios. ~ OpenLane build no longer uses the host filesystem as an intermediary, instead using a templated dockerfile with an N-stage build for N tools, saving IO operations (40% improvement measured) ~ Old PDK targets renamed to build-pdk-conda, includes SRAM by default ~ Replaced python3 ./env.py issue-survey with `make survey` - Removed Fault from documentation (until I get the chance to work on it)
327 lines
11 KiB
YAML
327 lines
11 KiB
YAML
name: CI
|
|
|
|
# To run on the GCP replace all 'ubuntu-latest' with 'self-hosted'
|
|
on:
|
|
# Runs on pushes to all but CID-latest-branches
|
|
# CID-latest branches automatically create PRs, let's just let the tests run on those
|
|
push:
|
|
# Runs on Pull Requests
|
|
pull_request:
|
|
# Runs every day at midnight UTC
|
|
schedule:
|
|
- cron: "0 0 * * *"
|
|
# Manual Dispatch
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
docker_build:
|
|
runs-on: ubuntu-20.04
|
|
outputs:
|
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
|
issue_regression_matrix: ${{ steps.set-matrix.outputs.issue_regression_matrix }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
# EXPORT BLOCK
|
|
- name: Export Repo URL
|
|
run: echo "REPO_URL=https://github.com/${{ github.repository }}.git" >> $GITHUB_ENV
|
|
|
|
- name: Export PDK ROOT
|
|
run: echo "PDK_ROOT=/usr/local/pdk" >> $GITHUB_ENV
|
|
|
|
- name: Export Branch Name
|
|
run: echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
|
|
|
|
- name: Export Temp Image Name
|
|
run: echo "OPENLANE_IMAGE_NAME=openlane:intermediate" >> $GITHUB_ENV
|
|
# END EXPORT BLOCK
|
|
|
|
- name: Check If Going To Push An Image To Docker
|
|
# # Uncomment the next line if you want to only build & push a container if entire test set succeeds
|
|
# if: needs.test.result == 'success'
|
|
# Ruby snippet to print 0 if this is a PR or if there is no DOCKERHUB_USER secret set, otherwise, 1
|
|
run: |
|
|
export PUSHING=$(ruby -e 'if ("${{ github.event_name }}" != "pull_request" && "${{ secrets.DOCKERHUB_USER }}" != ""); print(1) else print(0) end')
|
|
echo "PUSHING=$PUSHING" >> $GITHUB_ENV
|
|
|
|
- name: Login to DockerHub
|
|
if: ${{ env.PUSHING == '1' }}
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USER }}
|
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
|
|
|
- name: Docker Build
|
|
run: |
|
|
export BUILD_IF_CANT_PULL=1
|
|
if [ $PUSHING = '1' ]; then
|
|
export BUILD_IF_CANT_PULL_THEN_PUSH=1
|
|
fi
|
|
cd docker/ && make merge
|
|
|
|
- name: Build (or Get) PDK
|
|
run: |
|
|
sudo mkdir -p ${{ env.PDK_ROOT }}
|
|
sudo chown -R $USER:$USER ${{ env.PDK_ROOT }}
|
|
go get -u github.com/tcnksm/ghr
|
|
python3 -m pip install --upgrade --no-cache-dir volare
|
|
export OPDKS_VER="$(python3 ./dependencies/tool.py open_pdks -f commit)"
|
|
if [ "${{ secrets.VOLARE_REPO }}" != "" ]; then
|
|
volare enable_or_build\
|
|
--also-push\
|
|
--token ${{ secrets.MY_TOKEN }}\
|
|
--owner ${{ secrets.VOLARE_OWNER }}\
|
|
--repository ${{ secrets.VOLARE_REPO }}\
|
|
-j$(nproc)\
|
|
$OPDKS_VER
|
|
else
|
|
volare enable_or_build\
|
|
--token ${{ secrets.MY_TOKEN }}\
|
|
-j$(nproc)\
|
|
$OPDKS_VER
|
|
fi
|
|
|
|
- name: Export Docker Image
|
|
run: docker save -o /tmp/image.tar ${{ env.OPENLANE_IMAGE_NAME }}
|
|
|
|
- name: Upload Docker Image
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: docker-image
|
|
path: /tmp/image.tar
|
|
|
|
- name: Tarball PDK
|
|
run: |
|
|
tar -cf /tmp/sky130A.tar -C $PDK_ROOT/sky130A .
|
|
|
|
- name: Upload PDK Tarball
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: pdk-tarball
|
|
path: /tmp/sky130A.tar
|
|
|
|
- name: Determine If Running Extended Test Set
|
|
run: |
|
|
export EVENT_NAME=${{ github.event_name }};
|
|
python3 ./.github/scripts/determine_test_set.py
|
|
|
|
- name: Prepare Test Matrix
|
|
id: set-matrix
|
|
run: |
|
|
if [[ "$USE_ETS" = "1" ]]; then
|
|
echo "::set-output name=matrix::$(python3 ./.github/test_sets/get_test_matrix.py fastest_test_set extended_test_set)"
|
|
else
|
|
echo "::set-output name=matrix::$(python3 ./.github/test_sets/get_test_matrix.py fastest_test_set)"
|
|
fi
|
|
echo "::set-output name=issue_regression_matrix::$(python3 ./run_issue_regressions.py get_matrix)"
|
|
|
|
issue_regression_test:
|
|
needs: docker_build
|
|
runs-on: ubuntu-20.04
|
|
strategy:
|
|
fail-fast: false
|
|
matrix: ${{ fromJSON(needs.docker_build.outputs.issue_regression_matrix) }}
|
|
name: Test Issue Regression ${{ matrix.design }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
# EXPORT BLOCK
|
|
- name: Export Repo URL
|
|
run: echo "REPO_URL=https://github.com/${{ github.repository }}.git" >> $GITHUB_ENV
|
|
|
|
- name: Export PDK ROOT
|
|
run: echo "PDK_ROOT=/usr/local/pdk" >> $GITHUB_ENV
|
|
|
|
- name: Export Branch Name
|
|
run: echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
|
|
|
|
- name: Export Temp Image Name
|
|
run: echo "OPENLANE_IMAGE_NAME=openlane:intermediate" >> $GITHUB_ENV
|
|
# END EXPORT BLOCK
|
|
|
|
- name: Download Docker Image
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: docker-image
|
|
path: /tmp
|
|
|
|
- name: Import Docker Image
|
|
run: docker load --input /tmp/image.tar
|
|
|
|
- name: Download PDK Tarball
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: pdk-tarball
|
|
path: /tmp
|
|
|
|
- name: Unpack PDK Tarball
|
|
run: |
|
|
sudo mkdir -p ${{ env.PDK_ROOT }}/sky130A
|
|
sudo chown -R $USER:$USER ${{ env.PDK_ROOT }}
|
|
tar -xf /tmp/sky130A.tar -C $PDK_ROOT/sky130A .
|
|
|
|
- name: Get Pyyaml
|
|
run: python3 -m pip install pyyaml
|
|
|
|
- name: Run Issue Regression Test
|
|
run: cd ${GITHUB_WORKSPACE}/ && make run_issue_regression ISSUE_REGRESSION_DESIGN=${{ matrix.design }}
|
|
# Each test has two components: a fast test set and an extended test set.
|
|
# The fast test set is run on all PRs, etc. The extended test set runs on schedule.
|
|
test:
|
|
needs: docker_build
|
|
runs-on: ubuntu-20.04
|
|
strategy:
|
|
fail-fast: false
|
|
matrix: ${{ fromJSON(needs.docker_build.outputs.matrix) }}
|
|
name: Test Design ${{ matrix.design }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
# EXPORT BLOCK
|
|
- name: Export Repo URL
|
|
run: echo "REPO_URL=https://github.com/${{ github.repository }}.git" >> $GITHUB_ENV
|
|
|
|
- name: Export PDK ROOT
|
|
run: echo "PDK_ROOT=/usr/local/pdk" >> $GITHUB_ENV
|
|
|
|
- name: Export Branch Name
|
|
run: echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
|
|
|
|
- name: Export Temp Image Name
|
|
run: echo "OPENLANE_IMAGE_NAME=openlane:intermediate" >> $GITHUB_ENV
|
|
# END EXPORT BLOCK
|
|
|
|
- name: Download Docker Image
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: docker-image
|
|
path: /tmp
|
|
|
|
- name: Import Docker Image
|
|
run: docker load --input /tmp/image.tar
|
|
|
|
- name: Download PDK Tarball
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: pdk-tarball
|
|
path: /tmp
|
|
|
|
- name: Unpack PDK Tarball
|
|
run: |
|
|
sudo mkdir -p ${{ env.PDK_ROOT }}/sky130A
|
|
sudo chown -R $USER:$USER ${{ env.PDK_ROOT }}
|
|
tar -xf /tmp/sky130A.tar -C $PDK_ROOT/sky130A .
|
|
|
|
- name: Get Pyyaml
|
|
run: python3 -m pip install pyyaml
|
|
|
|
- name: Run Test
|
|
run: cd ${GITHUB_WORKSPACE}/ && python3 ${GITHUB_WORKSPACE}/.github/scripts/run_tests.py ${{ matrix.design }}
|
|
|
|
- name: Upload Run Tarball
|
|
if: ${{ always() }}
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: ${{ matrix.design }}
|
|
path: ./reproducible.tar.gz
|
|
|
|
cleanup_and_deploy:
|
|
name: Cleanup (and Possibly Deployment)
|
|
needs: [test, issue_regression_test]
|
|
if: always()
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- name: Check If Going To Push An Image To Docker
|
|
# # Uncomment the next line if you want to only build & push a container if entire test set succeeds
|
|
# if: needs.test.result == 'success'
|
|
# Ruby snippet to print 0 if this is a PR or if there is no DOCKERHUB_USER secret set, otherwise, 1
|
|
run: |
|
|
export PUSHING=$(ruby -e 'if ("${{ github.event_name }}" != "pull_request" && "${{ secrets.DOCKERHUB_USER }}" != ""); print(1) else print(0) end')
|
|
echo "PUSHING=$PUSHING" >> $GITHUB_ENV
|
|
|
|
- uses: actions/checkout@v2
|
|
if: ${{ env.PUSHING == '1' }}
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
# EXPORT BLOCK
|
|
- name: Export Repo URL
|
|
run: echo "REPO_URL=https://github.com/${{ github.repository }}.git" >> $GITHUB_ENV
|
|
|
|
- name: Export PDK ROOT
|
|
run: echo "PDK_ROOT=/usr/local/pdk" >> $GITHUB_ENV
|
|
|
|
- name: Export Branch Name
|
|
run: echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
|
|
|
|
- name: Export Temp Image Name
|
|
run: echo "OPENLANE_IMAGE_NAME=openlane:intermediate" >> $GITHUB_ENV
|
|
# END EXPORT BLOCK
|
|
|
|
- name: Download Docker Image
|
|
if: ${{ env.PUSHING == '1' }}
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: docker-image
|
|
path: /tmp
|
|
|
|
- name: Delete Docker Image
|
|
uses: geekyeggo/delete-artifact@v1
|
|
with:
|
|
name: docker-image
|
|
|
|
- name: Delete PDK
|
|
uses: geekyeggo/delete-artifact@v1
|
|
with:
|
|
name: pdk-tarball
|
|
|
|
- name: Import Docker Image
|
|
if: ${{ env.PUSHING == '1' }}
|
|
run: docker load --input /tmp/image.tar
|
|
|
|
- name: Write Main Branch
|
|
if: ${{ env.PUSHING == '1' }}
|
|
run: |
|
|
echo "MAIN_BRANCH=${{ secrets.MAIN_BRANCH }}" >> $GITHUB_ENV
|
|
|
|
- name: Write Hash
|
|
run: |
|
|
echo "GIT_COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
|
|
|
|
- name: Create Tag (If scheduled or dispatched)
|
|
if: ${{ env.PUSHING == '1' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && env.BRANCH_NAME == env.MAIN_BRANCH }}
|
|
run: cd ${GITHUB_WORKSPACE}/ && python3 ${GITHUB_WORKSPACE}/.github/scripts/generate_tag.py
|
|
|
|
- name: Tag Commit (If scheduled or dispatched)
|
|
if: ${{ env.PUSHING == '1' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && env.NEW_TAG != 'NO_NEW_TAG' }}
|
|
uses: tvdias/github-tagger@v0.0.1
|
|
with:
|
|
tag: "${{ env.NEW_TAG }}"
|
|
repo-token: "${{ secrets.MY_TOKEN }}"
|
|
|
|
- name: Login to DockerHub
|
|
if: ${{ env.PUSHING == '1' }}
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USER }}
|
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
|
|
|
- name: Docker Push (Hash)
|
|
if: ${{ env.PUSHING == '1' && github.event_name == 'push' && env.BRANCH_NAME == env.MAIN_BRANCH }}
|
|
run: |
|
|
docker image tag ${{ env.OPENLANE_IMAGE_NAME }} ${{ secrets.DOCKER_IMAGE }}:${{ env.GIT_COMMIT_HASH }}
|
|
docker push ${{ secrets.DOCKER_IMAGE }}:${{ env.GIT_COMMIT_HASH }}
|
|
|
|
- name: Docker Push (Branch)
|
|
if: ${{ env.PUSHING == '1' && github.event_name == 'push' }}
|
|
run: |
|
|
docker image tag ${{ env.OPENLANE_IMAGE_NAME }} ${{ secrets.DOCKER_IMAGE }}:${{ env.BRANCH_NAME }}
|
|
docker push ${{ secrets.DOCKER_IMAGE }}:${{ env.BRANCH_NAME }}
|
|
|
|
- name: Docker Push (Tag) (If scheduled or dispatched)
|
|
if: ${{ env.PUSHING == '1' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && env.NEW_TAG != 'NO_NEW_TAG' }}
|
|
run: |
|
|
docker image tag ${{ env.OPENLANE_IMAGE_NAME }} ${{ secrets.DOCKER_IMAGE }}:${{ env.NEW_TAG }}
|
|
docker image tag ${{ env.OPENLANE_IMAGE_NAME }} ${{ secrets.DOCKER_IMAGE }}:latest
|
|
docker push ${{ secrets.DOCKER_IMAGE }}:${{ env.NEW_TAG }}
|
|
docker push ${{ secrets.DOCKER_IMAGE }}:latest
|