Skip to content

Commit

Permalink
[pycde] Add publish pipeline to CIRCT repo
Browse files Browse the repository at this point in the history
This is just a starting place for debugging. In order to get the
workflow added to the repo, it must exist in main. Debugging will happen
on a branch.
  • Loading branch information
teqdruid committed May 17, 2024
1 parent 9a323cb commit cb5e09a
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 2 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/pycdePublish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: PyCDE Test and Publish

# Build the wheels for a series of Python versions and OSes and publish them to
# PyPI.

on:
workflow_dispatch:

jobs:
# Build CIRCT and run its tests using a Docker container with all the
# integration testing prerequisite installed.
build-circt:
name: Build
runs-on: ubuntu-latest
strategy:
# Keep the 'matrix' strategy with one data point to make it obvious that
# this is one point in the overall matrix.
matrix:
python-env:
- cp38-win_amd64
steps:
# Clone the CIRCT repo and its submodules. Do shallow clone to save clone
# time.
- name: Get CIRCT
uses: actions/checkout@v3
with:
submodules: true

# --------
# Build and test CIRCT
# --------
- name: Install dependencies
run: |
set -o errexit
sudo apt install -y python3-pip
python3 -m pip install --upgrade pip
python3 -m pip install cibuildwheel twine
- name: Build wheel
env:
CC: clang
CXX: clang++
CIBW_BUILD: ${{ matrix.python-env }}
CIBW_ENVIRONMENT: CMAKE_GENERATOR=Ninja
SETUPTOOLS_SCM_DEBUG: True
BUILD_TYPE: RelWithAsserts
RUN_TESTS: True
run: |
export PATH=$PATH:$HOME/.local/bin
cd $(Pipeline.Workspace)/circt
echo "Fetching history and tags from CIRCT repo"
git fetch --depth=1000000 --tags --no-recurse-submodules
echo "Building wheel"
cibuildwheel --output-dir wheelhouse frontends/PyCDE
- name: Upload Binary (Non-Tag)
uses: actions/upload-artifact@v3
with:
path: wheelhouse/*.whl
retention-days: 7
20 changes: 18 additions & 2 deletions frontends/PyCDE/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class CMakeBuild(build_py):

def run(self):
target_dir = self.build_lib
test = os.getenv("RUN_TESTS")
cmake_build_dir = os.getenv("PYCDE_CMAKE_BUILD_DIR")
if not cmake_build_dir:
cmake_build_dir = os.path.join(target_dir, "..", "cmake_build")
Expand Down Expand Up @@ -81,9 +82,24 @@ def run(self):
if os.path.exists(cmake_cache_file):
os.remove(cmake_cache_file)
subprocess.check_call(["cmake", src_dir] + cmake_args, cwd=cmake_build_dir)
subprocess.check_call(["cmake", "--build", ".", "--target", "check-pycde"] +
build_args,
subprocess.check_call([
"cmake",
"--build",
".",
"--target",
"check-pycde",
] + build_args,
cwd=cmake_build_dir)
if test.lower() == "true":
subprocess.check_call([
"cmake",
"--build",
".",
"--target",
"check-pycde-integration",
"check-circt",
] + build_args,
cwd=cmake_build_dir)
install_cmd = ["cmake", "--build", ".", "--target", "install-PyCDE"]
subprocess.check_call(install_cmd + build_args, cwd=cmake_build_dir)
shutil.copytree(os.path.join(cmake_install_dir, "python_packages"),
Expand Down

0 comments on commit cb5e09a

Please sign in to comment.