这是indexloc提供的服务,不要输入任何密码
Skip to content

feat!: KLayout.StreamOut: Add KLAYOUT_CONFLICT_RESOLUTION #343

feat!: KLayout.StreamOut: Add KLAYOUT_CONFLICT_RESOLUTION

feat!: KLayout.StreamOut: Add KLAYOUT_CONFLICT_RESOLUTION #343

Workflow file for this run

name: CI
# Variables
env:
IP_ROOT: ./test/designs/.ip-root
# Events that trigger workflow
on:
# Runs on all pushes to branches
push:
# Runs on all PRs
pull_request:
# Runs every day at midnight UTC
schedule:
- cron: "0 0 * * *"
# Manual Dispatch
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'pull_request' && github.event.number || github.ref_name }}
cancel-in-progress: true
jobs:
prepare-test-matrices:
name: Prepare Test Matrices and Cache PDKs
runs-on: ubuntu-22.04
outputs:
design_matrix: ${{ steps.set-matrix.outputs.design_matrix }}
opdks_rev: ${{ steps.set-rev.outputs.opdks_rev }}
steps:
- uses: actions/checkout@v4
- name: Python Dependencies
run: |
pip3 install poetry poetry-plugin-export
poetry export --with dev --without-hashes --format=requirements.txt --output=requirements_tmp.txt
pip3 install -r requirements_tmp.txt
- name: Determine If Running Extended Test Set
run: |
export EVENT_NAME=${{ github.event_name }};
python3 ./.github/scripts/determine_test_set.py
- name: Set Matrix
id: set-matrix
run: |
python3 ./.github/test_sets/get_test_matrix.py --scl sky130A/sky130_fd_sc_hd --scl gf180mcuD/gf180mcu_fd_sc_mcu7t5v0 $TEST_SETS
echo "design_matrix=$(python3 ./.github/test_sets/get_test_matrix.py --scl sky130A/sky130_fd_sc_hd --scl gf180mcuD/gf180mcu_fd_sc_mcu7t5v0 $TEST_SETS)" >> $GITHUB_OUTPUT
- name: Get Open PDKs Revision
id: set-rev
run: |
echo "opdks_rev=$(cat ./librelane/open_pdks_rev)" >> $GITHUB_OUTPUT
- name: Cache sky130 PDK
uses: actions/cache@v4
with:
path: ./.ciel-sky130
key: cache-sky130-pdk-${{ steps.set-rev.outputs.opdks_rev }}
enableCrossOsArchive: true
- name: Enable sky130 PDK
run: |
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
ciel enable --pdk sky130 --pdk-root ./.ciel-sky130 ${{ steps.set-rev.outputs.opdks_rev }}
- name: Cache gf180mcu PDK
uses: actions/cache@v4
with:
path: ./.ciel-gf180mcu
key: cache-gf180mcu-pdk-${{ steps.set-rev.outputs.opdks_rev }}
enableCrossOsArchive: true
- name: Enable gf180mcu PDK
run: |
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
ciel enable --pdk gf180mcu --pdk-root ./.ciel-gf180mcu ${{ steps.set-rev.outputs.opdks_rev }}
- name: Checkout submodules
uses: actions/checkout@v4
with:
submodules: true
lint:
name: Lint
runs-on: ubuntu-22.04
steps:
- name: Check out repo
uses: actions/checkout@v4
- name: Set Up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install Linters
run: make venv
- name: Lint
run: |
PATH=$PWD/venv/bin:$PATH make lint
build-py:
runs-on: ubuntu-22.04
needs: [lint, prepare-test-matrices]
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
fail-fast: false
name: Build and Unit Test (Python ${{ matrix.python-version }})
steps:
- name: Check out repo
uses: actions/checkout@v4
- name: Set Up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Run Unit Tests
run: |
make venv
./venv/bin/coverage run -m pytest -n auto --pdk-root="./.ciel-sky130"
./venv/bin/coverage report
./venv/bin/coverage html
build-linux-x86_64:
needs: lint
runs-on: ubuntu-22.04
name: Build (Nix/x86_64-linux)
steps:
- uses: actions/checkout@v4
- name: Initialize Step Unit Test Submodule
run: |
git submodule update --init test/steps/all
- name: Set up GITHUB_TOKEN
run: |
echo "GITHUB_TOKEN=${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
- uses: DeterminateSystems/nix-installer-action@main
with:
extra-conf: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
extra-substituters = https://${{ vars.NIX_CACHE }} https://openlane.cachix.org
extra-trusted-public-keys = ${{ vars.NIX_PUBLIC_KEY }} openlane.cachix.org-1:qqdwh+QMNGmZAuyeQJTH9ErW57OWSvdtuwfBKdS254E=
- name: Build with Nix
uses: ./.github/actions/build_nix
with:
nix_system: x86_64-linux
run_tests: "true"
- name: Cache to S3
uses: fossi-foundation/nix-eda/.github/actions/nix_sign_cache_s3@main
with:
flake_outputs: .#packages.x86_64-linux.librelane
nix_public_key: ${{ vars.NIX_PUBLIC_KEY }}
nix_private_key: ${{ secrets.NIX_PRIVATE_KEY }}
s3_bucket_name: ${{ vars.NIX_CACHE }}
aws_region: ${{ secrets.AWS_REGION }}
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
build-linux-aarch64:
needs: lint
runs-on: ubuntu-22.04-arm
name: Build (Nix/aarch64-linux)
steps:
- uses: actions/checkout@v4
- name: Initialize Step Unit Test Submodule
run: |
git submodule update --init test/steps/all
- name: Set up GITHUB_TOKEN
run: |
echo "GITHUB_TOKEN=${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
- uses: DeterminateSystems/nix-installer-action@main
with:
extra-conf: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
extra-substituters = https://${{ vars.NIX_CACHE }} https://openlane.cachix.org
extra-trusted-public-keys = ${{ vars.NIX_PUBLIC_KEY }} openlane.cachix.org-1:qqdwh+QMNGmZAuyeQJTH9ErW57OWSvdtuwfBKdS254E=
- name: Build with Nix
uses: ./.github/actions/build_nix
with:
nix_system: aarch64-linux
run_tests: "true"
- name: Cache to S3
uses: fossi-foundation/nix-eda/.github/actions/nix_sign_cache_s3@main
with:
flake_outputs: .#packages.aarch64-linux.librelane
nix_public_key: ${{ vars.NIX_PUBLIC_KEY }}
nix_private_key: ${{ secrets.NIX_PRIVATE_KEY }}
s3_bucket_name: ${{ vars.NIX_CACHE }}
aws_region: ${{ secrets.AWS_REGION }}
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
build-darwin:
strategy:
matrix:
os:
[
{
name: "macOS 13",
family: "darwin",
runner: "macos-13",
arch: "x86_64",
nix: "x86_64-darwin",
},
{
name: "macOS 14",
family: "darwin",
runner: "macos-15",
arch: "aarch64",
nix: "aarch64-darwin",
},
]
fail-fast: false
needs: [lint, prepare-test-matrices]
runs-on: ${{ matrix.os.runner }}
name: Build (Nix/${{ matrix.os.nix }})
steps:
- uses: actions/checkout@v4
- name: Initialize Step Unit Test Submodule
run: |
git submodule update --init test/steps/all
- name: Set up GITHUB_TOKEN
run: |
echo "GITHUB_TOKEN=${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
- uses: DeterminateSystems/nix-installer-action@main
with:
extra-conf: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
extra-substituters = https://${{ vars.NIX_CACHE }} https://openlane.cachix.org
extra-trusted-public-keys = ${{ vars.NIX_PUBLIC_KEY }} openlane.cachix.org-1:qqdwh+QMNGmZAuyeQJTH9ErW57OWSvdtuwfBKdS254E=
- name: Cache sky130 PDK
uses: actions/cache@v4
with:
path: ./.ciel-sky130
key: cache-sky130-pdk-${{ steps.set-rev.outputs.opdks_rev }}
enableCrossOsArchive: true
- name: Build with Nix
uses: ./.github/actions/build_nix
with:
nix_system: ${{ matrix.os.nix }}
shell: "zsh {0}"
run_tests: "true"
pdk_root: ${{ github.workspace }}/.ciel-sky130
- name: Cache to S3
uses: fossi-foundation/nix-eda/.github/actions/nix_sign_cache_s3@main
with:
flake_outputs: .#packages.${{ matrix.os.nix }}.librelane
nix_public_key: ${{ vars.NIX_PUBLIC_KEY }}
nix_private_key: ${{ secrets.NIX_PRIVATE_KEY }}
s3_bucket_name: ${{ vars.NIX_CACHE }}
aws_region: ${{ secrets.AWS_REGION }}
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
build-docker:
strategy:
matrix:
os:
[
{
name: "Ubuntu 22.04",
family: "linux",
runner: "ubuntu-22.04",
arch: "x86_64",
nix: "x86_64-linux",
},
{
name: "Ubuntu 22.04",
family: "linux",
runner: "ubuntu-22.04-arm",
arch: "aarch64",
nix: "aarch64-linux",
},
]
runs-on: ${{ matrix.os.runner }}
needs: [build-linux-x86_64, build-linux-aarch64]
name: Build Docker Image (${{ matrix.os.arch }})
steps:
- name: Maximize build space
uses: AdityaGarg8/remove-unwanted-software@v5
with:
remove-dotnet: "true"
remove-android: "true"
remove-haskell: "true"
remove-codeql: "true"
remove-docker-images: "true"
- name: Check out repo
uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
with:
determinate: true
extra-conf: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
extra-substituters = https://${{ vars.NIX_CACHE }} https://openlane.cachix.org
extra-trusted-public-keys = ${{ vars.NIX_PUBLIC_KEY }} openlane.cachix.org-1:qqdwh+QMNGmZAuyeQJTH9ErW57OWSvdtuwfBKdS254E=
- name: Build with Nix
id: nix_build_action
uses: ./.github/actions/build_nix
with:
nix_system: ${{ matrix.os.nix }}
- name: Build Docker Image
run: |
IMAGE_PATH=$(nix build\
--print-out-paths\
--no-link\
--accept-flake-config\
--option system ${{ matrix.os.nix }}\
--extra-platforms ${{ matrix.os.nix }}\
.#packages.${{ matrix.os.nix }}.librelane-docker)
echo "IMAGE_PATH=$IMAGE_PATH" >> $GITHUB_ENV
cat $IMAGE_PATH | docker load
- name: Set Up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
# Do not cache the PDK. We want to test the typical Docker flow here.
- name: Smoke-Test Docker Image
if: ${{ matrix.os.arch != 'aarch64' }} # No KLayout wheels available for aarch64 yet
run: |
make venv
mkdir -p $HOME/.ciel
chmod -R 755 $HOME/.ciel
export LIBRELANE_IMAGE_OVERRIDE=librelane:tmp-${{ matrix.os.arch }}-linux
./venv/bin/python3 -m librelane\
--docker-no-tty\
--dockerized\
--pdk-root ./.ciel-sky130\
--smoke-test
- name: Upload Docker Artifact
uses: actions/upload-artifact@v4
with:
name: docker-image-${{ matrix.os.arch }}
path: ${{ env.IMAGE_PATH }}
test:
runs-on: ubuntu-22.04
needs: [build-linux-x86_64, prepare-test-matrices]
name: Test Design ${{ matrix.design.test_name }} (${{ matrix.design.pdk }}/${{matrix.design.scl}})
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.prepare-test-matrices.outputs.design_matrix) }}
steps:
- name: Maximize build space
uses: AdityaGarg8/remove-unwanted-software@v5
with:
remove-dotnet: "true"
remove-android: "true"
remove-haskell: "true"
remove-codeql: "true"
remove-docker-images: "true"
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Check if Git
run: |
git status || true
tree .git || true
- uses: DeterminateSystems/nix-installer-action@main
with:
extra-conf: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
extra-substituters = https://${{ vars.NIX_CACHE }} https://openlane.cachix.org
extra-trusted-public-keys = ${{ vars.NIX_PUBLIC_KEY }} openlane.cachix.org-1:qqdwh+QMNGmZAuyeQJTH9ErW57OWSvdtuwfBKdS254E=
- name: Build with Nix
uses: ./.github/actions/build_nix
with:
nix_system: x86_64-linux
- name: Check Nix
run: |
sudo du -hs /nix/store/* | sort -h | tail -n 10
sudo tree /nix/store/*-librelane || true
- name: Cache PDK
id: cache-pdk
uses: actions/cache@v4
with:
path: ./.ciel-${{ matrix.design.pdk_family }}
key: cache-${{ matrix.design.pdk_family }}-pdk-${{ needs.prepare-test-matrices.outputs.opdks_rev }}
enableCrossOsArchive: true
- name: Enable PDKs
if: steps.cache-pdk.outputs.cache-hit != 'true'
run: |
pipx run ciel==$(perl -ne 'print /version\s*=\s*"([\d\.]+)"/ if $c; $c = /name\s*=\s*"ciel"/' ./poetry.lock )\
-- enable --pdk ${{ matrix.design.pdk_family }} \
--pdk-root ./.ciel-${{ matrix.design.pdk_family }} \
${{ needs.prepare-test-matrices.outputs.opdks_rev }}
- name: Download IPM designs
id: download-ipm-design
if: matrix.design.ipm_version != 'None'
run: |
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
pipx run ipmgr \
-- install --ip-root $(realpath $IP_ROOT) \
--ipm-root ~/.ipm --version ${{ matrix.design.ipm_version }} \
${{ matrix.design.name }}
- name: Run Test
id: test_run
continue-on-error: true
run: |
if test ${{matrix.design.script}} = "None"
then
mkdir -p ${{ github.workspace }}/run
sudo du -hs /nix/store/* | sort -h | tail -n 10
sudo du -hs /nix/store/* | sort -h | tail -n 10 > before.txt
nix run . --\
--run-tag ${{ matrix.design.pdk }}-${{ matrix.design.scl }}\
--pdk ${{ matrix.design.pdk }}\
--scl ${{ matrix.design.scl }}\
--pdk-root ./.ciel-${{ matrix.design.pdk_family }}\
--condensed\
${{ matrix.design.config }}
else
nix develop --command\
python3 ${{ matrix.design.script }}\
--run-tag ${{ matrix.design.pdk }}-${{ matrix.design.scl }}\
--pdk ${{ matrix.design.pdk }}\
--scl ${{ matrix.design.scl }}\
--pdk-root ./.ciel-${{ matrix.design.pdk_family }}\
--condensed
fi
- name: Upload Run Folder
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.design.test_name }}-${{ matrix.design.pdk }}-${{ matrix.design.scl }}
path: ${{ matrix.design.run_dir }}
- name: Fetch Metrics
run: |
nix develop --command librelane.state latest\
${{ matrix.design.run_dir }}\
--extract-metrics-to ${{ matrix.design.pdk }}-${{ matrix.design.scl }}-${{ matrix.design.test_name }}.metrics.json
- name: Upload Metrics
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.design.pdk }}-${{ matrix.design.scl }}-${{ matrix.design.test_name }}.metrics.json
path: ${{ matrix.design.pdk }}-${{ matrix.design.scl }}-${{ matrix.design.test_name }}.metrics.json
- name: Propagate test failure after uploading metrics
if: steps.test_run.outcome == 'failure'
run:
exit -1
merge_metrics:
name: Merge Metrics
runs-on: ubuntu-22.04
needs: test
if: always()
steps:
- id: metric_merge
name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: metrics
pattern: "*.metrics.json"
upload_metrics:
name: Upload Metrics
runs-on: ubuntu-22.04
needs: [test, merge_metrics]
# if there isn't at least one metric this exercise is pointless
if: needs.merge_metrics.result == 'success'
steps:
- name: Check out repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup
run: |
sudo apt-get install -y python3-tk
python3 -m pip install -e .
echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Download Metrics
uses: actions/download-artifact@v4
with:
name: metrics
path: current
- name: "[PRs] Compare to target branch and comment result (if the workflow has secrets access)"
uses: actions/github-script@v6
env:
bot_github_token: ${{ secrets.BOT_GITHUB_TOKEN }}
if: github.event_name == 'pull_request' && env.bot_github_token != ''
with:
github-token: ${{ env.bot_github_token }}
script: |
require("./.github/scripts/compare_metrics.js")({
github: github,
context: context,
botUsername: "${{ vars.BOT_USERNAME }}",
botToken: "${{ secrets.BOT_GITHUB_TOKEN }}",
comparingDirectory: "current",
againstBranch: "${{ github.base_ref }}",
metricsRepo: "${{ vars.METRICS_REPO }}",
}).then(()=>{console.log("Done.");});
- name: "[Push] Upload Metrics"
env:
bot_github_token: ${{ secrets.BOT_GITHUB_TOKEN }}
if: github.event_name == 'push' && env.bot_github_token != ''
run: |
CURRENT_SHA=$(git rev-parse HEAD)
REPO=${{ vars.METRICS_REPO }}
BRANCH_NAME="commit-$CURRENT_SHA"
echo "Uploading to 'github.com/$REPO@$BRANCH_NAME'…"
cd current
git init -b $BRANCH_NAME
git add .
git config user.name "${{ vars.BOT_NAME }}"
git config user.email "${{ vars.BOT_EMAIL }}"
git commit -m "Upload"
git remote add origin "https://${{ vars.BOT_USERNAME }}:${{ secrets.BOT_GITHUB_TOKEN }}@github.com/$REPO.git"
git push -fu origin $BRANCH_NAME # Force for if we have to re-run the CI for some reason
publish:
runs-on: ubuntu-22.04
needs: [build-docker, build-py]
name: Publish (If Applicable)
steps:
- name: Maximize build space
uses: AdityaGarg8/remove-unwanted-software@v5
with:
remove-dotnet: "true"
remove-android: "true"
remove-haskell: "true"
remove-codeql: "true"
remove-docker-images: "true"
- name: Check out repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Environment
uses: ./.github/actions/setup_env
- name: Auth (Docker)
if: ${{ env.PUBLISH == '1' }}
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.BOT_GITHUB_TOKEN }}
- name: Download Image (Docker/x86_64)
uses: actions/download-artifact@v4
with:
name: docker-image-x86_64
path: /tmp/docker
- name: Download Image (Docker/aarch64)
uses: actions/download-artifact@v4
with:
name: docker-image-aarch64
path: /tmp/docker
- name: Load Images (Docker)
run: |
for file in /tmp/docker/*; do
cat $file | docker load
done
- name: Push (Docker)
if: ${{ env.PUBLISH == '1' }}
run: |
docker tag librelane:tmp-x86_64-linux ghcr.io/${{ github.repository }}:$NEW_TAG-x86_64
docker push ghcr.io/${{ github.repository }}:$NEW_TAG-x86_64
docker tag librelane:tmp-aarch64-linux ghcr.io/${{ github.repository }}:$NEW_TAG-aarch64
docker push ghcr.io/${{ github.repository }}:$NEW_TAG-aarch64
docker manifest create\
ghcr.io/${{ github.repository }}:$NEW_TAG\
ghcr.io/${{ github.repository }}:$NEW_TAG-x86_64\
ghcr.io/${{ github.repository }}:$NEW_TAG-aarch64
docker manifest push ghcr.io/${{ github.repository }}:$NEW_TAG
- name: Set Up Python
if: ${{ env.PUBLISH == '1' }}
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Build Distribution
if: ${{ env.PUBLISH == '1' }}
run: |
make dist
- name: Publish
if: ${{ env.PUBLISH == '1' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Tag Commit
if: ${{ env.PUBLISH == '1' }}
uses: tvdias/github-tagger@v0.0.1
with:
tag: "${{ env.NEW_TAG }}"
repo-token: "${{ secrets.BOT_GITHUB_TOKEN }}"