-
Notifications
You must be signed in to change notification settings - Fork 317
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PyCDE] Move build and publishing pipeline into repo (#7062)
Previously was built and published internally. Resolves #1509.
- Loading branch information
Showing
4 changed files
with
203 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,195 @@ | ||
name: PyCDE Test and Publish | ||
|
||
# Build the wheels for a series of Python versions and OSes and publish them to | ||
# PyPI. | ||
|
||
on: | ||
push: | ||
tags: | ||
- pycde-* | ||
workflow_dispatch: | ||
|
||
jobs: | ||
# Build CIRCT and run its tests using a Docker container with all the | ||
# integration testing prerequisite installed. | ||
build-circt: | ||
|
||
# --------------------------------------------------------------------------- | ||
# Build and test Linux wheels. Run the CIRCT tests also. | ||
# --------------------------------------------------------------------------- | ||
|
||
build-linux: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
# Run on an internal MSFT subscription. Please DO NOT use this for any other | ||
# workflows without talking to John Demme ([email protected], GH | ||
# teqdruid) first. We may lose funding for this if it ends up costing too | ||
# much. | ||
# If individual jobs fail due to timeouts or disconnects, please report to | ||
# John and re-run the job. | ||
runs-on: | ||
- self-hosted | ||
- 1ES.Pool=1ES-CIRCT-builds | ||
- 1ES.ImageOverride=CIRCT-StdUbuntu2204 | ||
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 | ||
- cp38-manylinux_x86_64 | ||
- cp39-manylinux_x86_64 | ||
- cp310-manylinux_x86_64 | ||
- cp311-manylinux_x86_64 | ||
- cp312-manylinux_x86_64 | ||
steps: | ||
# Clone the CIRCT repo and its submodules. Do shallow clone to save clone | ||
# time. | ||
- name: Get CIRCT | ||
uses: actions/checkout@v3 | ||
- name: Get CIRCT (no submodules) | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
fetch-depth: 0 | ||
fetch-tags: true | ||
submodules: false | ||
|
||
- name: Get shallow LLVM submodule | ||
run: | | ||
git submodule update --init --recursive --recommend-shallow --depth 1 | ||
# -------- | ||
# 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 | ||
# Build CIRCT and run its tests using a Docker container with all the | ||
# integration testing prerequisite installed. | ||
- name: Build wheel | ||
env: | ||
CC: clang | ||
CXX: clang++ | ||
CIBW_BUILD: ${{ matrix.python-env }} | ||
CIBW_ENVIRONMENT: CMAKE_GENERATOR=Ninja | ||
CMAKE_GENERATOR: Ninja | ||
SETUPTOOLS_SCM_DEBUG: True | ||
BUILD_TYPE: RelWithAsserts | ||
BUILD_TYPE: Release | ||
RUN_TESTS: True | ||
run: | | ||
set -o errexit | ||
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 | ||
- name: Get wheel name | ||
shell: bash | ||
id: whl-name | ||
run: | | ||
cd wheelhouse | ||
echo WHL=`ls *.whl` >> "$GITHUB_OUTPUT" | ||
- name: Upload wheels as artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ steps.whl-name.outputs.WHL }} | ||
path: wheelhouse/${{ steps.whl-name.outputs.WHL }} | ||
retention-days: 7 | ||
if-no-files-found: error | ||
|
||
|
||
# --------------------------------------------------------------------------- | ||
# Build and test Windows wheels. | ||
# --------------------------------------------------------------------------- | ||
|
||
build-windows: | ||
name: Build | ||
# Run on an internal MSFT subscription. Please DO NOT use this for any other | ||
# workflows without talking to John Demme ([email protected], GH | ||
# teqdruid) first. We may lose funding for this if it ends up costing too | ||
# much. | ||
# If individual jobs fail due to timeouts or disconnects, please report to | ||
# John and re-run the job. | ||
runs-on: | ||
- self-hosted | ||
- 1ES.Pool=1ES-CIRCT-builds | ||
- 1ES.ImageOverride=1esMMSWindows2022 | ||
strategy: | ||
matrix: | ||
python-env: | ||
- cp38-win_amd64 | ||
- cp39-win_amd64 | ||
- cp310-win_amd64 | ||
- cp311-win_amd64 | ||
- cp312-win_amd64 | ||
steps: | ||
# Since we don't use docker on Windows, we need to install the dependencies. | ||
- name: Build additional c++ deps | ||
shell: pwsh | ||
run: | | ||
& "${env:VCPKG_INSTALLATION_ROOT}/vcpkg" --triplet x64-windows install zlib capnproto | ||
- name: Get CIRCT | ||
uses: actions/checkout@v4 | ||
with: | ||
path: wheelhouse/*.whl | ||
fetch-depth: 0 | ||
fetch-tags: true | ||
submodules: false | ||
|
||
- name: Get shallow LLVM submodule | ||
run: | | ||
git submodule update --init --recursive --recommend-shallow --depth 1 | ||
- name: Install dependencies | ||
run: | | ||
python3 -m pip install --upgrade pip | ||
python3 -m pip install cibuildwheel twine | ||
choco install ninja | ||
- name: Build wheel | ||
shell: cmd | ||
env: | ||
CIBW_BUILD: ${{ matrix.python-env }} | ||
CMAKE_GENERATOR: Ninja | ||
SETUPTOOLS_SCM_DEBUG: True | ||
BUILD_TYPE: Release | ||
# PyCDE integration tests are not yet implemented on Windows. | ||
RUN_TESTS: False | ||
run: | | ||
echo "Building wheel" | ||
"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=x64 -host_arch=x64 && python3 -m cibuildwheel --output-dir wheelhouse frontends/PyCDE | ||
- name: Get wheel name | ||
shell: bash | ||
id: whl-name | ||
run: | | ||
cd wheelhouse | ||
echo WHL=`ls *.whl` >> "$GITHUB_OUTPUT" | ||
- name: Upload wheels as artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ steps.whl-name.outputs.WHL }} | ||
path: wheelhouse/${{ steps.whl-name.outputs.WHL }} | ||
retention-days: 7 | ||
if-no-files-found: error | ||
|
||
|
||
# --------------------------------------------------------------------------- | ||
# If both the Linux and Windows builds are successful, push the wheels to | ||
# pypi. Only do this on the main branch or a tag. | ||
# --------------------------------------------------------------------------- | ||
|
||
push_wheels: | ||
name: Push wheels (Tag or Weekly) | ||
runs-on: ubuntu-20.04 | ||
if: github.repository == 'llvm/circt' && ( github.ref == 'refs/heads/main' || github.ref_type == 'tag' ) | ||
needs: | ||
- build-linux | ||
- build-windows | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/esiaccel | ||
permissions: | ||
id-token: write | ||
|
||
steps: | ||
- name: Download wheels | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: ./wheelhouse/ | ||
merge-multiple: true | ||
|
||
- name: List downloaded wheels | ||
run: ls -laR | ||
working-directory: ./wheelhouse/ | ||
|
||
- name: Upload wheels to pypi | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
packages-dir: wheelhouse/ | ||
verify-metadata: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters