Skip to content

Commit b675b8a

Browse files
committed
Merge remote-tracking branch 'origin/master' into fix-yaml-module-dependency
Signed-off-by: saumya <[email protected]>
2 parents 91d6da5 + 4af876b commit b675b8a

79 files changed

Lines changed: 1543 additions & 334 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Quarterly Release Tag
2+
3+
on:
4+
schedule:
5+
# Midnight UTC on the first day of each quarter (Jan, Apr, Jul, Oct)
6+
- cron: '0 0 1 1,4,7,10 *'
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: quarterly-tag
11+
cancel-in-progress: false
12+
13+
jobs:
14+
create-tag:
15+
name: Create quarterly tag
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Determine tag name
24+
id: tag
25+
run: |
26+
month=$(date -u +%-m)
27+
year=$(date -u +%y)
28+
case $month in
29+
1|2|3) quarter=1 ;;
30+
4|5|6) quarter=2 ;;
31+
7|8|9) quarter=3 ;;
32+
10|11|12) quarter=4 ;;
33+
esac
34+
tag="${year}Q${quarter}"
35+
echo "tag=$tag" >> "$GITHUB_OUTPUT"
36+
echo "Quarterly tag: $tag"
37+
38+
- name: Configure git user
39+
run: |
40+
git config user.name "github-actions[bot]"
41+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
42+
43+
- name: Create and push tag
44+
env:
45+
TAG: ${{ steps.tag.outputs.tag }}
46+
run: |
47+
if git ls-remote --tags origin "refs/tags/$TAG" | grep -q .; then
48+
echo "Tag $TAG already exists, skipping."
49+
exit 0
50+
fi
51+
git tag --annotate "$TAG" -m "Quarterly release $TAG"
52+
git push origin "$TAG"

bazel/install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ for sub in tools/OpenROAD tools/yosys tools/yosys-slang; do
8888
fi
8989
done
9090

91-
# --- OpenROAD (delegates to its own //:install) ---
91+
# --- OpenROAD (delegates to its own //packaging:install) ---
9292
if [[ $BUILD_OPENROAD -eq 1 ]]; then
9393
echo "=== Building OpenROAD with GUI support ==="
94-
(cd "${WORKSPACE}/tools/OpenROAD" && bazelisk run --//:platform=gui //:install)
94+
(cd "${WORKSPACE}/tools/OpenROAD" && bazelisk run --//:platform=gui //packaging:install)
9595
fi
9696

9797
# --- Yosys ---

build_openroad.sh

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,64 @@ __docker_build()
253253
__local_build()
254254
{
255255
if [[ "$OSTYPE" == "darwin"* ]]; then
256-
export PATH="$(brew --prefix bison)/bin:$(brew --prefix flex)/bin:$(brew --prefix tcl-tk)/bin:$PATH"
257-
export CMAKE_PREFIX_PATH=$(brew --prefix or-tools)
256+
257+
_bison=$(brew --prefix bison 2>/dev/null || true)
258+
_flex=$(brew --prefix flex 2>/dev/null || true)
259+
_ortools=$(brew --prefix or-tools 2>/dev/null || true)
260+
261+
if [[ -z "$_bison" || ! -d "$_bison/bin" ]]; then
262+
echo "[ERROR] bison not found or broken. Run: brew install bison" >&2
263+
exit 1
264+
fi
265+
if [[ -z "$_flex" || ! -d "$_flex/bin" ]]; then
266+
echo "[ERROR] flex not found or broken. Run: brew install flex" >&2
267+
exit 1
268+
fi
269+
if [[ -z "$_ortools" || ! -d "$_ortools/lib" || ! -d "$_ortools/include" ]]; then
270+
echo "[ERROR] or-tools not found or broken. Run: brew install or-tools" >&2
271+
exit 1
272+
fi
273+
274+
export PATH="$_bison/bin:$_flex/bin:$PATH"
275+
export CMAKE_PREFIX_PATH="${_ortools}"
276+
277+
_qt5=$(brew --prefix qt@5 2>/dev/null || true)
278+
if [[ -z "$_qt5" || ! -d "$_qt5/lib" ]]; then
279+
echo "[ERROR] qt@5 not found or broken. Run: brew install qt@5" >&2
280+
exit 1
281+
fi
282+
283+
cmakeOptions+=" -DQt5_DIR=$_qt5/lib/cmake/Qt5"
284+
285+
_tcl8=$(brew --prefix tcl-tk@8 2>/dev/null || true)
286+
if [[ -z "$_tcl8" || ! -d "$_tcl8/lib" || ! -d "$_tcl8/include" ]]; then
287+
echo "[ERROR] tcl-tk@8 not found or broken. Run: brew install tcl-tk@8" >&2
288+
exit 1
289+
fi
290+
291+
cmakeOptions+=" -DTCL_LIBRARY=$_tcl8/lib/libtcl8.6.dylib"
292+
293+
cmakeOptions+=" -DTCL_INCLUDE_PATH=$_tcl8/include"
294+
cmakeOptions+=" -DFLEX_INCLUDE_DIR=$_flex/include"
295+
296+
cmakeOptions+=" -DCMAKE_CXX_FLAGS=-DBOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED"
297+
298+
_icu="$(brew --prefix icu4c 2>/dev/null || true)"
299+
if [[ -z "$_icu" || ! -d "$_icu/lib" ]]; then
300+
echo "[ERROR] icu4c not found or broken. Run: brew install icu4c" >&2
301+
exit 1
302+
fi
303+
304+
export LDFLAGS="-L$_icu/lib"
305+
export CPPFLAGS="-I$_icu/include"
306+
export PKG_CONFIG_PATH="$_icu/lib/pkgconfig"
307+
308+
_extra_lib_paths=("/opt/homebrew/lib")
309+
310+
_joined_paths="$(IFS=:; echo "${_extra_lib_paths[*]}")"
311+
312+
export LIBRARY_PATH="${_joined_paths}${LIBRARY_PATH:+:$LIBRARY_PATH}"
313+
echo "[INFO] General LIBRARY_PATH=$LIBRARY_PATH"
258314
fi
259315
if [[ -f "/opt/rh/rh-python38/enable" ]]; then
260316
set +u

claude.sh

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
#!/usr/bin/env bash
2+
# Wrapper to run Claude Code inside a Docker container with
3+
# --dangerously-skip-permissions. The repo is volume-mounted so all
4+
# edits are reflected on the host.
5+
#
6+
# Usage:
7+
# ./claude.sh --build # build the Docker image (one-time)
8+
# ./claude.sh # start Claude Code interactively
9+
# ./claude.sh --shell # get a bash shell instead
10+
# ./claude.sh -- -p "prompt" # pass extra args to claude
11+
12+
set -euo pipefail
13+
14+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
15+
16+
# --- Defaults (overridable via environment) ---
17+
CLAUDE_IMAGE="${CLAUDE_IMAGE:-openroad/flow-claude:latest}"
18+
CONTAINER_NAME="${CONTAINER_NAME:-claude-orfs}"
19+
20+
# --- Argument parsing ---
21+
SHELL_MODE=0
22+
BUILD_IMAGE=0
23+
CLAUDE_ARGS=()
24+
25+
usage() {
26+
cat <<EOF
27+
Usage: $0 [OPTIONS] [-- CLAUDE_ARGS...]
28+
29+
Options:
30+
--build Build the Docker image
31+
--shell Start a bash shell instead of Claude Code
32+
--image NAME Override Docker image (default: ${CLAUDE_IMAGE})
33+
--name NAME Override container name (default: ${CONTAINER_NAME})
34+
-h, --help Show this help
35+
36+
Environment:
37+
CLAUDE_IMAGE Docker image override (same as --image).
38+
CONTAINER_NAME Container name override (same as --name).
39+
ANTHROPIC_API_KEY Optional. Passed through if set.
40+
41+
Examples:
42+
$0 --build # build the image
43+
$0 # interactive Claude Code
44+
$0 -- -p "fix the floorplan" # Claude with a prompt
45+
$0 --shell # bash inside the container
46+
EOF
47+
exit 0
48+
}
49+
50+
while [[ $# -gt 0 ]]; do
51+
case "$1" in
52+
--build) BUILD_IMAGE=1; shift ;;
53+
--shell) SHELL_MODE=1; shift ;;
54+
--image) CLAUDE_IMAGE="$2"; shift 2 ;;
55+
--name) CONTAINER_NAME="$2"; shift 2 ;;
56+
-h|--help) usage ;;
57+
--) shift; CLAUDE_ARGS=("$@"); break ;;
58+
*) CLAUDE_ARGS+=("$1"); shift ;;
59+
esac
60+
done
61+
62+
# --- Build image (explicitly or automatically if missing) ---
63+
_build_image() {
64+
echo "Building Claude Code Docker image: ${CLAUDE_IMAGE}"
65+
docker build \
66+
-f "${SCRIPT_DIR}/docker/Dockerfile.claude" \
67+
-t "${CLAUDE_IMAGE}" \
68+
"${SCRIPT_DIR}/docker"
69+
echo "Done. Image: ${CLAUDE_IMAGE}"
70+
}
71+
72+
if [[ "${BUILD_IMAGE}" -eq 1 ]]; then
73+
_build_image
74+
# If only --build was given, exit.
75+
if [[ "${SHELL_MODE}" -eq 0 ]] && [[ ${#CLAUDE_ARGS[@]} -eq 0 ]]; then
76+
exit 0
77+
fi
78+
elif ! docker image inspect "${CLAUDE_IMAGE}" > /dev/null 2>&1; then
79+
echo "Image ${CLAUDE_IMAGE} not found. Building automatically..."
80+
_build_image
81+
fi
82+
83+
# --- Determine the user's home inside the container ---
84+
# The entrypoint creates /home/claude-user for the mapped user.
85+
CONTAINER_HOME="/home/claude-user"
86+
87+
# --- Assemble docker run arguments ---
88+
DOCKER_RUN_ARGS=(
89+
--rm
90+
--name "${CONTAINER_NAME}"
91+
-v "${SCRIPT_DIR}:/workspace"
92+
-e "HOST_UID=$(id -u)"
93+
-e "HOST_GID=$(id -g)"
94+
-w /workspace
95+
)
96+
97+
# TTY/stdin handling for interactive, CI, and piped-input cases:
98+
# * terminal in + terminal out → -it (normal interactive use)
99+
# * anything else → -i (pass stdin through; no TTY)
100+
# Forcing -it unconditionally breaks non-interactive use
101+
# ("cannot attach stdin to a TTY-enabled container"), and dropping -i
102+
# would silently discard piped input like `cat prompt.txt | claude.sh ...`.
103+
if [[ -t 0 && -t 1 ]]; then
104+
DOCKER_RUN_ARGS+=(-it)
105+
else
106+
DOCKER_RUN_ARGS+=(-i)
107+
fi
108+
109+
# Pass through optional environment variables
110+
for var in ANTHROPIC_API_KEY ANTHROPIC_MODEL CLAUDE_CODE_MAX_TURNS \
111+
CLAUDE_CODE_USE_BEDROCK \
112+
AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_REGION \
113+
GOOGLE_APPLICATION_CREDENTIALS; do
114+
if [[ -v "$var" ]] && [[ -n "${!var}" ]]; then
115+
DOCKER_RUN_ARGS+=(-e "${var}=${!var}")
116+
fi
117+
done
118+
119+
# SSH agent forwarding (for git push/pull over SSH)
120+
if [[ -n "${SSH_AUTH_SOCK:-}" ]]; then
121+
DOCKER_RUN_ARGS+=(
122+
-v "${SSH_AUTH_SOCK}:/tmp/ssh-agent.sock"
123+
-e "SSH_AUTH_SOCK=/tmp/ssh-agent.sock"
124+
)
125+
fi
126+
127+
# Host gitconfig (read-only, for user.name / user.email)
128+
if [[ -f "${HOME}/.gitconfig" ]]; then
129+
DOCKER_RUN_ARGS+=(-v "${HOME}/.gitconfig:${CONTAINER_HOME}/.gitconfig:ro")
130+
fi
131+
132+
# Persist Claude Code settings / history / memory across runs
133+
CLAUDE_CONFIG_DIR="${HOME}/.claude"
134+
mkdir -p "${CLAUDE_CONFIG_DIR}"
135+
DOCKER_RUN_ARGS+=(-v "${CLAUDE_CONFIG_DIR}:${CONTAINER_HOME}/.claude")
136+
137+
# Claude Code config file (lives next to ~/.claude/, not inside it)
138+
if [[ -f "${HOME}/.claude.json" ]]; then
139+
DOCKER_RUN_ARGS+=(-v "${HOME}/.claude.json:${CONTAINER_HOME}/.claude.json")
140+
fi
141+
142+
# Persist Bazel cache (avoids re-downloading hundreds of MB each run)
143+
BAZEL_CACHE_DIR="${BAZEL_CACHE_DIR:-${HOME}/.cache/bazel-claude}"
144+
mkdir -p "${BAZEL_CACHE_DIR}"
145+
DOCKER_RUN_ARGS+=(-v "${BAZEL_CACHE_DIR}:${CONTAINER_HOME}/.cache/bazel")
146+
147+
# --- Run ---
148+
if [[ "${SHELL_MODE}" -eq 1 ]]; then
149+
exec docker run \
150+
"${DOCKER_RUN_ARGS[@]}" \
151+
"${CLAUDE_IMAGE}" \
152+
bash
153+
else
154+
exec docker run \
155+
"${DOCKER_RUN_ARGS[@]}" \
156+
"${CLAUDE_IMAGE}" \
157+
claude --dangerously-skip-permissions "${CLAUDE_ARGS[@]}"
158+
fi

dev_env.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ function __setpaths() {
1010

1111
if [[ "$OSTYPE" == "darwin"* ]]; then
1212
export CMAKE_PREFIX_PATH="$(brew --prefix or-tools)"
13+
export QT_QPA_PLATFORM=cocoa
1314
fi
1415
}
1516
__setpaths

docker/Dockerfile.claude

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Docker image for running Claude Code with --dangerously-skip-permissions
2+
# inside a container that can build/test OpenROAD (CMake + Bazel) and run ORFS.
3+
#
4+
# Usage: see claude.sh at the repo root.
5+
6+
ARG fromImage=openroad/flow-ubuntu22.04-dev:latest
7+
8+
FROM ${fromImage}
9+
10+
# --- Bazel support ---
11+
12+
# Java 21 (required by Bazel 8.x)
13+
RUN apt-get update \
14+
&& apt-get install -y --no-install-recommends openjdk-21-jre-headless \
15+
&& rm -rf /var/lib/apt/lists/*
16+
17+
# Bazelisk (respects .bazelversion to download the correct Bazel release)
18+
RUN curl -Lo /usr/local/bin/bazelisk \
19+
https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64 \
20+
&& chmod +x /usr/local/bin/bazelisk \
21+
&& ln -sf /usr/local/bin/bazelisk /usr/local/bin/bazel
22+
23+
# --- Claude Code support ---
24+
25+
# Node.js 22 LTS (Claude Code requires Node 18+)
26+
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
27+
&& apt-get install -y --no-install-recommends nodejs \
28+
&& rm -rf /var/lib/apt/lists/*
29+
30+
# Claude Code CLI
31+
RUN npm install -g @anthropic-ai/claude-code
32+
33+
# --- Convenience ---
34+
35+
RUN apt-get update \
36+
&& apt-get install -y --no-install-recommends \
37+
sudo \
38+
less \
39+
jq \
40+
ripgrep \
41+
&& rm -rf /var/lib/apt/lists/*
42+
43+
# VS Code CLI (code-tunnel for remote editing).
44+
# Use the glibc build to match the Ubuntu base image. (The cli-alpine-x64
45+
# variant on code.visualstudio.com is statically linked and also works,
46+
# but the linux-x64 build from update.code.visualstudio.com is the
47+
# canonical match for glibc distros.)
48+
RUN curl -fsSL "https://update.code.visualstudio.com/latest/cli-linux-x64/stable" \
49+
-o /tmp/vscode-cli.tar.gz \
50+
&& tar -xzf /tmp/vscode-cli.tar.gz -C /usr/local/bin \
51+
&& rm /tmp/vscode-cli.tar.gz
52+
53+
# Trust all directories (safe inside container; the container IS the boundary)
54+
RUN git config --system safe.directory '*'
55+
56+
# Entrypoint that maps host UID/GID then drops privileges
57+
COPY claude-entrypoint.sh /usr/local/bin/claude-entrypoint.sh
58+
RUN chmod +x /usr/local/bin/claude-entrypoint.sh
59+
60+
WORKDIR /workspace
61+
ENTRYPOINT ["claude-entrypoint.sh"]

0 commit comments

Comments
 (0)