From 7c88c78322ba882f41d536b59bc6e121ba76049e Mon Sep 17 00:00:00 2001 From: Fabian Schuiki Date: Tue, 6 Jan 2026 10:53:35 -0800 Subject: [PATCH] Factor out common install scripts; bump Verilator in integration-test Move the commonly-used tool installation scripts into a new `install/` directory instead of each image having an almost-identical copy of it lying around. Move the dockerfiles into the same directory such that they are built from the same context, having access ot the same install script directory. This also bumps Verilator in the integration-test image to 5.040, which was the original trigger for this. Also move cleanup into the individual install scripts instead of having the dockerfiles run rm. --- .github/workflows/esiruntime-build.yml | 3 +-- .github/workflows/integration-test.yml | 7 ++--- .github/workflows/pycde-build.yml | 3 +-- .github/workflows/pycde-esi-test.yml | 3 +-- README.md | 2 ++ .../Dockerfile => esiruntime-wheel.dockerfile | 6 ++--- {pycde-esi-test => install}/cmake.sh | 8 ++++-- {esiruntime-wheel => install}/grpc.sh | 14 +++++----- {integration-test => install}/or-tools.sh | 12 +++++---- {integration-test => install}/sby.sh | 4 ++- {pycde-esi-test => install}/verilator.sh | 12 ++++++--- {integration-test => install}/yosys.sh | 2 ++ {integration-test => install}/z3.sh | 0 .../Dockerfile => integration-test.dockerfile | 22 +++------------ integration-test/cmake.sh | 18 ------------- integration-test/grpc.sh | 26 ------------------ integration-test/verilator.sh | 14 ---------- .../Dockerfile => pycde-build.dockerfile | 8 ++---- pycde-build/grpc.sh | 27 ------------------- pycde-build/verilator.sh | 14 ---------- .../Dockerfile => pycde-esi-test.dockerfile | 11 ++------ pycde-esi-test/grpc.sh | 26 ------------------ 22 files changed, 49 insertions(+), 193 deletions(-) rename esiruntime-wheel/Dockerfile => esiruntime-wheel.dockerfile (68%) rename {pycde-esi-test => install}/cmake.sh (81%) rename {esiruntime-wheel => install}/grpc.sh (79%) rename {integration-test => install}/or-tools.sh (86%) rename {integration-test => install}/sby.sh (96%) rename {pycde-esi-test => install}/verilator.sh (65%) rename {integration-test => install}/yosys.sh (97%) rename {integration-test => install}/z3.sh (100%) rename integration-test/Dockerfile => integration-test.dockerfile (85%) delete mode 100755 integration-test/cmake.sh delete mode 100755 integration-test/grpc.sh delete mode 100755 integration-test/verilator.sh rename pycde-build/Dockerfile => pycde-build.dockerfile (85%) delete mode 100755 pycde-build/grpc.sh delete mode 100755 pycde-build/verilator.sh rename pycde-esi-test/Dockerfile => pycde-esi-test.dockerfile (91%) delete mode 100755 pycde-esi-test/grpc.sh diff --git a/.github/workflows/esiruntime-build.yml b/.github/workflows/esiruntime-build.yml index 017c18b..01bca2e 100644 --- a/.github/workflows/esiruntime-build.yml +++ b/.github/workflows/esiruntime-build.yml @@ -11,11 +11,10 @@ jobs: - name: Get CIRCT images repo uses: actions/checkout@v4 - name: Build and push image - working-directory: ./esiruntime-wheel run: | TAG=$(date -u +%Y%m%d%H%M%S) echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin - docker build . --tag ghcr.io/${{github.repository}}/esiruntime-wheel:$TAG + docker build . -f esiruntime-wheel.dockerfile --tag ghcr.io/${{github.repository}}/esiruntime-wheel:$TAG docker push ghcr.io/${{github.repository}}/esiruntime-wheel:$TAG docker tag ghcr.io/${{github.repository}}/esiruntime-wheel:$TAG ghcr.io/${{github.repository}}/esiruntime-wheel:latest docker push ghcr.io/${{github.repository}}/esiruntime-wheel:latest diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 68a4f24..ab17b4e 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -2,7 +2,7 @@ name: Integration Test Image on: push: - branches: [trunk] + branches: [trunk, main] paths: - 'integration-test/**' - '.github/workflows/integration-test.yml' @@ -18,9 +18,6 @@ jobs: build: name: Build runs-on: ubuntu-latest - defaults: - run: - working-directory: integration-test steps: - name: Checkout repository uses: actions/checkout@v4 @@ -31,7 +28,7 @@ jobs: echo "GHCR_TAG=ghcr.io/${{github.repository}}/circt-integration-test:$TAG" >> $GITHUB_ENV - name: Build image - run: docker build . --tag $GHCR_TAG + run: docker build . -f integration-test.dockerfile --tag $GHCR_TAG - name: Push image if: ${{ github.event_name == 'release' }} diff --git a/.github/workflows/pycde-build.yml b/.github/workflows/pycde-build.yml index a51da6d..dc14345 100644 --- a/.github/workflows/pycde-build.yml +++ b/.github/workflows/pycde-build.yml @@ -11,11 +11,10 @@ jobs: - name: Get CIRCT images repo uses: actions/checkout@v4 - name: Build and push image - working-directory: ./pycde-build run: | TAG=$(date -u +%Y%m%d%H%M%S) echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin - docker build . --tag ghcr.io/${{github.repository}}/pycde-build:$TAG + docker build . -f pycde-build.dockerfile --tag ghcr.io/${{github.repository}}/pycde-build:$TAG docker push ghcr.io/${{github.repository}}/pycde-build:$TAG docker tag ghcr.io/${{github.repository}}/pycde-build:$TAG ghcr.io/${{github.repository}}/pycde-build:latest docker push ghcr.io/${{github.repository}}/pycde-build:latest diff --git a/.github/workflows/pycde-esi-test.yml b/.github/workflows/pycde-esi-test.yml index 48c1daf..2e8c194 100644 --- a/.github/workflows/pycde-esi-test.yml +++ b/.github/workflows/pycde-esi-test.yml @@ -11,11 +11,10 @@ jobs: - name: Get CIRCT images repo uses: actions/checkout@v4 - name: Build and push image - working-directory: ./pycde-esi-test run: | TAG=$(date -u +%Y%m%d%H%M%S) echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin - docker build . --tag ghcr.io/${{github.repository}}/pycde-esi-test:$TAG + docker build . -f pycde-esi-test.dockerfile --tag ghcr.io/${{github.repository}}/pycde-esi-test:$TAG docker push ghcr.io/${{github.repository}}/pycde-esi-test:$TAG docker tag ghcr.io/${{github.repository}}/pycde-esi-test:$TAG ghcr.io/${{github.repository}}/pycde-esi-test:latest docker push ghcr.io/${{github.repository}}/pycde-esi-test:latest diff --git a/README.md b/README.md index 021a16e..aece336 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ requires that the image definition and any files the definition needs to testing) `cd` into the image directory and run `docker build . -t ` wherein tag is what you want the image to be called. +The `install` directory contains installation scripts shared by multiple images. + ## Workflow The publishing workflow for all the images is in diff --git a/esiruntime-wheel/Dockerfile b/esiruntime-wheel.dockerfile similarity index 68% rename from esiruntime-wheel/Dockerfile rename to esiruntime-wheel.dockerfile index 8efb6d9..32bbddf 100644 --- a/esiruntime-wheel/Dockerfile +++ b/esiruntime-wheel.dockerfile @@ -4,8 +4,6 @@ RUN yum install -y \ wget ninja-build autoconf bc bison flex flex-devel perl \ python3 python3-devel -COPY *.sh /tmp/ - -# Compile, install, then cleanup gRPC +# Install tools +COPY install/*.sh /tmp/ RUN /tmp/grpc.sh -RUN rm -r /tmp/grpc diff --git a/pycde-esi-test/cmake.sh b/install/cmake.sh similarity index 81% rename from pycde-esi-test/cmake.sh rename to install/cmake.sh index b8870b8..9fec05f 100755 --- a/pycde-esi-test/cmake.sh +++ b/install/cmake.sh @@ -1,5 +1,4 @@ -#!/bin/bash -# Download and install a modern release of CMake into "/usr". +#!/bin/bash -xe CMAKE_VER=3.23.2 @@ -15,4 +14,9 @@ cd /tmp wget https://github.com/Kitware/CMake/releases/download/v$CMAKE_VER/$INSTALL_SCRIPT chmod +x $INSTALL_SCRIPT ./$INSTALL_SCRIPT --skip-license --prefix=/usr + +# Cleanup rm $INSTALL_SCRIPT + +# Sanity check +cmake --version | grep "cmake version $CMAKE_VER" diff --git a/esiruntime-wheel/grpc.sh b/install/grpc.sh similarity index 79% rename from esiruntime-wheel/grpc.sh rename to install/grpc.sh index 46be273..8443abd 100755 --- a/esiruntime-wheel/grpc.sh +++ b/install/grpc.sh @@ -1,14 +1,10 @@ -#!/usr/bin/env bash -set -e +#!/bin/bash -xe -# Installs gRPC from source. +GRPC_VER=1.54.2 +# v1.54.2 is the version in Ubuntu 22.04 cd /tmp -# v1.54.2 is the version in Ubuntu 22.04 -GRPC_VER=1.54.2 -echo "Installing gRPC..." - if [ ! -d grpc ]; then git clone --recurse-submodules -b v$GRPC_VER https://github.com/grpc/grpc fi @@ -23,4 +19,6 @@ cmake -S ../.. -B . \ ninja -j$(nproc) ninja install -echo "Done." +# Cleanup +cd /tmp +rm -r grpc diff --git a/integration-test/or-tools.sh b/install/or-tools.sh similarity index 86% rename from integration-test/or-tools.sh rename to install/or-tools.sh index e2152bd..095e88b 100755 --- a/integration-test/or-tools.sh +++ b/install/or-tools.sh @@ -1,7 +1,5 @@ -#!/bin/bash -# Downloads, compiles, and installs OR-Tools into /usr - -set -e +#!/bin/bash -xe +# Downloads, compiles, and installs OR-Tools OR_TOOLS_VER=9.5 @@ -13,7 +11,6 @@ OR_TOOLS_VER=9.5 cd /tmp wget https://github.com/google/or-tools/archive/v$OR_TOOLS_VER.tar.gz tar -zxf v$OR_TOOLS_VER.tar.gz -rm v$OR_TOOLS_VER.tar.gz cd or-tools-$OR_TOOLS_VER cmake -S . -B build \ -GNinja \ @@ -26,3 +23,8 @@ cmake -S . -B build \ cmake --build build --parallel $(nproc) cmake --install build --prefix /usr + +# Cleanup +cd /tmp +rm v$OR_TOOLS_VER.tar.gz +rm -r or-tools-$OR_TOOLS_VER diff --git a/integration-test/sby.sh b/install/sby.sh similarity index 96% rename from integration-test/sby.sh rename to install/sby.sh index 79b7fd0..fa05a4a 100755 --- a/integration-test/sby.sh +++ b/install/sby.sh @@ -10,7 +10,9 @@ tar -zxf yosys-$YOSYS_VER.tar.gz rm yosys-$YOSYS_VER.tar.gz cd sby-yosys-$YOSYS_VER make PREFIX=/usr install -cd .. + +# Cleanup +cd /tmp rm -r sby-yosys-$YOSYS_VER # Perform a sanity check. diff --git a/pycde-esi-test/verilator.sh b/install/verilator.sh similarity index 65% rename from pycde-esi-test/verilator.sh rename to install/verilator.sh index 1f5042a..54996fe 100755 --- a/pycde-esi-test/verilator.sh +++ b/install/verilator.sh @@ -1,14 +1,20 @@ -#!/bin/bash -e -# Downloads, compiles, and installs Verilator into $/ext +#!/bin/bash -xe VERILATOR_VER=5.040 cd /tmp wget https://github.com/verilator/verilator/archive/v$VERILATOR_VER.tar.gz tar -zxf v$VERILATOR_VER.tar.gz -rm v$VERILATOR_VER.tar.gz cd verilator-$VERILATOR_VER autoconf ./configure --prefix=/usr make -j$(nproc) make install + +# Cleanup +cd /tmp +rm v$VERILATOR_VER.tar.gz +rm -r verilator-$VERILATOR_VER + +# Sanity check +verilator --version | grep "Verilator $VERILATOR_VER" diff --git a/integration-test/yosys.sh b/install/yosys.sh similarity index 97% rename from integration-test/yosys.sh rename to install/yosys.sh index e63ff5d..28e92ee 100755 --- a/integration-test/yosys.sh +++ b/install/yosys.sh @@ -12,6 +12,8 @@ export PREFIX=/usr make config-clang make -j$(nproc) make install + +# Cleanup cd /tmp rm -r /tmp/yosys diff --git a/integration-test/z3.sh b/install/z3.sh similarity index 100% rename from integration-test/z3.sh rename to install/z3.sh diff --git a/integration-test/Dockerfile b/integration-test.dockerfile similarity index 85% rename from integration-test/Dockerfile rename to integration-test.dockerfile index f17a5dd..a15a658 100644 --- a/integration-test/Dockerfile +++ b/integration-test.dockerfile @@ -17,6 +17,7 @@ RUN apt-get update && apt-get install -y \ gawk \ git \ gperf \ + help2man \ iverilog \ libffi-dev \ libfl-dev \ @@ -67,30 +68,13 @@ RUN ln -s /usr/bin/clang-17 /usr/bin/clang; \ RUN add-apt-repository ppa:ubuntu-toolchain-r/test RUN apt install -y g++-11 -COPY *.sh /tmp/ - -# Install modern release of CMake +# Install tools +COPY install/*.sh /tmp/ RUN /tmp/cmake.sh - -# Compile, install, then cleanup Verilator RUN /tmp/verilator.sh -RUN rm -r /tmp/verilator-* - -# Compile, install, then cleanup gRPC -# RUN /tmp/grpc.sh -# RUN rm -r /tmp/grpc - -# Compile, install, then cleanup OR-Tools RUN /tmp/or-tools.sh -RUN rm -r /tmp/or-tools-* - -# Install a modern release of Z3 RUN /tmp/z3.sh - -# Install Yosys. RUN /tmp/yosys.sh - -# Install SymbiYosys. RUN /tmp/sby.sh # Create manylinux compatible directory structure. diff --git a/integration-test/cmake.sh b/integration-test/cmake.sh deleted file mode 100755 index b8870b8..0000000 --- a/integration-test/cmake.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Download and install a modern release of CMake into "/usr". - -CMAKE_VER=3.23.2 - -# Detect the host's architecture to download the appropriate release. -case $(uname -m) in - aarch64|arm64) BINARY_ARCH=aarch64;; - x86_64) BINARY_ARCH=x86_64;; -esac - -INSTALL_SCRIPT=cmake-$CMAKE_VER-linux-$BINARY_ARCH.sh - -cd /tmp -wget https://github.com/Kitware/CMake/releases/download/v$CMAKE_VER/$INSTALL_SCRIPT -chmod +x $INSTALL_SCRIPT -./$INSTALL_SCRIPT --skip-license --prefix=/usr -rm $INSTALL_SCRIPT diff --git a/integration-test/grpc.sh b/integration-test/grpc.sh deleted file mode 100755 index 1d66389..0000000 --- a/integration-test/grpc.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -set -e - -# Installs gRPC from source. - -cd /tmp - -# v1.54.2 is the version in Ubuntu 22.04 -GRPC_VER=1.54.2 -echo "Installing gRPC..." - -if [ ! -d grpc ]; then - git clone --recurse-submodules -b v$GRPC_VER https://github.com/grpc/grpc -fi -cd grpc -mkdir -p cmake/build -cd cmake/build -cmake -S ../.. -B . \ - -G Ninja \ - -DgRPC_INSTALL=ON \ - -DCMAKE_BUILD_TYPE=Release -ninja -j$(nproc) -cmake --install . - -echo "Done." diff --git a/integration-test/verilator.sh b/integration-test/verilator.sh deleted file mode 100755 index 72c3aef..0000000 --- a/integration-test/verilator.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -# Downloads, compiles, and installs Verilator into $/ext - -VERILATOR_VER=4.110 - -cd /tmp -wget https://github.com/verilator/verilator/archive/v$VERILATOR_VER.tar.gz -tar -zxf v$VERILATOR_VER.tar.gz -rm v$VERILATOR_VER.tar.gz -cd verilator-$VERILATOR_VER -autoconf -./configure --prefix=/usr -make -j$(nproc) -make install diff --git a/pycde-build/Dockerfile b/pycde-build.dockerfile similarity index 85% rename from pycde-build/Dockerfile rename to pycde-build.dockerfile index ed5bce9..2494e1f 100644 --- a/pycde-build/Dockerfile +++ b/pycde-build.dockerfile @@ -7,14 +7,10 @@ RUN yum install -y \ wget ninja-build autoconf bc bison flex flex-devel perl \ python3 python3-devel -COPY *.sh /tmp/ - +# Install tools +COPY install/*.sh /tmp/ RUN /tmp/verilator.sh -RUN rm -r /tmp/verilator-* - -# Compile, install, then cleanup gRPC RUN /tmp/grpc.sh -RUN rm -r /tmp/grpc # Install sccache ENV sccache_version=0.5.4 diff --git a/pycde-build/grpc.sh b/pycde-build/grpc.sh deleted file mode 100755 index 8ce76b2..0000000 --- a/pycde-build/grpc.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash - -set -e - -# Installs gRPC from source. - -cd /tmp - -# v1.54.2 is the version in Ubuntu 22.04 -GRPC_VER=1.54.0 -echo "Installing gRPC..." - -if [ ! -d grpc ]; then - git clone --recurse-submodules -b v$GRPC_VER https://github.com/grpc/grpc -fi -cd grpc -mkdir -p cmake/build -cd cmake/build -cmake -S ../.. -B . \ - -G Ninja \ - -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ - -DgRPC_INSTALL=ON \ - -DCMAKE_BUILD_TYPE=Release -ninja -j$(nproc) -ninja install - -echo "Done." diff --git a/pycde-build/verilator.sh b/pycde-build/verilator.sh deleted file mode 100755 index 5e3b428..0000000 --- a/pycde-build/verilator.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -e -# Downloads, compiles, and installs Verilator into $/ext - -VERILATOR_VER=4.110 - -cd /tmp -wget https://github.com/verilator/verilator/archive/v$VERILATOR_VER.tar.gz -tar -zxf v$VERILATOR_VER.tar.gz -rm v$VERILATOR_VER.tar.gz -cd verilator-$VERILATOR_VER -autoconf -./configure --prefix=/usr -make -j$(nproc) -make install diff --git a/pycde-esi-test/Dockerfile b/pycde-esi-test.dockerfile similarity index 91% rename from pycde-esi-test/Dockerfile rename to pycde-esi-test.dockerfile index 504ab73..401253a 100644 --- a/pycde-esi-test/Dockerfile +++ b/pycde-esi-test.dockerfile @@ -68,18 +68,11 @@ RUN ln -s /usr/bin/clang-17 /usr/bin/clang; \ RUN add-apt-repository ppa:ubuntu-toolchain-r/test RUN apt install -y g++-11 -COPY *.sh /tmp/ - -# Install modern release of CMake +# Install tools +COPY install/*.sh /tmp/ RUN /tmp/cmake.sh - -# Compile, install, then cleanup Verilator RUN /tmp/verilator.sh -RUN rm -r /tmp/verilator-* - -# Compile, install, then cleanup gRPC RUN /tmp/grpc.sh -RUN rm -r /tmp/grpc # Create manylinux compatible directory structure. RUN mkdir -p /opt/python/cp312-cp312/bin; \ diff --git a/pycde-esi-test/grpc.sh b/pycde-esi-test/grpc.sh deleted file mode 100755 index 1d66389..0000000 --- a/pycde-esi-test/grpc.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -set -e - -# Installs gRPC from source. - -cd /tmp - -# v1.54.2 is the version in Ubuntu 22.04 -GRPC_VER=1.54.2 -echo "Installing gRPC..." - -if [ ! -d grpc ]; then - git clone --recurse-submodules -b v$GRPC_VER https://github.com/grpc/grpc -fi -cd grpc -mkdir -p cmake/build -cd cmake/build -cmake -S ../.. -B . \ - -G Ninja \ - -DgRPC_INSTALL=ON \ - -DCMAKE_BUILD_TYPE=Release -ninja -j$(nproc) -cmake --install . - -echo "Done."